From nobody Mon Feb 9 09:39:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1727963519542433.0852663882022; Thu, 3 Oct 2024 06:51:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7C73F11C5; Thu, 3 Oct 2024 09:51:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7B69115E5; Thu, 3 Oct 2024 09:47:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5E34813D7; Thu, 3 Oct 2024 09:47:15 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6CF0413D7 for ; Thu, 3 Oct 2024 09:47:00 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-580-pYlJoTMUNAizNecqDEGoYw-1; Thu, 03 Oct 2024 09:46:56 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D8B5E195609E; Thu, 3 Oct 2024 13:46:55 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.12]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 92FBF19560A2; Thu, 3 Oct 2024 13:46:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727963220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bXdrgeij3l9biwcNzH1Hor+8GYzaciRQ1XwrLGj1ES0=; b=eoX5jiipjHNiN+USliCzWpd8XRZxWC5UKAtv5ThKnw4dbZGEy8OWwYKXpMwhDsUc7dTROa 4ZmO4Zv2yxhP5e/yyxM3W7pi6rIvsIuKTGF5/xoD994qYIgSXrb28FqSYjhLHistqdDKyw 7q7QKWVUKzR93j+l+EF7W6UEUnQ7vKM= X-MC-Unique: pYlJoTMUNAizNecqDEGoYw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 09/10] qemu: snapshot: Allow internal snapshots with PFLASH nvram Date: Thu, 3 Oct 2024 15:46:35 +0200 Message-ID: <78f4dd99364a5b5dbf7d0ed91b946aafeef1cd2b.1727962906.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KGYWRVJ3MV6PTQU5MZ6ALNSM4STGDEVQ X-Message-ID-Hash: KGYWRVJ3MV6PTQU5MZ6ALNSM4STGDEVQ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: nikolai.barybin@virtuozzo.com, den@openvz.org X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1727963520432116600 Content-Type: text/plain; charset="utf-8" With the new snapshot QMP command we can select which block device backend receives the VM state and thus the main issue with internal snapshots with pflash was addressed. Thus we can relax the check and allow snapshots if the pflash nvram is on qcow2. Signed-off-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 02c876c881..a36dff9dc8 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -798,6 +798,7 @@ qemuSnapshotPrepare(virDomainObj *vm, bool *has_manual, unsigned int *flags) { + qemuDomainObjPrivate *priv =3D vm->privateData; size_t i; bool active =3D virDomainObjIsActive(vm); bool reuse =3D (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) !=3D 0; @@ -899,7 +900,8 @@ qemuSnapshotPrepare(virDomainObj *vm, return -1; } - /* internal snapshots + pflash based loader have the following problem= s: + /* internal snapshots + pflash based loader have the following problem= s when + * using the old HMP 'savevm' command: * - if the variable store is raw, the snapshot fails * - allowing a qcow2 image as the varstore would make it eligible to = receive * the vmstate dump, which would make it huge @@ -910,14 +912,28 @@ qemuSnapshotPrepare(virDomainObj *vm, * not an issue. Allow this as there are existing users of this case. * * Avoid the issues by forbidding internal snapshot with pflash if the - * VM is active. + * VM is active when using 'savevm'. + * + * With the new QMP commands we can control where the VM state (memory) + * image goes and thus can allow snapshots, but we'll still require th= at the + * varstore is in qcow2 format. */ - if (active && - found_internal && - virDomainDefHasOldStyleUEFI(vm->def)) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("internal snapshots of a VM with pflash based fir= mware are not supported")); - return -1; + if (active && found_internal) { + if (virDomainDefHasOldStyleUEFI(vm->def) && + !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SNAPSHOT_INTERNAL_QM= P)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("internal snapshots of a VM with pflash based= firmware are not supported with this qemu")); + return -1; + } + + if (vm->def->os.loader && + vm->def->os.loader->nvram && + vm->def->os.loader->nvram->format !=3D VIR_STORAGE_FILE_QCOW2)= { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("internal snapshots of a VM with pflash based= firmware require QCOW2 nvram format")); + return -1; + } + } /* Alter flags to let later users know what we learned. */ --=20 2.46.0