From nobody Sat Feb 7 22:11:43 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 1727963248158558.4418431875918; Thu, 3 Oct 2024 06:47:28 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0A28015AC; Thu, 3 Oct 2024 09:47:26 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DD06F15CC; Thu, 3 Oct 2024 09:46:58 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 91D21154B; Thu, 3 Oct 2024 09:46:54 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 0FB381568 for ; Thu, 3 Oct 2024 09:46:46 -0400 (EDT) Received: from mx-prod-mc-04.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-53-XLRz2PfEOpqO8TZx13KPOg-1; Thu, 03 Oct 2024 09:46:42 -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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 261631955F42; Thu, 3 Oct 2024 13:46:41 +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 A05CF19560A2; Thu, 3 Oct 2024 13:46:39 +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=1727963205; 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=SeWdXzVOCAmBAJ9htavWIko0Feq9HmECfPfvrsd45To=; b=MvJxvtTlcX5TZTx60S1GUFk8UBNfBFqT/H5eXbekILQVMgpcf4LOdFibtF1OXhhFLhuqVs 2oPghQUgCJG2QHS5ETn9WVWum3U1AJRAIuSQX/dxWFc4rlp8YlW+AFzFu9lpG1QoONif9d 2rZ1+y5eJzwyroBjAhukJuzvUZrhF0M= X-MC-Unique: XLRz2PfEOpqO8TZx13KPOg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 01/10] qemuDomainObjWait: Annotate with G_GNUC_WARN_UNUSED_RESULT Date: Thu, 3 Oct 2024 15:46:27 +0200 Message-ID: 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: XQ5DUXRAT4UDYRVMQF7WH5UY356RP565 X-Message-ID-Hash: XQ5DUXRAT4UDYRVMQF7WH5UY356RP565 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: 1727963249069116600 Content-Type: text/plain; charset="utf-8" Callers must handle the return value of this function as the VM might have died. Add compiler annotation to force it. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_domain.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index ba357af8f4..c29ecdf238 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1132,7 +1132,8 @@ qemuDomainRemoveLogs(virQEMUDriver *driver, const char *name); int -qemuDomainObjWait(virDomainObj *vm); +qemuDomainObjWait(virDomainObj *vm) + G_GNUC_WARN_UNUSED_RESULT; bool qemuDomainObjIsActive(virDomainObj *vm); --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 1727963336150595.1036828136513; Thu, 3 Oct 2024 06:48:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EDD2715E8; Thu, 3 Oct 2024 09:48:54 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B75B31174; Thu, 3 Oct 2024 09:47:09 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 704AB14CD; Thu, 3 Oct 2024 09:47:05 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 8AF8D1593 for ; Thu, 3 Oct 2024 09:46:46 -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-245-ATB5aaOPOiO0wXCD33frJA-1; Thu, 03 Oct 2024 09:46:44 -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 23653195608C; Thu, 3 Oct 2024 13:46:43 +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 AF39619560A2; Thu, 3 Oct 2024 13:46:41 +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=1727963206; 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=wr+y0X4AaiSWlcJljks+ulo3sOoOTOcw1aY6iCkORtE=; b=Iv3y3eN3a0drevhF5Px66A+uia5dC9SpF/4yf4jhEWmYRT4aCPQDH94N/pAHMYMjiksTiv o9VvdKPVHFvo/m72BV7R8zNEwkphy42ChnZdD8q5ZJRiNlGcUXAW7wD9Jv2RgFyJASgcuw +WRIBnF6MQo3DcD6Bp7A9y4rIhMnSpk= X-MC-Unique: ATB5aaOPOiO0wXCD33frJA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 02/10] qemu: monitor: Add plumbing for 'snaphot-save'/'snapshot-delete' QMP commands Date: Thu, 3 Oct 2024 15:46:28 +0200 Message-ID: <8ce2f2a3a21bc97fe9bf06cf6e4df08562655a55.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: BDIYRP37PFGQTCMBZWJZVLXLPYED3YBT X-Message-ID-Hash: BDIYRP37PFGQTCMBZWJZVLXLPYED3YBT 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: 1727963357791116600 Content-Type: text/plain; charset="utf-8" From: Nikolai Barybin via Devel Signed-off-by: Nikolai Barybin Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_monitor.c | 30 ++++++++++++++++++ src/qemu/qemu_monitor.h | 14 +++++++++ src/qemu/qemu_monitor_json.c | 60 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 13 ++++++++ tests/qemumonitorjsontest.c | 33 ++++++++++++++++++++ 5 files changed, 150 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ada3de474f..fd888e2468 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2764,6 +2764,36 @@ qemuMonitorDeleteSnapshot(qemuMonitor *mon, const ch= ar *name) } +int +qemuMonitorSnapshotSave(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char *vmstate_disk, + const char **disks) +{ + VIR_DEBUG("jobname=3D'%s', snapshotname=3D'%s', vmstate_disk=3D'%s'", + jobname, snapshotname, vmstate_disk); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONSnapshotSave(mon, jobname, snapshotname, vmstate= _disk, disks); +} + + +int +qemuMonitorSnapshotDelete(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char **disks) +{ + VIR_DEBUG("jobname=3D'%s', snapshotname=3D'%s'", jobname, snapshotname= ); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONSnapshotDelete(mon, jobname, snapshotname, disks= ); +} + + int qemuMonitorBlockdevMirror(qemuMonitor *mon, const char *jobname, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 2bb64dd53f..6251f48d28 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1618,3 +1618,17 @@ int qemuMonitorDisplayReload(qemuMonitor *mon, const char *type, bool tlsCerts); + + +int +qemuMonitorSnapshotSave(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char *vmstate_disk, + const char **disks); + +int +qemuMonitorSnapshotDelete(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char **disks); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 75a5b03024..27f74181f6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8701,3 +8701,63 @@ int qemuMonitorJSONDisplayReload(qemuMonitor *mon, return 0; } + + +int +qemuMonitorJSONSnapshotSave(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char *vmstate_disk, + const char **disks) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + g_autoptr(virJSONValue) devices =3D virJSONValueNewArray(); + + for (; *disks; disks++) { + if (virJSONValueArrayAppendString(devices, *disks) < 0) + return -1; + } + + if (!(cmd =3D qemuMonitorJSONMakeCommand("snapshot-save", + "s:job-id", jobname, + "s:tag", snapshotname, + "s:vmstate", vmstate_disk, + "a:devices", &devices, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + return qemuMonitorJSONCheckError(cmd, reply); +} + + +int +qemuMonitorJSONSnapshotDelete(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char **disks) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + g_autoptr(virJSONValue) devices =3D virJSONValueNewArray(); + + for (; *disks; disks++) { + if (virJSONValueArrayAppendString(devices, *disks) < 0) + return -1; + } + + if (!(cmd =3D qemuMonitorJSONMakeCommand("snapshot-delete", + "s:job-id", jobname, + "s:tag", snapshotname, + "a:devices", &devices, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + return qemuMonitorJSONCheckError(cmd, reply); +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index fef81fd911..10491b809b 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -825,3 +825,16 @@ qemuMonitorJSONQueryStats(qemuMonitor *mon, int qemuMonitorJSONDisplayReload(qemuMonitor *mon, const char *type, bool tlsCerts); + +int +qemuMonitorJSONSnapshotSave(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char *vmstate_disk, + const char **disks); + +int +qemuMonitorJSONSnapshotDelete(qemuMonitor *mon, + const char *jobname, + const char *snapshotname, + const char **disks); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index ab2c445289..fca4890746 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1217,6 +1217,38 @@ testQemuMonitorJSONqemuMonitorJSONNBDServerStart(con= st void *opaque) return 0; } + +static int +testQemuMonitorJSONqemuMonitorJSONSnapshot(const void *opaque) +{ + const testGenericData *data =3D opaque; + virDomainXMLOption *xmlopt =3D data->xmlopt; + g_autoptr(qemuMonitorTest) test =3D NULL; + const char *disks[] =3D { "test", "disk", NULL }; + + if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) + return -1; + + if (qemuMonitorTestAddItem(test, "snapshot-save", + "{\"return\":{}}") < 0) + return -1; + + if (qemuMonitorTestAddItem(test, "snapshot-delete", + "{\"return\":{}}") < 0) + return -1; + + if (qemuMonitorJSONSnapshotSave(qemuMonitorTestGetMonitor(test), + "jobname", "snapshotname", "vmstate", = disks) < 0) + return -1; + + if (qemuMonitorJSONSnapshotDelete(qemuMonitorTestGetMonitor(test), + "jobname", "snapshotname", disks) < = 0) + return -1; + + return 0; +} + + static bool testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(struct qemuMonitorQueryCp= usEntry *a, struct qemuMonitorQueryCp= usEntry *b) @@ -2956,6 +2988,7 @@ mymain(void) DO_TEST(qemuMonitorJSONGetDumpGuestMemoryCapability); DO_TEST(qemuMonitorJSONSendKeyHoldtime); DO_TEST(qemuMonitorJSONNBDServerStart); + DO_TEST(qemuMonitorJSONSnapshot); DO_TEST_CPU_DATA("host"); DO_TEST_CPU_DATA("full"); --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 17279632712550.971492383398413; Thu, 3 Oct 2024 06:47:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1616610A; Thu, 3 Oct 2024 09:47:50 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D8F921532; Thu, 3 Oct 2024 09:47:05 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id BB99A9E1; Thu, 3 Oct 2024 09:47:01 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 AFDBE15E0 for ; Thu, 3 Oct 2024 09:46:50 -0400 (EDT) Received: from mx-prod-mc-05.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-437-kpHQ8BvZP3ul8fPjM0z7-Q-1; Thu, 03 Oct 2024 09:46:47 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D57A3195608D; Thu, 3 Oct 2024 13:46:44 +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 9589219560A2; Thu, 3 Oct 2024 13:46:43 +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=1727963210; 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=0tPEZAKe6kwMoGRVcSs+AX9DWqFsVKJ9ZNLYlf7BenY=; b=AosPl5muxMoihsNN4f4jo4CDtYURTWy+HqzuXRssUNMU+uikJUmnR45ZHKC/aNp3Pl8Nea ctP957YsJGNygO94LYW9NfS+q3a5QreFbmsiK7SoQuYAm964TQUHlm/ASdDnKBnQvscu26 JVx+SwyyadRpgzetuUuKn9R6U4kMNT8= X-MC-Unique: kpHQ8BvZP3ul8fPjM0z7-Q-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 03/10] qemu: blockjob: Add job types for 'snapshot-save/delete' Date: Thu, 3 Oct 2024 15:46:29 +0200 Message-ID: <04924364fa31063768131fb0e6007e0cb6151579.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: OLHUAOTT526RERYUF6WDKF2LGX5MERCL X-Message-ID-Hash: OLHUAOTT526RERYUF6WDKF2LGX5MERCL 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: 1727963273222116600 Content-Type: text/plain; charset="utf-8" From: Nikolai Barybin via Devel The snapshot creation/deletion QMP commands use the qemu 'job' API to signal completion thus we need to add corresponding job types. As the job handles everything internally we don't store anything about the job. Signed-off-by: Nikolai Barybin Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_block.c | 2 ++ src/qemu/qemu_blockjob.c | 7 +++++++ src/qemu/qemu_blockjob.h | 2 ++ src/qemu/qemu_domain.c | 10 ++++++++++ 4 files changed, 21 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 9bdec92697..e739c097ca 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3775,6 +3775,8 @@ qemuBlockPivot(virDomainObj *vm, case QEMU_BLOCKJOB_TYPE_BACKUP: case QEMU_BLOCKJOB_TYPE_INTERNAL: case QEMU_BLOCKJOB_TYPE_CREATE: + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE: + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE: case QEMU_BLOCKJOB_TYPE_BROKEN: virReportError(VIR_ERR_OPERATION_INVALID, _("job type '%1$s' does not support pivot"), diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 652b25540a..6e53603fba 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -68,6 +68,8 @@ VIR_ENUM_IMPL(qemuBlockjob, "backup", "", "create", + "snapshot-save", + "snapshot-delete", "broken"); static virClass *qemuBlockJobDataClass; @@ -1455,6 +1457,11 @@ qemuBlockJobEventProcessConcludedTransition(qemuBloc= kJobData *job, progressTotal); break; + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE: + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE: + /* The internal snapshot jobs don't need any extra handling */ + break; + case QEMU_BLOCKJOB_TYPE_BROKEN: case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index f1ac43b4c7..6620e08c47 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -65,6 +65,8 @@ typedef enum { /* Additional enum values local to qemu */ QEMU_BLOCKJOB_TYPE_INTERNAL, QEMU_BLOCKJOB_TYPE_CREATE, + QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE, + QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE, QEMU_BLOCKJOB_TYPE_BROKEN, QEMU_BLOCKJOB_TYPE_LAST } qemuBlockJobType; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b6762cc372..fc682c0c9d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2478,6 +2478,11 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, } break; + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE: + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE: + /* No private data for internal snapshot jobs */ + break; + case QEMU_BLOCKJOB_TYPE_BROKEN: case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: @@ -3030,6 +3035,11 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qem= uBlockJobData *job, goto broken; break; + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE: + case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE: + /* No extra data for internal snapshot jobs. */ + break; + case QEMU_BLOCKJOB_TYPE_BROKEN: case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 1727963420855262.39815685011877; Thu, 3 Oct 2024 06:50:20 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B26EE1505; Thu, 3 Oct 2024 09:50:19 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0B093153C; Thu, 3 Oct 2024 09:47:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2D5B4C86; Thu, 3 Oct 2024 09:47:07 -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 79EF814DF for ; Thu, 3 Oct 2024 09:46:53 -0400 (EDT) Received: from mx-prod-mc-05.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-70-wHIsUTCiPn25hAFpf46y1Q-1; Thu, 03 Oct 2024 09:46:47 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E2795195608A; Thu, 3 Oct 2024 13:46:46 +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 591D019560AE; Thu, 3 Oct 2024 13:46:45 +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=1727963213; 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=ZnLyOs1HYVB0CQILnBiy7u92M7yUQHltvRfBaP7Ctls=; b=dK94yKxNNVCQfiW0ezhox8rMK9yzLuFdCpHUZbwY23xUn16KBu6XPMDMe1cNb743ioCN9h /rZmTGqWNhDojLcBSgPbW0Xis3ABdFcqOMrjqG/A2B0cCgP7S4T2AOjGHmZPYj/fq9Ixbn 8JPSZLEYV1GslFy3vF25rpM6+3irafI= X-MC-Unique: wHIsUTCiPn25hAFpf46y1Q-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 04/10] qemu: capabilities: Introduce QEMU_CAPS_SNAPSHOT_INTERNAL_QMP capability Date: Thu, 3 Oct 2024 15:46:30 +0200 Message-ID: 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: 6EJYGKGLWK2N5VD4FJR2C7UKX2NX4W46 X-Message-ID-Hash: 6EJYGKGLWK2N5VD4FJR2C7UKX2NX4W46 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: 1727963422218116600 Content-Type: text/plain; charset="utf-8" From: Nikolai Barybin via Devel The 'snapshot-save/delete' QMP commands were introduced in QEMU 6.0.0, so we add a compatible capability to check if target QEMU binary supports i= t. Signed-off-by: Nikolai Barybin Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml | 1 + tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml | 1 + tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml | 1 + tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_s390x.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_9.0.0_sparc.xml | 1 + tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml | 1 + 31 files changed, 36 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 6a0f3e2ab7..29a847346c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -715,6 +715,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "acpi-erst", /* QEMU_CAPS_DEVICE_ACPI_ERST */ "intel-iommu.dma-translation", /* QEMU_CAPS_INTEL_IOMMU_DMA_= TRANSLATION */ "machine-i8042-opt", /* QEMU_CAPS_MACHINE_I8042_OPT */ + + /* 465 */ + "snapshot-internal-qmp", /* QEMU_CAPS_SNAPSHOT_INTERNAL_QMP = */ ); @@ -1235,6 +1238,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = =3D { { "query-stats", QEMU_CAPS_QUERY_STATS }, { "query-stats-schemas", QEMU_CAPS_QUERY_STATS_SCHEMAS }, { "display-reload", QEMU_CAPS_DISPLAY_RELOAD }, + { "snapshot-save", QEMU_CAPS_SNAPSHOT_INTERNAL_QMP }, }; struct virQEMUCapsStringFlags virQEMUCapsMigration[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 736d34179e..091de8999d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -695,6 +695,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_INTEL_IOMMU_DMA_TRANSLATION, /* intel-iommu.dma-translation = */ QEMU_CAPS_MACHINE_I8042_OPT, /* -machine xxx,i8042=3Don/off; use virQE= MUCapsSupportsI8042Toggle() to query this capability */ + /* 465 */ + QEMU_CAPS_SNAPSHOT_INTERNAL_QMP, /* internal snapshot support via QMP = commands 'snapshot-save'/'snapshot-delete' */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml b/tests/qemu= capabilitiesdata/caps_6.0.0_aarch64.xml index 83439f3d63..a02018a467 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml @@ -138,6 +138,7 @@ + 6000000 61700242 v6.0.0 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_6.0.0_s390x.xml index 332b8091ee..9d84d3bdc9 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml @@ -94,6 +94,7 @@ + 6000000 39100242 qemu-6.0.0-20210517.1.4ff77070.fc33 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.0.0_x86_64.xml index dc55e0ab3f..a8897fb80b 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml @@ -173,6 +173,7 @@ + 6000000 43100242 v6.0.0 diff --git a/tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.1.0_x86_64.xml index 1d5b8ea9d2..0f2995a2d3 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml @@ -179,6 +179,7 @@ + 6001000 43100243 v6.1.0 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml b/tests/qemu= capabilitiesdata/caps_6.2.0_aarch64.xml index 25049e1ab8..5624ad95a1 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml @@ -151,6 +151,7 @@ + 6001050 61700244 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml b/tests/qemuca= pabilitiesdata/caps_6.2.0_ppc64.xml index e321481949..d4172c3146 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml @@ -139,6 +139,7 @@ + 6002000 42900244 v6.2.0 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.2.0_x86_64.xml index f8f8bd95f4..582b0e9b52 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml @@ -181,6 +181,7 @@ + 6002000 43100244 v6.2.0 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml b/tests/= qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml index 13b67cc7bf..8bdb26e8a4 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml @@ -160,6 +160,7 @@ + 6002092 61700243 v7.0.0-rc2 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml b/tests/qemu= capabilitiesdata/caps_7.0.0_aarch64.xml index a9fe9a2014..697c1c255a 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml @@ -160,6 +160,7 @@ + 6002092 61700243 v7.0.0-rc2 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml b/tests/qemuca= pabilitiesdata/caps_7.0.0_ppc64.xml index 92636bc7d4..e02f42c5e0 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml @@ -158,6 +158,7 @@ + 7000000 42900243 v7.0.0 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.0.0_x86_64.xml index 23b626aa16..fd317a9afa 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml @@ -189,6 +189,7 @@ + 7000000 43100243 v7.0.0 diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml b/tests/qemuca= pabilitiesdata/caps_7.1.0_ppc64.xml index a851d89974..427aa1ace9 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml @@ -159,6 +159,7 @@ + 7001000 42900244 v7.1.0 diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.1.0_x86_64.xml index 81c4cc474b..32e4e8e1bb 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml @@ -194,6 +194,7 @@ + 7001000 43100244 v7.1.0 diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml b/tests/qemucapa= bilitiesdata/caps_7.2.0_ppc.xml index 998c548556..56cb66d394 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml @@ -154,6 +154,7 @@ + 7002000 0 qemu-7.2.0-6.fc37 diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml b/tests/q= emucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml index 18d74d6e8c..0ebcb94a31 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml @@ -198,6 +198,7 @@ + 7002000 43100245 v7.2.0 diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.2.0_x86_64.xml index fb52a30f04..025ced01d9 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml @@ -198,6 +198,7 @@ + 7002000 43100245 v7.2.0 diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml b/tests/qemu= capabilitiesdata/caps_8.0.0_riscv64.xml index 03c0e99da5..7959d49c02 100644 --- a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml @@ -141,6 +141,7 @@ + 7002050 0 v7.2.0-333-g222059a0fc diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.0.0_x86_64.xml index 459d05bf43..5f45788b77 100644 --- a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml @@ -202,6 +202,7 @@ + 8000000 43100244 v8.0.0 diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_8.1.0_s390x.xml index c2211bfb12..16a3e3fbe0 100644 --- a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml @@ -122,6 +122,7 @@ + 8001000 39100245 v8.1.0 diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.1.0_x86_64.xml index 289c87ff19..7dee7f94c2 100644 --- a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml @@ -204,6 +204,7 @@ + 8001000 43100245 v8.1.0 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml b/tests/qemu= capabilitiesdata/caps_8.2.0_aarch64.xml index 0043443880..78082dbf3f 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml @@ -169,6 +169,7 @@ + 8002000 61700246 v8.2.0 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml b/tests/qemuc= apabilitiesdata/caps_8.2.0_armv7l.xml index 16377a74e3..912eb45db6 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml @@ -176,6 +176,7 @@ + 8002000 0 qemu-8.2.0-7.fc39 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml b/tests/= qemucapabilitiesdata/caps_8.2.0_loongarch64.xml index eb80be7a06..60b980e256 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml @@ -159,6 +159,7 @@ + 8002000 106300246 v8.2.0 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_8.2.0_s390x.xml index e86088332e..8f36104080 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_s390x.xml @@ -123,6 +123,7 @@ + 8002000 39100246 v8.2.0 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.2.0_x86_64.xml index e56d5dafa4..51e14736cd 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml @@ -207,6 +207,7 @@ + 8002000 43100246 v8.2.0 diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_sparc.xml b/tests/qemuca= pabilitiesdata/caps_9.0.0_sparc.xml index 7fe971fc3a..1b56aebd48 100644 --- a/tests/qemucapabilitiesdata/caps_9.0.0_sparc.xml +++ b/tests/qemucapabilitiesdata/caps_9.0.0_sparc.xml @@ -79,6 +79,7 @@ + 9000000 0 qemu-9.0.0-1.fc40 diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_9.0.0_x86_64.xml index 3f1f518d22..4b64547b11 100644 --- a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml @@ -209,6 +209,7 @@ + 9000000 43100245 v9.0.0 diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml b/tests/qemu= capabilitiesdata/caps_9.1.0_riscv64.xml index 20cf97cdf9..1e7b1e622b 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml @@ -167,6 +167,7 @@ + 9001000 0 v9.1.0 diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_9.1.0_x86_64.xml index a6b3768dfd..06600f48fb 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml @@ -207,6 +207,7 @@ + 9001000 43100246 v9.1.0 --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 1727963309164580.9446512570391; Thu, 3 Oct 2024 06:48:29 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 02A4A15F8; Thu, 3 Oct 2024 09:48:27 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CC14911CA; Thu, 3 Oct 2024 09:47:07 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F0AFBC6A; Thu, 3 Oct 2024 09:47:02 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 7E2A5A02 for ; Thu, 3 Oct 2024 09:46:51 -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-365-ZXoUy-BBP2qGc1GLbKQ7wg-1; Thu, 03 Oct 2024 09:46:49 -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 AAD0B19560A6; Thu, 3 Oct 2024 13:46:48 +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 69D2019560A3; Thu, 3 Oct 2024 13:46:47 +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=1727963211; 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=0JVME2fccZR+o00EgWZeQJAyOy3cQU+TbbIu1L/GP6k=; b=T+voxfm1FXcJ+lRrFjKiM7qZiMKRC+VFsHHLUuh2E7vy1IbDaiWExZYD8/ip8tnvk5h8Ty lalg/OZE5Rgg3CS6ySWR6I4JPxouCXT1cMGKgmsvo9KVtTb+GwK3C6Ne+rSFsari4BOydk DXYpLz6df+JwHW3f9jHQduuinLavpME= X-MC-Unique: ZXoUy-BBP2qGc1GLbKQ7wg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 05/10] qemu: monitor: Store internal snapshot names from 'query-named-block-nodes' Date: Thu, 3 Oct 2024 15:46:31 +0200 Message-ID: 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: HA2GFBP3SHMAFWQOQM4HLAWVNYSHBY7Z X-Message-ID-Hash: HA2GFBP3SHMAFWQOQM4HLAWVNYSHBY7Z 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: 1727963394049116600 Content-Type: text/plain; charset="utf-8" Store the names of internal snapshots present in supported images in the data we dump from 'query-named-block-nodes' so that the upcoming changes to the internal snapshot code can access it. To test this we use the bitmap detection test cases which can be easily extended to dump this data. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_monitor.h | 3 + src/qemu/qemu_monitor_json.c | 19 ++ tests/qemublocktest.c | 11 + .../bitmap/snapshots-internal.json | 298 ++++++++++++++++++ .../bitmap/snapshots-internal.out | 2 + 5 files changed, 333 insertions(+) create mode 100644 tests/qemublocktestdata/bitmap/snapshots-internal.json create mode 100644 tests/qemublocktestdata/bitmap/snapshots-internal.out diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6251f48d28..4341519cfe 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -709,6 +709,9 @@ struct _qemuBlockNamedNodeData { qemuBlockNamedNodeDataBitmap **bitmaps; size_t nbitmaps; + /* NULL terminated string list of internal snapshot names */ + char **snapshots; + /* the cluster size of the image is valid only when > 0 */ unsigned long long clusterSize; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 27f74181f6..2c3fce9002 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2631,6 +2631,7 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos= G_GNUC_UNUSED, GHashTable *nodes =3D opaque; virJSONValue *img; virJSONValue *bitmaps; + virJSONValue *snapshots; virJSONValue *format_specific; const char *nodename; g_autoptr(qemuBlockNamedNodeData) ent =3D NULL; @@ -2654,6 +2655,24 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t po= s G_GNUC_UNUSED, if ((bitmaps =3D virJSONValueObjectGetArray(val, "dirty-bitmaps"))) qemuMonitorJSONBlockGetNamedNodeDataBitmaps(bitmaps, ent); + if ((snapshots =3D virJSONValueObjectGetArray(img, "snapshots"))) { + size_t nsnapshots =3D virJSONValueArraySize(snapshots); + size_t nsnapnames =3D 0; + size_t i; + + ent->snapshots =3D g_new0(char *, nsnapshots + 1); + + for (i =3D 0; i < nsnapshots; i++) { + virJSONValue *snapshot =3D virJSONValueArrayGet(snapshots, i); + const char *name =3D virJSONValueObjectGetString(snapshot, "na= me"); + + if (!name) + continue; + + ent->snapshots[nsnapnames++] =3D g_strdup(name); + } + } + /* query qcow2 format specific props */ if ((format_specific =3D virJSONValueObjectGetObject(img, "format-spec= ific")) && STREQ_NULLABLE(virJSONValueObjectGetString(format_specific, "type"= ), "qcow2")) { diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 6c4e735466..60ac929e68 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -594,6 +594,15 @@ testQemuDetectBitmapsWorker(GHashTable *nodedata, bitmap->granularity, bitmap->dirtybytes); } + if (data->snapshots) { + char **sn; + + virBufferAddLit(buf, "internal snapshots:"); + + for (sn =3D data->snapshots; *sn; sn++) + virBufferAsprintf(buf, " '%s'", *sn); + } + virBufferAdjustIndent(buf, -1); } @@ -1201,6 +1210,7 @@ mymain(void) TEST_IMAGE_CREATE("network-rbd-qcow2", NULL); TEST_IMAGE_CREATE("network-ssh-qcow2", NULL); + /* The following group also tests internal snapshot detection */ #define TEST_BITMAP_DETECT(testname) \ do { \ if (virTestRun("bitmap detect " testname, \ @@ -1213,6 +1223,7 @@ mymain(void) TEST_BITMAP_DETECT("basic"); TEST_BITMAP_DETECT("snapshots"); TEST_BITMAP_DETECT("synthetic"); + TEST_BITMAP_DETECT("snapshots-internal"); #define TEST_BACKUP_BITMAP_CALCULATE(testname, source, incrbackup, named) \ do { \ diff --git a/tests/qemublocktestdata/bitmap/snapshots-internal.json b/tests= /qemublocktestdata/bitmap/snapshots-internal.json new file mode 100644 index 0000000000..2198f8f364 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/snapshots-internal.json @@ -0,0 +1,298 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "snapshots": [ + { + "vm-clock-nsec": 992826708, + "name": "1727868651", + "date-sec": 1727868651, + "date-nsec": 317899000, + "vm-clock-sec": 466, + "id": "1", + "vm-state-size": 57440493 + }, + { + "vm-clock-nsec": 159450672, + "name": "1727872064", + "date-sec": 1727872064, + "date-nsec": 991275000, + "vm-clock-sec": 2431, + "id": "2", + "vm-state-size": 57342213 + } + ], + "virtual-size": 104857600, + "filename": "/tmp/internal-snaps.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 115228672, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "compression-type": "zlib", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false, + "extended-l2": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-format", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/internal-snaps.qcow2" + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 115409408, + "filename": "/tmp/internal-snaps.qcow2", + "format": "file", + "actual-size": 115228672, + "format-specific": { + "type": "file", + "data": { + + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/internal-snaps.qcow2" + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 708837376, + "filename": "/var/lib/libvirt/images/systemrescuecd-amd64-6.1.2.is= o", + "format": "file", + "actual-size": 708841472, + "format-specific": { + "type": "file", + "data": { + + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-2-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/systemrescuecd-amd64-6.1.2.iso" + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "snapshots": [ + { + "vm-clock-nsec": 992826708, + "name": "1727868651", + "date-sec": 1727868651, + "date-nsec": 317899000, + "vm-clock-sec": 466, + "id": "1", + "vm-state-size": 0 + }, + { + "vm-clock-nsec": 159450672, + "name": "1727872064", + "date-sec": 1727872064, + "date-nsec": 991275000, + "vm-clock-sec": 2431, + "id": "2", + "vm-state-size": 0 + } + ], + "virtual-size": 540672, + "filename": "/var/lib/libvirt/qemu/nvram/int-q35_VARS.qcow2", + "cluster-size": 4096, + "format": "qcow2", + "actual-size": 602112, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "compression-type": "zlib", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false, + "extended-l2": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-pflash1-format", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/qemu/nvram/int-q35_VARS.qcow2" + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 598528, + "filename": "/var/lib/libvirt/qemu/nvram/int-q35_VARS.qcow2", + "format": "file", + "actual-size": 602112, + "format-specific": { + "type": "file", + "data": { + + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-pflash1-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/qemu/nvram/int-q35_VARS.qcow2" + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 3653632, + "filename": "/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2", + "cluster-size": 4096, + "format": "qcow2", + "actual-size": 3678208, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "compression-type": "zlib", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false, + "extended-l2": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-pflash0-format", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2" + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 3678208, + "filename": "/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2", + "format": "file", + "actual-size": 3678208, + "format-specific": { + "type": "file", + "data": { + + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-pflash0-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2" + } +] diff --git a/tests/qemublocktestdata/bitmap/snapshots-internal.out b/tests/= qemublocktestdata/bitmap/snapshots-internal.out new file mode 100644 index 0000000000..f2fb0a1dcc --- /dev/null +++ b/tests/qemublocktestdata/bitmap/snapshots-internal.out @@ -0,0 +1,2 @@ +libvirt-1-format: + internal snapshots: '1727868651' '1727872064' --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 1727963371218462.3845911392863; Thu, 3 Oct 2024 06:49:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2809F15F9; Thu, 3 Oct 2024 09:49:30 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EB1D414F3; Thu, 3 Oct 2024 09:47:11 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4B0EB14CA; Thu, 3 Oct 2024 09:47:06 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 1916EA2C for ; Thu, 3 Oct 2024 09:46:53 -0400 (EDT) Received: from mx-prod-mc-02.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-681-0gSA_W9pPiK3DcnMFVuxsw-1; Thu, 03 Oct 2024 09:46:51 -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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 95C601955D92; Thu, 3 Oct 2024 13:46:50 +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 273FB19560A2; Thu, 3 Oct 2024 13:46:48 +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=1727963212; 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=j/PC49cASH5oVwAAt0iSc7K12jZ/HlffDzGJ596cTqU=; b=fobPUXhgTWEPBjGJvfrlWPJJLgLg/tMADF7ptk1Bvg/xAQC6XhGBsR0EE8HnlwdhkwyVYK y39jbjsNj22yvdw4adia5GoqtzYAp2BK3jE+YpBK0QTd4mC0hlWkMEzfKGkBuiQJv9BX4H i7bxzLrf5X+zbDKpqDww+Jipi4s8eLU= X-MC-Unique: 0gSA_W9pPiK3DcnMFVuxsw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 06/10] qemu snapshot: use QMP snapshot-save for internal snapshots creation Date: Thu, 3 Oct 2024 15:46:32 +0200 Message-ID: <3b844b91b9ad862021f94629f1f462e4ef9ae6c6.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: PKOLAVIDHGWRIIN6XC23SDHX2DDYNITU X-Message-ID-Hash: PKOLAVIDHGWRIIN6XC23SDHX2DDYNITU 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: 1727963371825116600 Content-Type: text/plain; charset="utf-8" From: Nikolai Barybin via Devel The usage of HMP commands are highly discouraged by qemu. Moreover, current snapshot creation routine does not provide flexibility in choosing target device for VM state snapshot. This patch makes use of QMP commands snapshot-save and by default chooses first writable non-shared qcow2 disk (if present) as target for VM state. Signed-off-by: Nikolai Barybin Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 124 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 116 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index f5260c4a22..d4602d386f 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -309,6 +309,99 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriver *driv= er, } +static char ** +qemuSnapshotActiveInternalCreateGetDevices(virDomainObj *vm, + virDomainSnapshotDef *snapdef) +{ + g_auto(GStrv) devices =3D g_new0(char *, vm->def->ndisks + 2); + size_t ndevs =3D 0; + size_t i =3D 0; + + /* This relies on @snapdef being aligned and validated via + * virDomainSnapshotAlignDisks() and qemuSnapshotPrepare(), which also + * ensures that all disks are backed by qcow2. */ + for (i =3D 0; i < snapdef->ndisks; i++) { + virDomainSnapshotDiskDef *snapdisk =3D snapdef->disks + i; + virDomainDiskDef *domdisk =3D vm->def->disks[i]; + + switch (snapdisk->snapshot) { + case VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL: + devices[ndevs++] =3D g_strdup(qemuBlockStorageSourceGetFormatN= odename(domdisk->src)); + break; + + case VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL: + case VIR_DOMAIN_SNAPSHOT_LOCATION_MANUAL: + case VIR_DOMAIN_SNAPSHOT_LOCATION_NO: + case VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT: + case VIR_DOMAIN_SNAPSHOT_LOCATION_LAST: + continue; + } + } + + if (vm->def->os.loader && + vm->def->os.loader->nvram && + vm->def->os.loader->nvram->format =3D=3D VIR_STORAGE_FILE_QCOW2) { + devices[ndevs++] =3D g_strdup(qemuBlockStorageSourceGetFormatNoden= ame(vm->def->os.loader->nvram)); + } + + return g_steal_pointer(&devices); +} + + +static int +qemuSnapshotCreateActiveInternalDone(virDomainObj *vm, + qemuBlockJobData *job) +{ + qemuBlockJobUpdate(vm, job, VIR_ASYNC_JOB_SNAPSHOT); + + if (job->state =3D=3D VIR_DOMAIN_BLOCK_JOB_FAILED) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("snapshot-save job failed: %1$s"), NULLSTR(job->e= rrmsg)); + return -1; + } + + return job->state =3D=3D VIR_DOMAIN_BLOCK_JOB_COMPLETED ? 1 : 0; +} + + +static qemuBlockJobData * +qemuSnapshotCreateActiveInternalStart(virDomainObj *vm, + virDomainSnapshotDef *snapdef) +{ + g_autofree char *jobname =3D g_strdup_printf("internal-snapshot-save-%= s", snapdef->parent.name); + qemuBlockJobData *job =3D NULL; + g_auto(GStrv) devices =3D NULL; + int rc =3D 0; + + if (!(devices =3D qemuSnapshotActiveInternalCreateGetDevices(vm, snapd= ef))) + return NULL; + + if (!(job =3D qemuBlockJobDiskNew(vm, NULL, QEMU_BLOCKJOB_TYPE_SNAPSHO= T_SAVE, + jobname))) + return NULL; + + qemuBlockJobSyncBegin(job); + + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0) + goto error; + + rc =3D qemuMonitorSnapshotSave(qemuDomainGetMonitor(vm), jobname, snap= def->parent.name, + devices[0], (const char **) devices); + qemuDomainObjExitMonitor(vm); + + if (rc < 0) + goto error; + + qemuBlockJobStarted(job, vm); + + return job; + + error: + qemuBlockJobStartupFinalize(vm, job); + return NULL; +} + + /* The domain is expected to be locked and active. */ static int qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, @@ -321,6 +414,7 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, bool resume =3D false; virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); int ret =3D -1; + int rv =3D 0; if (!qemuMigrationSrcIsAllowed(vm, false, VIR_ASYNC_JOB_SNAPSHOT, 0)) goto cleanup; @@ -342,15 +436,29 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *drive= r, } } - if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0) { - resume =3D false; - goto cleanup; - } + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SNAPSHOT_INTERNAL_QMP)) { + g_autoptr(qemuBlockJobData) job =3D NULL; - ret =3D qemuMonitorCreateSnapshot(priv->mon, snap->def->name); - qemuDomainObjExitMonitor(vm); - if (ret < 0) - goto cleanup; + if (!(job =3D qemuSnapshotCreateActiveInternalStart(vm, snapdef))) + goto cleanup; + + while ((rv =3D qemuSnapshotCreateActiveInternalDone(vm, job)) !=3D= 1) { + if (rv < 0 || qemuDomainObjWait(vm) < 0) + goto cleanup; + } + + ret =3D 0; + } else { + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0= ) { + resume =3D false; + goto cleanup; + } + + ret =3D qemuMonitorCreateSnapshot(priv->mon, snap->def->name); + qemuDomainObjExitMonitor(vm); + if (ret < 0) + goto cleanup; + } if (!(snapdef->cookie =3D (virObject *) qemuDomainSaveCookieNew(vm))) goto cleanup; --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 1727963483732562.2572670389958; Thu, 3 Oct 2024 06:51:23 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 96FF51546; Thu, 3 Oct 2024 09:51:22 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 02E8F154A; Thu, 3 Oct 2024 09:47:19 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0508FA64; Thu, 3 Oct 2024 09:47:12 -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 C754611C2 for ; Thu, 3 Oct 2024 09:46:56 -0400 (EDT) Received: from mx-prod-mc-03.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-348-vp7fS2JrOLqqhXVBtgGofQ-1; Thu, 03 Oct 2024 09:46:53 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 716011955E84; Thu, 3 Oct 2024 13:46:52 +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 1A3D619560A3; Thu, 3 Oct 2024 13:46:50 +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=1727963216; 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=7DLDAjZSxRJiwoNUz9Rlu171S1I7mzyF/cb8htY1nu4=; b=dFruAhh1NcGTCGAcb5Kb2VSxnb33Tp88kpLiRt11VdN5B9KhVnbKNFPOtPcbMDmzDnl7Sp Dbg6z2SyPmgwWW9iGxygEFJQY/UUny2O5PkSxR/h78M89wHZWegoimwDl/ORuo82hgwcTs HCvaI0ItMiEz8Bi12sEQ/RkF+z4Um4k= X-MC-Unique: vp7fS2JrOLqqhXVBtgGofQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 07/10] qemu snapshot: use QMP snapshot-delete for internal snapshots deletion Date: Thu, 3 Oct 2024 15:46:33 +0200 Message-ID: <0763f538eb89aa7c54d1fae8745b845ba0b96a13.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: YGOWCCEZJQ7VC3XQGYIK5Z5OCVKRZEBH X-Message-ID-Hash: YGOWCCEZJQ7VC3XQGYIK5Z5OCVKRZEBH 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: 1727963484408116600 Content-Type: text/plain; charset="utf-8" Switch to using the modern QMP command. As the user visible logic when deleting internal snapshots using the old 'delvm' command was very lax in terms of catching inconsistencies between the snapshot metadata and on-disk state we re-implement this behaviour even using the new command. We could improve the validation but that'd go at the cost of possible failures which users might not expect. As 'delvm' was simply ignoring any kind of failure the selection of devices to delete the snapshot from is based on querying qemu first which top level images do have the internal snapshot and then continuing only on those. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 148 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 143 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index d4602d386f..4927ca0bfc 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3711,6 +3711,134 @@ qemuSnapshotDiscardMetadata(virDomainObj *vm, } +static char ** +qemuSnapshotActiveInternalDeleteGetDevices(virDomainObj *vm, + virDomainSnapshotDef *snapdef) +{ + /* In contrast to internal snapshot *creation* we can't always rely on= the + * metadata to give us the full status of the disk images we'd need to + * delete the snapshot from, as users might have edited the VM XML, + * unplugged or plugged in disks and/or did many other kinds of modifi= cation. + * + * In order for this code to behave the same as it did with the 'delvm= ' HMP + * command, which simply deleted the snapshot where it found them and + * ignored any failures we'll detect the images in qemu first and use + * that information as source of truth for now instead of introducing + * other failure scenarios. + */ + g_autoptr(GHashTable) blockNamedNodeData =3D NULL; + const char *snapname =3D snapdef->parent.name; + g_auto(GStrv) devices =3D g_new0(char *, vm->def->ndisks + 2); + size_t ndevs =3D 0; + size_t i =3D 0; + + if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, VIR_ASYNC_J= OB_SNAPSHOT))) + return NULL; + + for (i =3D 0; i < vm->def->ndisks; i++) { + virDomainDiskDef *domdisk =3D vm->def->disks[i]; + const char *format_nodename; + qemuBlockNamedNodeData *d; + + /* readonly disks will not have permissions to delete the snapshot= , and + * in fact should not have an internal snapshot */ + if (domdisk->src->readonly) + continue; + + /* This effectively filters out empty and 'raw' disks */ + if (!(format_nodename =3D qemuBlockStorageSourceGetFormatNodename(= domdisk->src))) + continue; + + /* the data should always be present */ + if (!(d =3D virHashLookup(blockNamedNodeData, format_nodename))) + continue; + + /* there might be no snapshot for given disk with given name */ + if (!d->snapshots || + !g_strv_contains((const char **) d->snapshots, snapname)) + continue; + + devices[ndevs++] =3D g_strdup(format_nodename); + } + + if (vm->def->os.loader && + vm->def->os.loader->nvram && + vm->def->os.loader->nvram->format =3D=3D VIR_STORAGE_FILE_QCOW2) { + const char *format_nodename; + qemuBlockNamedNodeData *d; + + if ((format_nodename =3D qemuBlockStorageSourceGetFormatNodename(v= m->def->os.loader->nvram)) && + (d =3D virHashLookup(blockNamedNodeData, format_nodename)) && + d->snapshots && + g_strv_contains((const char **) d->snapshots, snapname)) { + devices[ndevs++] =3D g_strdup(format_nodename); + } + } + + return g_steal_pointer(&devices); +} + + +static int +qemuSnapshotDiscardActiveInternal(virDomainObj *vm, + virDomainSnapshotDef *snapdef) +{ + g_autofree char *jobname =3D g_strdup_printf("internal-snapshot-delete= -%s", snapdef->parent.name); + qemuBlockJobData *job =3D NULL; + g_auto(GStrv) devices =3D NULL; + int ret =3D -1; + int rc =3D 0; + + if (!(devices =3D qemuSnapshotActiveInternalDeleteGetDevices(vm, snapd= ef))) + return -1; + + /* It's possible that no devices were selected */ + if (devices[0] =3D=3D NULL) + return 0; + + if (!(job =3D qemuBlockJobDiskNew(vm, NULL, QEMU_BLOCKJOB_TYPE_SNAPSHO= T_DELETE, + jobname))) + return -1; + + qemuBlockJobSyncBegin(job); + + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0) + goto cleanup; + + rc =3D qemuMonitorSnapshotDelete(qemuDomainGetMonitor(vm), job->name, + snapdef->parent.name, (const char **) d= evices); + qemuDomainObjExitMonitor(vm); + + if (rc < 0) + goto cleanup; + + qemuBlockJobStarted(job, vm); + + while (true) { + qemuBlockJobUpdate(vm, job, VIR_ASYNC_JOB_SNAPSHOT); + + if (job->state =3D=3D VIR_DOMAIN_BLOCK_JOB_FAILED) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("deletion of internal snapshot '%1$s' job fai= led: %2$s"), + snapdef->parent.name, NULLSTR(job->errmsg)); + goto cleanup; + } + + if (job->state =3D=3D VIR_DOMAIN_BLOCK_JOB_COMPLETED) + break; + + if (qemuDomainObjWait(vm) < 0) + goto cleanup; + } + + ret =3D 0; + + cleanup: + qemuBlockJobStartupFinalize(vm, job); + return ret; +} + + /* Discard one snapshot (or its metadata), without reparenting any childre= n. */ static int qemuSnapshotDiscardImpl(virQEMUDriver *driver, @@ -3750,14 +3878,24 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver, if (qemuSnapshotDiscardExternal(vm, snap, externalData) < = 0) return -1; } else { + virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetD= ef(snap); + qemuDomainObjPrivate *priv =3D vm->privateData; + /* Similarly as internal snapshot creation we would use a = regular job * here so set a mask to forbid any other job. */ qemuDomainObjSetAsyncJobMask(vm, VIR_JOB_NONE); - if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPS= HOT) < 0) - return -1; - /* we continue on even in the face of error */ - qemuMonitorDeleteSnapshot(qemuDomainGetMonitor(vm), snap->= def->name); - qemuDomainObjExitMonitor(vm); + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SNAPSHOT_INTE= RNAL_QMP)) { + if (qemuSnapshotDiscardActiveInternal(vm, snapdef) < 0) + return -1; + } else { + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_S= NAPSHOT) < 0) + return -1; + /* we continue on even in the face of error */ + qemuMonitorDeleteSnapshot(qemuDomainGetMonitor(vm), sn= ap->def->name); + qemuDomainObjExitMonitor(vm); + } + qemuDomainObjSetAsyncJobMask(vm, VIR_JOB_DEFAULT_MASK); } } --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 17279634552442.017392928170011; Thu, 3 Oct 2024 06:50:55 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2EF671521; Thu, 3 Oct 2024 09:50:54 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1EB991430; Thu, 3 Oct 2024 09:47:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DD0EE15BB; Thu, 3 Oct 2024 09:47:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 E965514CB for ; Thu, 3 Oct 2024 09:46:56 -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-177-ppeM5WH6O7alOJe7LxP0Xg-1; Thu, 03 Oct 2024 09:46:55 -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 681A51956077; Thu, 3 Oct 2024 13:46:54 +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 CA2DB19560A3; Thu, 3 Oct 2024 13:46:52 +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=1727963216; 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=cVG1tNpjpg3rIjGMkflSLRs/9+KHzZynCPDn4cPF0m0=; b=d7Uq57Vwmrhw7UZrNqp4go0GcbD01/+OUcseP3Wwx3zzZMYUZPbraF3qufowfCwQetgrwK XSsE5gUDJp6zBtux+cwusXPVD3S5aalK7EPqxMq3PYp+R6AF3mAwOysRspYp32FVknG8Ke ensQSlXLMp+cNkG1MBNgDAL8CLeFHyc= X-MC-Unique: ppeM5WH6O7alOJe7LxP0Xg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 08/10] qemuSnapshotActiveInternalDeleteGetDevices: Add warning when deleting inconsistent snapshot Date: Thu, 3 Oct 2024 15:46:34 +0200 Message-ID: <059b50e50eb462dd3f43e875013608bbf209e1c5.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: TWUCAAJF6RD36OC5KKCQCPV5N22WE234 X-Message-ID-Hash: TWUCAAJF6RD36OC5KKCQCPV5N22WE234 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: 1727963456048116600 Content-Type: text/plain; charset="utf-8" As explained in the commit which added the new internal snapshot deletion code we don't want to do any form of strict checking whether the libvirt metadata is consistent with the on-disk state as we didn't historically do that. In order to be able to spot the cases add a warning into the logs if such state is encountered. While warnings are easy to miss it's the only reasonable way to do that. Users will be encouraged to file an issue with the information, without requiring them to enable debug logs as the reproduction of that issue may include very old historical state. The checker is deliberately added separately so that it can be easily reverted once it's no longer needed. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 4927ca0bfc..02c876c881 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3731,6 +3731,14 @@ qemuSnapshotActiveInternalDeleteGetDevices(virDomain= Obj *vm, g_auto(GStrv) devices =3D g_new0(char *, vm->def->ndisks + 2); size_t ndevs =3D 0; size_t i =3D 0; + /* variables below are used for checking of corner cases */ + g_autoptr(GHashTable) foundDisks =3D virHashNew(NULL); + g_auto(virBuffer) errMissingSnap =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) errUnexpectedSnap =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) errExtraDisks =3D VIR_BUFFER_INITIALIZER; + GHashTableIter htitr; + void *key; + bool warn =3D false; if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, VIR_ASYNC_J= OB_SNAPSHOT))) return NULL; @@ -3759,6 +3767,7 @@ qemuSnapshotActiveInternalDeleteGetDevices(virDomainO= bj *vm, continue; devices[ndevs++] =3D g_strdup(format_nodename); + g_hash_table_insert(foundDisks, g_strdup(domdisk->dst), NULL); } if (vm->def->os.loader && @@ -3775,6 +3784,51 @@ qemuSnapshotActiveInternalDeleteGetDevices(virDomain= Obj *vm, } } + /* We currently don't want this code to become stricter than what 'del= vm' + * did thus we'll report if the on-disk state mismatches the snapshot + * definition only as a warning */ + for (i =3D 0; i < snapdef->ndisks; i++) { + virDomainSnapshotDiskDef *snapdisk =3D snapdef->disks + i; + + switch (snapdisk->snapshot) { + case VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL: + if (g_hash_table_contains(foundDisks, snapdisk->name)) { + g_hash_table_remove(foundDisks, snapdisk->name); + } else { + virBufferAsprintf(&errMissingSnap, "%s ", snapdisk->name); + warn =3D true; + } + break; + + case VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL: + case VIR_DOMAIN_SNAPSHOT_LOCATION_MANUAL: + case VIR_DOMAIN_SNAPSHOT_LOCATION_NO: + case VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT: + case VIR_DOMAIN_SNAPSHOT_LOCATION_LAST: + if (g_hash_table_contains(foundDisks, snapdisk->name)) { + virBufferAsprintf(&errUnexpectedSnap, "%s ", snapdisk->nam= e); + warn =3D true; + } else { + g_hash_table_remove(foundDisks, snapdisk->name); + } + } + } + + g_hash_table_iter_init(&htitr, foundDisks); + + while (g_hash_table_iter_next(&htitr, &key, NULL)) { + warn =3D true; + virBufferAsprintf(&errExtraDisks, "%s ", (const char *) key); + } + + if (warn) { + VIR_WARN("inconsistent internal snapshot state (deletion): VM=3D'%= s' snapshot=3D'%s' missing=3D'%s' unexpected=3D'%s' extra=3D'%s", + vm->def->name, snapname, + virBufferCurrentContent(&errMissingSnap), + virBufferCurrentContent(&errUnexpectedSnap), + virBufferCurrentContent(&errExtraDisks)); + } + return g_steal_pointer(&devices); } --=20 2.46.0 From nobody Sat Feb 7 22:11:43 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 Reviewed-by: Pavel Hrdina --- 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 From nobody Sat Feb 7 22:11:43 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 1727963501223713.0496562975752; Thu, 3 Oct 2024 06:51:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3224B1174; Thu, 3 Oct 2024 09:51:40 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9813215D7; Thu, 3 Oct 2024 09:47:20 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9651C9E6; Thu, 3 Oct 2024 09:47:14 -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 302F1B92 for ; Thu, 3 Oct 2024 09:47:00 -0400 (EDT) Received: from mx-prod-mc-03.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-478-RbfFSaT2O5uiMUoEwDCpVw-1; Thu, 03 Oct 2024 09:46:58 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A435419560B1; Thu, 3 Oct 2024 13:46:57 +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 5C59E19560A2; Thu, 3 Oct 2024 13:46:56 +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=1727963219; 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=GGYtzRXP92XyqB+kH8yQuI7V4darYAMgrHSyoOxA+yw=; b=Ix4j95sDKSt7qK0Te2TMgViVbaRjulVza3KIssp+/M37mCaYmWL44A36uvzC4+LBu4MqqB DhPSGBipHP/ZoEYX0ctbDYD8cye/+RIHtAjfZdstdlhKTX5ApA5Y9/443U5InCf5FWkrJS otsCCK4mpeLe4KLwNPkcTeqC23zKSFI= X-MC-Unique: RbfFSaT2O5uiMUoEwDCpVw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v3 10/10] news: mention internal snapshot changes Date: Thu, 3 Oct 2024 15:46:36 +0200 Message-ID: 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: GDE4H6V4C43JUICZFDVIBLWLCOGOHBIB X-Message-ID-Hash: GDE4H6V4C43JUICZFDVIBLWLCOGOHBIB 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: 1727963502335116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- NEWS.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 437e032b90..7efc440202 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -19,6 +19,22 @@ v10.9.0 (unreleased) * **Improvements** + * qemu: internal snapshot improvements + + The qemu internal snapshot handling code was updated to use modern com= mands + which avoid the problems the old ones had, preventing use of internal + snapshots on VMs with UEFI NVRAM. Internal snapshots of VMs using UEFI= are + now possible provided that the NVRAM is in ``qcow2`` format. + + The new code also allows better control when deleting snapshots. To pr= event + possible regressions no strict checking is done, but in case a inconsi= stent + state is encountered a log message is added:: + + warning : qemuSnapshotActiveInternalDeleteGetDevices:3841 : inconsis= tent internal snapshot state (deletion): VM=3D'snap' snapshot=3D'1727959843= ' missing=3D'vda ' unexpected=3D'' extra=3D'' + + Users are encouraged to report any occurence of the above message along + with steps they took to the upstream tracker. + * **Bug fixes** --=20 2.46.0