From nobody Tue May 14 05:25:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1645000718671207.15607986407315; Wed, 16 Feb 2022 00:38:38 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-208-8J1GBa2UPziDJfsRESHahQ-1; Wed, 16 Feb 2022 03:38:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33762189DF43; Wed, 16 Feb 2022 08:38:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D9E64F862; Wed, 16 Feb 2022 08:38:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0FD3D1809CB9; Wed, 16 Feb 2022 08:38:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21G8cOt7030411 for ; Wed, 16 Feb 2022 03:38:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7C411492D4C; Wed, 16 Feb 2022 08:38:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78173492D4A for ; Wed, 16 Feb 2022 08:38:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5DA30802A6A for ; Wed, 16 Feb 2022 08:38:24 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-355-JO3TviO7Ms6nDQxaDwmq9Q-1; Wed, 16 Feb 2022 03:38:21 -0500 Received: from [10.94.5.164] (helo=vzdev-s01.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1nKFpL-009R4x-9N for libvir-list@redhat.com; Wed, 16 Feb 2022 11:38:19 +0300 X-MC-Unique: 8J1GBa2UPziDJfsRESHahQ-1 X-MC-Unique: JO3TviO7Ms6nDQxaDwmq9Q-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH] qemu: fix excluding disk from internal inactive snapshot Date: Wed, 16 Feb 2022 11:38:01 +0300 Message-Id: <20220216083801.983062-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1645000720769100001 Content-Type: text/plain; charset="utf-8" Currently taking an internal inactive snapshot with a disk excluded from snapshot using snapshot=3D"no" will fail with error "Disk device '%s' does not support snapshotting". Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 469942d201..6a70b72760 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6860,11 +6860,12 @@ qemuDomainSnapshotWriteMetadata(virDomainObj *vm, static int qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver, virDomainDef *def, - const char *name, + virDomainMomentObj *snap, const char *op, bool try_all, int ndisks) { + virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); const char *qemuimgbin; size_t i; bool skipped =3D false; @@ -6877,11 +6878,12 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *dr= iver, =20 for (i =3D 0; i < ndisks; i++) { g_autoptr(virCommand) cmd =3D virCommandNewArgList(qemuimgbin, "sn= apshot", - op, name, NULL); + op, snap->def->na= me, NULL); int format =3D virDomainDiskGetFormat(def->disks[i]); =20 /* FIXME: we also need to handle LVM here */ - if (def->disks[i]->device !=3D VIR_DOMAIN_DISK_DEVICE_DISK) + if (def->disks[i]->device !=3D VIR_DOMAIN_DISK_DEVICE_DISK || + snapdef->disks[i].snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION= _NONE) continue; =20 if (!virStorageSourceIsLocalStorage(def->disks[i]->src)) { @@ -6903,7 +6905,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driv= er, } else if (STREQ(op, "-c") && i) { /* We must roll back partial creation by deleting * all earlier snapshots. */ - qemuDomainSnapshotForEachQcow2Raw(driver, def, name, + qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, "-d", false, i); } virReportError(VIR_ERR_OPERATION_INVALID, @@ -6923,7 +6925,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driv= er, } else if (STREQ(op, "-c") && i) { /* We must roll back partial creation by deleting * all earlier snapshots. */ - qemuDomainSnapshotForEachQcow2Raw(driver, def, name, + qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, "-d", false, i); } return -1; @@ -6942,7 +6944,7 @@ qemuDomainSnapshotForEachQcow2(virQEMUDriver *driver, const char *op, bool try_all) { - return qemuDomainSnapshotForEachQcow2Raw(driver, def, snap->def->name, + return qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, op, try_all, def->ndisks); } =20 --=20 2.31.1