From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387879; cv=none; d=zoho.com; s=zohoarc; b=L9J17kjNUtF/KozHoVLfJe8Gc5DMWmpgv5B3Ny2PtQMtq4k1g0xXlHLGIEOfrMhFs9WFYiZNQVioIa0mElmvWCeeIlyy4Owb/bscSv92o0i+QP95sqRlPb8ep/w+g/HiSPYUZ4byahqpY/8mBy+/xC2SXgHYVJkHrfF1Ol9gJ4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Spxnc8FIgNZTWWiH0j508yJAzawN/P8w/lQLRbEaxpc=; b=MFN9k3zV0faqfO83wg1BufUeE9NG0f6XjkRN0+O0vIQf3IgRhyLxlxPvQ2lzWqAbpsG5YhSOnmuwhZB1rOPtmplHqybDobTbc90y1Ggp+IKrGd0drATIwTD2/qgDfjIEyq55WvBgENRhj/+vp07gpP20O5Av7LF7mn/VRWU8z9I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562387879607952.7620638958808; Fri, 5 Jul 2019 21:37:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 823163083363; Sat, 6 Jul 2019 04:37:56 +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 2ED5D51409; Sat, 6 Jul 2019 04:37:55 +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 3213918089C8; Sat, 6 Jul 2019 04:37:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664bj3O006727 for ; Sat, 6 Jul 2019 00:37:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 934401001947; Sat, 6 Jul 2019 04:37:45 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32E0D1001B2E; Sat, 6 Jul 2019 04:37:44 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:28 -0500 Message-Id: <20190706043735.26284-2-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/8] snapshot: Rename qemu domain snapshot test files 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 06 Jul 2019 04:37:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Make it obvious that the domainsnapshotxml2xml test is only run when compiling in support for qemu. Suggested-by: Peter Krempa Signed-off-by: Eric Blake --- tests/Makefile.am | 14 +++++++------- .../description_only.xml | 0 .../disk-invalid.xml | 0 .../disk-network-seclabel-invalid.xml | 0 .../disk-seclabel.xml | 0 .../disk_driver_name_null.xml | 0 .../disk_snapshot.xml | 0 .../empty.xml | 0 .../external_vm.xml | 0 .../name_and_description.xml | 0 .../name_only.xml | 0 .../noparent.xml | 0 .../all_parameters.xml | 0 .../disk-seclabel.xml | 0 .../disk_driver_name_null.xml | 0 .../disk_snapshot.xml | 0 .../disk_snapshot_redefine.xml | 0 .../empty.xml | 0 .../external_vm.xml | 0 .../external_vm_redefine.xml | 0 .../full_domain.xml | 0 .../metadata.xml | 0 .../name_and_description.xml | 0 .../noparent.xml | 0 .../noparent_nodescription.xml | 0 .../noparent_nodescription_noactive.xml | 0 ...l2xmltest.c =3D> qemudomainsnapshotxml2xmltest.c} | 12 ++++++------ tests/virschematest.c | 4 ++-- 28 files changed, 15 insertions(+), 15 deletions(-) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/de= scription_only.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/di= sk-invalid.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/di= sk-network-seclabel-invalid.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/di= sk-seclabel.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/di= sk_driver_name_null.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/di= sk_snapshot.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/em= pty.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/ex= ternal_vm.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/na= me_and_description.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/na= me_only.xml (100%) rename tests/{domainsnapshotxml2xmlin =3D> qemudomainsnapshotxml2xmlin}/no= parent.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= all_parameters.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= disk-seclabel.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= disk_driver_name_null.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= disk_snapshot.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= disk_snapshot_redefine.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= empty.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= external_vm.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= external_vm_redefine.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= full_domain.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= metadata.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= name_and_description.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= noparent.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= noparent_nodescription.xml (100%) rename tests/{domainsnapshotxml2xmlout =3D> qemudomainsnapshotxml2xmlout}/= noparent_nodescription_noactive.xml (100%) rename tests/{domainsnapshotxml2xmltest.c =3D> qemudomainsnapshotxml2xmlte= st.c} (93%) diff --git a/tests/Makefile.am b/tests/Makefile.am index 115afa1c1a..e57d0da58a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -85,8 +85,6 @@ EXTRA_DIST =3D \ domaincapsschemadata \ domainconfdata \ domainschemadata \ - domainsnapshotxml2xmlin \ - domainsnapshotxml2xmlout \ fchostdata \ genericxml2xmlindata \ genericxml2xmloutdata \ @@ -112,6 +110,8 @@ EXTRA_DIST =3D \ qemublocktestdata \ qemucapabilitiesdata \ qemucaps2xmloutdata \ + qemudomainsnapshotxml2xmlin \ + qemudomainsnapshotxml2xmlout \ qemuhotplugtestcpus \ qemuhotplugtestdevices \ qemuhotplugtestdomains \ @@ -275,7 +275,7 @@ endif WITH_LIBXL if WITH_QEMU test_programs +=3D qemuxml2argvtest qemuxml2xmltest \ - domainsnapshotxml2xmltest \ + qemudomainsnapshotxml2xmltest \ qemumonitorjsontest qemuhotplugtest \ qemuagenttest qemucapabilitiestest qemucaps2xmltest \ qemumemlocktest \ @@ -656,10 +656,10 @@ qemublocktest_LDADD =3D \ $(qemu_LDADDS) \ $(NULL) -domainsnapshotxml2xmltest_SOURCES =3D \ - domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \ +qemudomainsnapshotxml2xmltest_SOURCES =3D \ + qemudomainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \ testutils.c testutils.h -domainsnapshotxml2xmltest_LDADD =3D $(qemu_LDADDS) +qemudomainsnapshotxml2xmltest_LDADD =3D $(qemu_LDADDS) qemumemlocktest_SOURCES =3D \ qemumemlocktest.c \ @@ -691,7 +691,7 @@ qemufirmwaretest_LDADD =3D $(qemu_LDADDS) else ! WITH_QEMU EXTRA_DIST +=3D qemuxml2argvtest.c qemuxml2xmltest.c \ - domainsnapshotxml2xmltest.c \ + qemudomainsnapshotxml2xmltest.c \ testutilsqemu.c testutilsqemu.h \ testutilsqemuschema.c testutilsqemuschema.h \ qemumonitorjsontest.c qemuhotplugtest.c \ diff --git a/tests/domainsnapshotxml2xmlin/description_only.xml b/tests/qem= udomainsnapshotxml2xmlin/description_only.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/description_only.xml rename to tests/qemudomainsnapshotxml2xmlin/description_only.xml diff --git a/tests/domainsnapshotxml2xmlin/disk-invalid.xml b/tests/qemudom= ainsnapshotxml2xmlin/disk-invalid.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/disk-invalid.xml rename to tests/qemudomainsnapshotxml2xmlin/disk-invalid.xml diff --git a/tests/domainsnapshotxml2xmlin/disk-network-seclabel-invalid.xm= l b/tests/qemudomainsnapshotxml2xmlin/disk-network-seclabel-invalid.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/disk-network-seclabel-invalid.xml rename to tests/qemudomainsnapshotxml2xmlin/disk-network-seclabel-invalid.x= ml diff --git a/tests/domainsnapshotxml2xmlin/disk-seclabel.xml b/tests/qemudo= mainsnapshotxml2xmlin/disk-seclabel.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/disk-seclabel.xml rename to tests/qemudomainsnapshotxml2xmlin/disk-seclabel.xml diff --git a/tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml b/test= s/qemudomainsnapshotxml2xmlin/disk_driver_name_null.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml rename to tests/qemudomainsnapshotxml2xmlin/disk_driver_name_null.xml diff --git a/tests/domainsnapshotxml2xmlin/disk_snapshot.xml b/tests/qemudo= mainsnapshotxml2xmlin/disk_snapshot.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/disk_snapshot.xml rename to tests/qemudomainsnapshotxml2xmlin/disk_snapshot.xml diff --git a/tests/domainsnapshotxml2xmlin/empty.xml b/tests/qemudomainsnap= shotxml2xmlin/empty.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/empty.xml rename to tests/qemudomainsnapshotxml2xmlin/empty.xml diff --git a/tests/domainsnapshotxml2xmlin/external_vm.xml b/tests/qemudoma= insnapshotxml2xmlin/external_vm.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/external_vm.xml rename to tests/qemudomainsnapshotxml2xmlin/external_vm.xml diff --git a/tests/domainsnapshotxml2xmlin/name_and_description.xml b/tests= /qemudomainsnapshotxml2xmlin/name_and_description.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/name_and_description.xml rename to tests/qemudomainsnapshotxml2xmlin/name_and_description.xml diff --git a/tests/domainsnapshotxml2xmlin/name_only.xml b/tests/qemudomain= snapshotxml2xmlin/name_only.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/name_only.xml rename to tests/qemudomainsnapshotxml2xmlin/name_only.xml diff --git a/tests/domainsnapshotxml2xmlin/noparent.xml b/tests/qemudomains= napshotxml2xmlin/noparent.xml similarity index 100% rename from tests/domainsnapshotxml2xmlin/noparent.xml rename to tests/qemudomainsnapshotxml2xmlin/noparent.xml diff --git a/tests/domainsnapshotxml2xmlout/all_parameters.xml b/tests/qemu= domainsnapshotxml2xmlout/all_parameters.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/all_parameters.xml rename to tests/qemudomainsnapshotxml2xmlout/all_parameters.xml diff --git a/tests/domainsnapshotxml2xmlout/disk-seclabel.xml b/tests/qemud= omainsnapshotxml2xmlout/disk-seclabel.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/disk-seclabel.xml rename to tests/qemudomainsnapshotxml2xmlout/disk-seclabel.xml diff --git a/tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml b/tes= ts/qemudomainsnapshotxml2xmlout/disk_driver_name_null.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml rename to tests/qemudomainsnapshotxml2xmlout/disk_driver_name_null.xml diff --git a/tests/domainsnapshotxml2xmlout/disk_snapshot.xml b/tests/qemud= omainsnapshotxml2xmlout/disk_snapshot.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/disk_snapshot.xml rename to tests/qemudomainsnapshotxml2xmlout/disk_snapshot.xml diff --git a/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml b/te= sts/qemudomainsnapshotxml2xmlout/disk_snapshot_redefine.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml rename to tests/qemudomainsnapshotxml2xmlout/disk_snapshot_redefine.xml diff --git a/tests/domainsnapshotxml2xmlout/empty.xml b/tests/qemudomainsna= pshotxml2xmlout/empty.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/empty.xml rename to tests/qemudomainsnapshotxml2xmlout/empty.xml diff --git a/tests/domainsnapshotxml2xmlout/external_vm.xml b/tests/qemudom= ainsnapshotxml2xmlout/external_vm.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/external_vm.xml rename to tests/qemudomainsnapshotxml2xmlout/external_vm.xml diff --git a/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml b/test= s/qemudomainsnapshotxml2xmlout/external_vm_redefine.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/external_vm_redefine.xml rename to tests/qemudomainsnapshotxml2xmlout/external_vm_redefine.xml diff --git a/tests/domainsnapshotxml2xmlout/full_domain.xml b/tests/qemudom= ainsnapshotxml2xmlout/full_domain.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/full_domain.xml rename to tests/qemudomainsnapshotxml2xmlout/full_domain.xml diff --git a/tests/domainsnapshotxml2xmlout/metadata.xml b/tests/qemudomain= snapshotxml2xmlout/metadata.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/metadata.xml rename to tests/qemudomainsnapshotxml2xmlout/metadata.xml diff --git a/tests/domainsnapshotxml2xmlout/name_and_description.xml b/test= s/qemudomainsnapshotxml2xmlout/name_and_description.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/name_and_description.xml rename to tests/qemudomainsnapshotxml2xmlout/name_and_description.xml diff --git a/tests/domainsnapshotxml2xmlout/noparent.xml b/tests/qemudomain= snapshotxml2xmlout/noparent.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/noparent.xml rename to tests/qemudomainsnapshotxml2xmlout/noparent.xml diff --git a/tests/domainsnapshotxml2xmlout/noparent_nodescription.xml b/te= sts/qemudomainsnapshotxml2xmlout/noparent_nodescription.xml similarity index 100% rename from tests/domainsnapshotxml2xmlout/noparent_nodescription.xml rename to tests/qemudomainsnapshotxml2xmlout/noparent_nodescription.xml diff --git a/tests/domainsnapshotxml2xmlout/noparent_nodescription_noactive= .xml b/tests/qemudomainsnapshotxml2xmlout/noparent_nodescription_noactive.x= ml similarity index 100% rename from tests/domainsnapshotxml2xmlout/noparent_nodescription_noactive.= xml rename to tests/qemudomainsnapshotxml2xmlout/noparent_nodescription_noactiv= e.xml diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/qemudomainsnapshotxm= l2xmltest.c similarity index 93% rename from tests/domainsnapshotxml2xmltest.c rename to tests/qemudomainsnapshotxml2xmltest.c index c34ab0bc89..10ea9cf8d2 100644 --- a/tests/domainsnapshotxml2xmltest.c +++ b/tests/qemudomainsnapshotxml2xmltest.c @@ -144,18 +144,18 @@ mymain(void) } while (0) # define DO_TEST_IN(name, uuid) DO_TEST("in->in", name, \ - "domainsnapshotxml2xmlin", \ - "domainsnapshotxml2xmlin", \ + "qemudomainsnapshotxml2xmlin", \ + "qemudomainsnapshotxml2xmlin", \ uuid, 0, 0) # define DO_TEST_OUT(name, uuid, internal) \ - DO_TEST("out->out", name, "domainsnapshotxml2xmlout", \ - "domainsnapshotxml2xmlout", uuid, 0, internal | TEST_REDEFINE) + DO_TEST("out->out", name, "qemudomainsnapshotxml2xmlout", \ + "qemudomainsnapshotxml2xmlout", uuid, 0, internal | TEST_REDEF= INE) # define DO_TEST_INOUT(name, uuid, time, flags) \ DO_TEST("in->out", name, \ - "domainsnapshotxml2xmlin",\ - "domainsnapshotxml2xmlout",\ + "qemudomainsnapshotxml2xmlin",\ + "qemudomainsnapshotxml2xmlout",\ uuid, time, flags) /* Unset or set all envvars here that are copied in qemudBuildCommandL= ine diff --git a/tests/virschematest.c b/tests/virschematest.c index ff25f7781e..b7c2f7cfaa 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -222,8 +222,8 @@ mymain(void) "genericxml2xmloutdata", "xlconfigdata", "libxlxml2domconf= igdata", "qemuhotplugtestdomains"); DO_TEST_DIR("domaincaps.rng", "domaincapsschemadata"); - DO_TEST_DIR("domainsnapshot.rng", "domainsnapshotxml2xmlin", - "domainsnapshotxml2xmlout"); + DO_TEST_DIR("domainsnapshot.rng", "qemudomainsnapshotxml2xmlin", + "qemudomainsnapshotxml2xmlout"); DO_TEST_DIR("interface.rng", "interfaceschemadata"); DO_TEST_DIR("network.rng", "../src/network", "networkxml2xmlin", "networkxml2xmlout", "networkxml2confdata"); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387879; cv=none; d=zoho.com; s=zohoarc; b=ecwSHo/Hb/xHimZHCv5briXvE4gCFfPpYTmBu1DCj8c9shQFKGJwu8zjcqPf88Mlo/Io0VddmyygcF+8B9ftCbVzSQ6LLGP4Ij3/qAd7+YK1N376xUWNz2O1DMZfrn3Dkb6jufIcF8ikJlnaOo8EzAH/60btrmew/36/tPyFxfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+2XOhJn1SpmjAx89nE0D0p2HWOMmKCHWe7YbXRx04ak=; b=C0avUd1cL2wC5RbXB45h5dlviFWhhliC865Bp5vDxkzwT756Rml7yWJndA2kM9lWAzd9MEKLZT1muP8qsaKmAqC+bNTKZsK97Ei/xynp0PjmnVEb/gOPwmFjFVaTczYwEStxBtmvlIDEuuOvx70mSCysEkn5ojwp3RsAqyCgtv0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562387879690377.9556800019967; Fri, 5 Jul 2019 21:37:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22CA43083394; Sat, 6 Jul 2019 04:37:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D74C083EAE; Sat, 6 Jul 2019 04:37:56 +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 181A054D3C; Sat, 6 Jul 2019 04:37:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664bk6c006732 for ; Sat, 6 Jul 2019 00:37:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D13E1001B2C; Sat, 6 Jul 2019 04:37:46 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id B83431001B19; Sat, 6 Jul 2019 04:37:45 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:29 -0500 Message-Id: <20190706043735.26284-3-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/8] snapshot: Fix virDomainUndefineFlags docs regarding snapshots 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 06 Jul 2019 04:37:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The docs talked about an active snapshot when they meant an active domain; they also claimed the flag was a no-op for hypervisors with no snapshot metadata even though the flag is rejected as unrecognized for hypervisors with no snapshot support at all. Reported-by: Peter Krempa Signed-off-by: Eric Blake --- src/libvirt-domain.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index e2594a3392..3d12e7c125 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -6270,10 +6270,11 @@ virDomainUndefine(virDomainPtr domain) * virDomainSnapshotNum()), then including * VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA in @flags will also remove * that metadata. Omitting the flag will cause the undefine of an - * inactive domain to fail. Active snapshots will retain snapshot - * metadata until the (now-transient) domain halts, regardless of - * whether this flag is present. On hypervisors where snapshots do - * not use libvirt metadata, this flag has no effect. + * inactive domain with snapshots to fail. Active domains will retain + * snapshot metadata until the (now-transient) domain halts, + * regardless of whether this flag is present. On hypervisors that + * support snapshots, but where snapshots do not use libvirt metadata, + * this flag has no effect. * * If the domain has any nvram specified, the undefine process will fail * unless VIR_DOMAIN_UNDEFINE_KEEP_NVRAM is specified, or if --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387900; cv=none; d=zoho.com; s=zohoarc; b=FmoZoH3zWQSQZXUW3qkpJELL95AFPRq8Wcj5p97gWLaziMWQjGQyupeEfyI/cdYG9bNwHhsTOd/hECC1ZHUxjU0J0Y4wtbMOf8+CgI/QSzZO5LAzyV93sbfSFIwYqEZZrJRUZh4Mh5qWG7IqcWmIJFqh69NGJo0xYlhx4/gz75Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387900; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lCCIjBtoOrl/ORI8Pu3XtKuorAopsUH/CrC5w/u6co4=; b=A+D/j6bpv6u9dxKZk7mcDbJwVyFaRlU+jVIbI0sDdh8HZNTrYApmL4AalCvKg5a09JPm2WAIlRtYeymeOFdJ1n97HXMcO8ZP+xU0+1MS2n6E9AZdY6wTzd/ydrY8EnYnMjusG3Lp5CPLEX9BeheOJZbmlRBHoGFIv3NOGrXFGiE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562387900873801.2009260513918; Fri, 5 Jul 2019 21:38:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3845D3082A9C; Sat, 6 Jul 2019 04:38:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10739226FD; Sat, 6 Jul 2019 04:38:19 +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 C80A941F63; Sat, 6 Jul 2019 04:38:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664bk7S006737 for ; Sat, 6 Jul 2019 00:37:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A26E1001947; Sat, 6 Jul 2019 04:37:46 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30C841001B04 for ; Sat, 6 Jul 2019 04:37:46 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:30 -0500 Message-Id: <20190706043735.26284-4-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/8] snapshot: Add internal option to validate XML against schema 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Sat, 06 Jul 2019 04:38:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Similar to VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; for now used only by the testsuite, but will be exposed in the public API in the next patch. Signed-off-by: Eric Blake --- src/conf/snapshot_conf.h | 1 + src/conf/snapshot_conf.c | 13 +++++++++++++ tests/qemudomainsnapshotxml2xmltest.c | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 08b2a3b955..a0c87e7ade 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -92,6 +92,7 @@ typedef enum { VIR_DOMAIN_SNAPSHOT_PARSE_DISKS =3D 1 << 1, VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL =3D 1 << 2, VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE =3D 1 << 3, + VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE =3D 1 << 4, } virDomainSnapshotParseFlags; typedef enum { diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index c7f29360e7..daea6c616d 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -25,6 +25,7 @@ #include #include +#include "configmake.h" #include "internal.h" #include "virbitmap.h" #include "virbuffer.h" @@ -409,6 +410,18 @@ virDomainSnapshotDefParseNode(xmlDocPtr xml, goto cleanup; } + if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE) { + VIR_AUTOFREE(char *) schema =3D NULL; + + schema =3D virFileFindResource("domainsnapshot.rng", + abs_top_srcdir "/docs/schemas", + PKGDATADIR "/schemas"); + if (!schema) + return NULL; + if (virXMLValidateAgainstSchema(schema, xml) < 0) + return NULL; + } + ctxt =3D xmlXPathNewContext(xml); if (ctxt =3D=3D NULL) { virReportOOMError(); diff --git a/tests/qemudomainsnapshotxml2xmltest.c b/tests/qemudomainsnapsh= otxml2xmltest.c index 10ea9cf8d2..55cb8575f7 100644 --- a/tests/qemudomainsnapshotxml2xmltest.c +++ b/tests/qemudomainsnapshotxml2xmltest.c @@ -35,7 +35,8 @@ testCompareXMLToXMLFiles(const char *inxml, char *outXmlData =3D NULL; char *actual =3D NULL; int ret =3D -1; - unsigned int parseflags =3D VIR_DOMAIN_SNAPSHOT_PARSE_DISKS; + unsigned int parseflags =3D (VIR_DOMAIN_SNAPSHOT_PARSE_DISKS | + VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE); unsigned int formatflags =3D VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE; bool cur =3D false; VIR_AUTOUNREF(virDomainSnapshotDefPtr) def =3D NULL; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387901; cv=none; d=zoho.com; s=zohoarc; b=dPu+K5y07NYdC40Lsqfo4fGfcc8PzevrL7BXJLBB35LY8pf/ZyTRGjUTqh89fOJILNq5DG1K5cJOJ+EhxYyccrlhEK2QClvFkjFSUYeBwFQhiLYX+kZzJYHD8RUqVTnVys0bsMtdYboXZJ0fXimM6GYyX3JawnMDtdNdejEk194= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387901; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4/P1SU6hYijTVDqvFiMDE+G7PQXuBSsVGCS6eMUxbLg=; b=MiemkmxaRw9DxBhyx8e2tUhHkEqRIDfGl6Cj41tx+iA/oIHvH0JQPQXqB8n4tZOk3zWtPPTXSCMKBsEmoHKtTdMXBj1mLOOLZ+6kOguDX+0P6KAkpfwZiuwaV/2dRsNgiitvhi0tgeh0oaNMaHxyRiWw4N2hWq6Rd6WLhAbM8go= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156238790110917.191746370700116; Fri, 5 Jul 2019 21:38:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3854585546; Sat, 6 Jul 2019 04:38:19 +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 13B6C83E91; Sat, 6 Jul 2019 04:38:19 +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 CAEEC18184AD; Sat, 6 Jul 2019 04:38:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664bk81006742 for ; Sat, 6 Jul 2019 00:37:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id C6CC61001B19; Sat, 6 Jul 2019 04:37:46 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EA3A1001B04 for ; Sat, 6 Jul 2019 04:37:46 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:31 -0500 Message-Id: <20190706043735.26284-5-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/8] snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE flag 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 06 Jul 2019 04:38:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We've been doing a terrible job of performing XML validation in our various API that parse XML with a corresponding schema (we started with domains back in commit dd69a14f, v1.2.12, but didn't catch all domain-related APIs, and didn't cover other XMLM). New APIs (like checkpoints) should do the validation unconditionally, but it doesn't hurt to retrofit existing APIs to at least allow the option. Wire up a new snapshot XML creation flag through all the hypervisors that support snapshots, as well as exposing it in 'virsh snapshot-create'. For 'virsh snapshot-create-as', we blindly set the flag without a command-line option, since the XML we create from the command line should always comply, but we have to add in code to disable validation if the server is too old to understand the flag. Signed-off-by: Eric Blake --- include/libvirt/libvirt-domain-snapshot.h | 2 ++ src/libvirt-domain-snapshot.c | 3 +++ src/qemu/qemu_driver.c | 6 +++++- src/test/test_driver.c | 6 +++++- src/vbox/vbox_common.c | 11 ++++++++--- src/vz/vz_driver.c | 5 ++++- tests/virsh-snapshot | 6 +++--- tools/virsh-snapshot.c | 15 ++++++++++++++- tools/virsh.pod | 7 +++++-- 9 files changed, 49 insertions(+), 12 deletions(-) diff --git a/include/libvirt/libvirt-domain-snapshot.h b/include/libvirt/li= bvirt-domain-snapshot.h index 602e5def59..90673ed0fb 100644 --- a/include/libvirt/libvirt-domain-snapshot.h +++ b/include/libvirt/libvirt-domain-snapshot.h @@ -71,6 +71,8 @@ typedef enum { VIR_DOMAIN_SNAPSHOT_CREATE_LIVE =3D (1 << 8), /* create the sna= pshot while the guest = is running */ + VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE =3D (1 << 9), /* validate the X= ML + against the sche= ma */ } virDomainSnapshotCreateFlags; /* Take a snapshot of the current VM state */ diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c index 0c8023d9f6..2687a34b96 100644 --- a/src/libvirt-domain-snapshot.c +++ b/src/libvirt-domain-snapshot.c @@ -115,6 +115,9 @@ virDomainSnapshotGetConnect(virDomainSnapshotPtr snapsh= ot) * becomes current (see virDomainSnapshotCurrent()), and is a child * of any previous current snapshot. * + * If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, then @xmlDesc + * must validate against the XML schema. + * * If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, then this * is a request to reinstate snapshot metadata that was previously * captured from virDomainSnapshotGetXMLDesc() before removing that diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9c05ab4ad1..97f3d7f786 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15508,7 +15508,8 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT | VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE | VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC | - VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, NULL); + VIR_DOMAIN_SNAPSHOT_CREATE_LIVE | + VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, @@ -15549,6 +15550,9 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, !virDomainObjIsActive(vm)) parse_flags |=3D VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE; + if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE) + parse_flags |=3D VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE; + if (!(def =3D virDomainSnapshotDefParseString(xmlDesc, caps, driver->x= mlopt, NULL, parse_flags))) goto cleanup; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7dd448bb20..e7ad4dbbd7 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7163,7 +7163,8 @@ testDomainSnapshotCreateXML(virDomainPtr domain, VIR_DOMAIN_SNAPSHOT_CREATE_HALT | VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE | VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC | - VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, NULL); + VIR_DOMAIN_SNAPSHOT_CREATE_LIVE | + VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); if ((redefine && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT))) update_current =3D false; @@ -7179,6 +7180,9 @@ testDomainSnapshotCreateXML(virDomainPtr domain, goto cleanup; } + if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE) + parse_flags |=3D VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE; + if (!(def =3D virDomainSnapshotDefParseString(xmlDesc, privconn->caps, privconn->xmlopt, diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 54e31bec9d..8a912da50c 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -5487,6 +5487,8 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, nsresult rc; resultCodeUnion result; virDomainSnapshotPtr ret =3D NULL; + unsigned int parse_flags =3D (VIR_DOMAIN_SNAPSHOT_PARSE_DISKS | + VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE); VIR_AUTOUNREF(virDomainSnapshotDefPtr) def =3D NULL; if (!data->vboxObj) @@ -5496,12 +5498,15 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, /* VBox has no snapshot metadata, so this flag is trivial. */ virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA | VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE | - VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT, NULL); + VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT | + VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); + + if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE) + parse_flags |=3D VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE; if (!(def =3D virDomainSnapshotDefParseString(xmlDesc, data->caps, data->xmlopt, NULL, - VIR_DOMAIN_SNAPSHOT_PARSE_= DISKS | - VIR_DOMAIN_SNAPSHOT_PARSE_= REDEFINE))) + parse_flags))) goto cleanup; diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 2286f9a04f..50c883feca 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -2586,7 +2586,7 @@ vzDomainSnapshotCreateXML(virDomainPtr domain, bool job =3D false; VIR_AUTOUNREF(virDomainSnapshotDefPtr) def =3D NULL; - virCheckFlags(0, NULL); + virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); if (!(dom =3D vzDomObjFromDomain(domain))) return NULL; @@ -2594,6 +2594,9 @@ vzDomainSnapshotCreateXML(virDomainPtr domain, if (virDomainSnapshotCreateXMLEnsureACL(domain->conn, dom->def, flags)= < 0) goto cleanup; + if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE) + parse_flags |=3D VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE; + if (!(def =3D virDomainSnapshotDefParseString(xmlDesc, driver->caps, driver->xmlopt, NULL, parse_flags))) diff --git a/tests/virsh-snapshot b/tests/virsh-snapshot index cb498cf54e..8eab67c9e0 100755 --- a/tests/virsh-snapshot +++ b/tests/virsh-snapshot @@ -180,11 +180,11 @@ compare exp err || fail=3D1 # Restore state with redefine $abs_top_builddir/tools/virsh -c test:///default >out 2>err <code =3D=3D VIR_ERR_NO_SUPPORT && !from) { + flags &=3D ~VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE; + snapshot =3D virDomainSnapshotCreateXML(dom, buffer, flags); + } + /* Emulate --halt on older servers. */ if (!snapshot && last_error->code =3D=3D VIR_ERR_INVALID_ARG && (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) { @@ -147,6 +154,10 @@ static const vshCmdOptDef opts_snapshot_create[] =3D { .help =3D N_("require atomic operation") }, VIRSH_COMMON_OPT_LIVE(N_("take a live snapshot")), + {.name =3D "validate", + .type =3D VSH_OT_BOOL, + .help =3D N_("validate the XML against the schema"), + }, {.name =3D NULL} }; @@ -177,6 +188,8 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC; if (vshCommandOptBool(cmd, "live")) flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_LIVE; + if (vshCommandOptBool(cmd, "validate")) + flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE; if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) goto cleanup; @@ -366,7 +379,7 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd) const char *desc =3D NULL; const char *memspec =3D NULL; virBuffer buf =3D VIR_BUFFER_INITIALIZER; - unsigned int flags =3D 0; + unsigned int flags =3D VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE; const vshCmdOpt *opt =3D NULL; if (vshCommandOptBool(cmd, "no-metadata")) diff --git a/tools/virsh.pod b/tools/virsh.pod index dc39004a66..865fb2b0da 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -4588,10 +4588,13 @@ used to represent properties of snapshots. =3Ditem B I [I] {[I<--redefine> [I<--cur= rent>]] | [I<--no-metadata>] [I<--halt>] [I<--disk-only>] [I<--reuse-external>] -[I<--quiesce>] [I<--atomic>] [I<--live>]} +[I<--quiesce>] [I<--atomic>] [I<--live>]} [I<--validate>] Create a snapshot for domain I with the properties specified in -I. Normally, the only properties settable for a domain snapshot +I. Optionally, the I<--validate> option can be passed to +validate the format of the input XML file against an internal RNG +schema (identical to using L tool). Normally, +the only properties settable for a domain snapshot are the and elements, as well as if I<--disk-only> is given; the rest of the fields are ignored, and automatically filled in by libvirt. If I is --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387904; cv=none; d=zoho.com; s=zohoarc; b=RrhbouKYLCK2H+xmFWLbcLPX7qVMuRkSy97wX2wP3/mZn34XmA2q0f6leiGPODng+pF91ipL3DeE2EDDguQi7V8+cQBILylvEF8P6RA4Dkf07eLbJbg73BqZ2d07NKGIk1JeVYp0xiJvizQL+Ur8bP1TIAQOHNUeDOEAxNPMhx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387904; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=5NJVdgi/1B3WrSC+6VU4O9Wepl2pjV2RExa7+eo6yfM=; b=F9B2ALVu6OgegRi6B/HuopK9j3f57re4s0+E8CYCZ1YPkEX5HZVUDoSW6uVZdSWA3IWsGfl3Eug9Y+8abNhcMuq6zoCSJoaJy1fXg/209fWBU7+SUh9rM396Y+L+VRt7rfEFKTOLoskVDH1mMkXxAUgb+1oayNS2UDSDQRBqszQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562387904147247.1922152644895; Fri, 5 Jul 2019 21:38:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8824687629; Sat, 6 Jul 2019 04:38:22 +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 6362F772B6; Sat, 6 Jul 2019 04:38:22 +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 2CC6118184B9; Sat, 6 Jul 2019 04:38:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664blct006752 for ; Sat, 6 Jul 2019 00:37:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2E6771001947; Sat, 6 Jul 2019 04:37:47 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA2411001B04 for ; Sat, 6 Jul 2019 04:37:46 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:32 -0500 Message-Id: <20190706043735.26284-6-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/8] snapshot: Factor out redefine cycle validation 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 06 Jul 2019 04:38:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The code to check whether a redefined snapshot/checkpoint XML is attempting to create a cycle in the list of moments is lengthy, and common between the two types of list. Therefore, it belongs in the shared base file. Signed-off-by: Eric Blake --- src/conf/virdomainmomentobjlist.h | 3 +++ src/conf/virdomainsnapshotobjlist.h | 3 +++ src/conf/snapshot_conf.c | 41 ++++------------------------- src/conf/virdomainmomentobjlist.c | 40 ++++++++++++++++++++++++++++ src/conf/virdomainsnapshotobjlist.c | 9 +++++++ tests/virsh-snapshot | 2 +- 6 files changed, 61 insertions(+), 37 deletions(-) diff --git a/src/conf/virdomainmomentobjlist.h b/src/conf/virdomainmomentob= jlist.h index 68f00a114f..4067e928f4 100644 --- a/src/conf/virdomainmomentobjlist.h +++ b/src/conf/virdomainmomentobjlist.h @@ -117,3 +117,6 @@ int virDomainMomentForEach(virDomainMomentObjListPtr mo= ments, virHashIterator iter, void *data); int virDomainMomentUpdateRelations(virDomainMomentObjListPtr moments); +int virDomainMomentCheckCycles(virDomainMomentObjListPtr list, + virDomainMomentDefPtr def, + const char *domname); diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapsh= otobjlist.h index 26fa456730..fed8d22bc8 100644 --- a/src/conf/virdomainsnapshotobjlist.h +++ b/src/conf/virdomainsnapshotobjlist.h @@ -52,6 +52,9 @@ int virDomainSnapshotForEach(virDomainSnapshotObjListPtr = snapshots, virHashIterator iter, void *data); int virDomainSnapshotUpdateRelations(virDomainSnapshotObjListPtr snapshots= ); +int virDomainSnapshotCheckCycles(virDomainSnapshotObjListPtr snapshots, + virDomainSnapshotDefPtr def, + const char *domname); #define VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA \ (VIR_DOMAIN_SNAPSHOT_LIST_METADATA | \ diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index daea6c616d..3521177f0b 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -966,46 +966,15 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, { virDomainSnapshotDefPtr def =3D *defptr; virDomainMomentObjPtr other; - virDomainSnapshotDefPtr otherdef; + virDomainSnapshotDefPtr otherdef =3D NULL; bool check_if_stolen; - /* Prevent circular chains */ - if (def->parent.parent_name) { - if (STREQ(def->parent.name, def->parent.parent_name)) { - virReportError(VIR_ERR_INVALID_ARG, - _("cannot set snapshot %s as its own parent"), - def->parent.name); - return -1; - } - other =3D virDomainSnapshotFindByName(vm->snapshots, - def->parent.parent_name); - if (!other) { - virReportError(VIR_ERR_INVALID_ARG, - _("parent %s for snapshot %s not found"), - def->parent.parent_name, def->parent.name); - return -1; - } - otherdef =3D virDomainSnapshotObjGetDef(other); - while (otherdef->parent.parent_name) { - if (STREQ(otherdef->parent.parent_name, def->parent.name)) { - virReportError(VIR_ERR_INVALID_ARG, - _("parent %s would create cycle to %s"), - otherdef->parent.name, def->parent.name); - return -1; - } - other =3D virDomainSnapshotFindByName(vm->snapshots, - otherdef->parent.parent_na= me); - if (!other) { - VIR_WARN("snapshots are inconsistent for %s", - vm->def->name); - break; - } - otherdef =3D virDomainSnapshotObjGetDef(other); - } - } + if (virDomainSnapshotCheckCycles(vm->snapshots, def, vm->def->name) < = 0) + return -1; other =3D virDomainSnapshotFindByName(vm->snapshots, def->parent.name); - otherdef =3D other ? virDomainSnapshotObjGetDef(other) : NULL; + if (other) + otherdef =3D virDomainSnapshotObjGetDef(other); check_if_stolen =3D other && otherdef->parent.dom; if (virDomainSnapshotRedefineValidate(def, domain->uuid, other, xmlopt, flags) < 0) { diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentob= jlist.c index f56b516343..0ea5e9af80 100644 --- a/src/conf/virdomainmomentobjlist.c +++ b/src/conf/virdomainmomentobjlist.c @@ -519,3 +519,43 @@ virDomainMomentUpdateRelations(virDomainMomentObjListP= tr moments) moments->current =3D NULL; return act.err; } + + +int +virDomainMomentCheckCycles(virDomainMomentObjListPtr list, + virDomainMomentDefPtr def, + const char *domname) +{ + virDomainMomentObjPtr other; + + if (def->parent_name) { + if (STREQ(def->name, def->parent_name)) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot set moment %s as its own parent"), + def->name); + return -1; + } + other =3D virDomainMomentFindByName(list, def->parent_name); + if (!other) { + virReportError(VIR_ERR_INVALID_ARG, + _("parent %s for moment %s not found"), + def->parent_name, def->name); + return -1; + } + while (other->def->parent_name) { + if (STREQ(other->def->parent_name, def->name)) { + virReportError(VIR_ERR_INVALID_ARG, + _("parent %s would create cycle to %s"), + other->def->name, def->name); + return -1; + } + other =3D virDomainMomentFindByName(list, other->def->parent_n= ame); + if (!other) { + VIR_WARN("moments are inconsistent for domain %s", + domname); + break; + } + } + } + return 0; +} diff --git a/src/conf/virdomainsnapshotobjlist.c b/src/conf/virdomainsnapsh= otobjlist.c index 9bcc8d1036..99bc4bb0c5 100644 --- a/src/conf/virdomainsnapshotobjlist.c +++ b/src/conf/virdomainsnapshotobjlist.c @@ -234,6 +234,15 @@ virDomainSnapshotUpdateRelations(virDomainSnapshotObjL= istPtr snapshots) } +int +virDomainSnapshotCheckCycles(virDomainSnapshotObjListPtr snapshots, + virDomainSnapshotDefPtr def, + const char *domname) +{ + return virDomainMomentCheckCycles(snapshots->base, &def->parent, domna= me); +} + + int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots, virDomainMomentObjPtr from, diff --git a/tests/virsh-snapshot b/tests/virsh-snapshot index 8eab67c9e0..510904f470 100755 --- a/tests/virsh-snapshot +++ b/tests/virsh-snapshot @@ -206,7 +206,7 @@ Metadata: yes EOF cat < exp || fail=3D1 -error: invalid argument: parent s3 for snapshot s2 not found +error: invalid argument: parent s3 for moment s2 not found error: marker EOF compare exp err || fail=3D1 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387901; cv=none; d=zoho.com; s=zohoarc; b=EhpZ/6j25dQtFD+q4sPwlhTWpJU+uzpWKln0GNEcNpuGW8m5aOl+4knSQnsNlNi6F10tSTJW4MShBIoobjR21Qs6DktSS1XkfiNLFcsLVVtzIDk6dvCBZWvGVdAG02M/Q+ZKQb+7cOz8g9vxiEcLKkuxBRajuSliEYCM1RQeCnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387901; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=nhOSwy4ijE1FXzK24rkK0PNFsY6r9YFNvfDE6qf6oBc=; b=XMCAWnAECm3TJsZzg7ECPkAUEU/ej0PHSi38biuuX94Rng2GLV7ZluybXH1iL+TaT/xtEjQlYQR5HcoxOMWQBmcXb4hxjsKBfd2oOHVdptIboGHbLkdFPhSjVGOjoE8M1bYbk6Z8JhaWnWaETh7+rBm3tKq6974qTZL396H79BE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562387901155742.6085729071399; Fri, 5 Jul 2019 21:38:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92A3F30832EF; Sat, 6 Jul 2019 04:38:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B156BA114; Sat, 6 Jul 2019 04:38:19 +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 32E5441F63; Sat, 6 Jul 2019 04:38:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664blLw006762 for ; Sat, 6 Jul 2019 00:37:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A1261001B19; Sat, 6 Jul 2019 04:37:47 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51F2B1001947 for ; Sat, 6 Jul 2019 04:37:47 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:33 -0500 Message-Id: <20190706043735.26284-7-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/8] backup: Add support for filtering based on current moment 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 06 Jul 2019 04:38:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Right now, the snapshot API permits at most one current snapshot, and includes specific API for getting at that snapshot (virDomainHasCurrentSnapshot, virDomainSnapshotCurrent, virDomainSnapshotIsCurrent). However, with upcoming checkpoints, it is conceivable that a hypervisor could mark multiple checkpoints as current (the qemu implementation has only one current checkpoint for an incremental backup, and computes the set of changes for a differential backup by merging a chain of checkpoints - but other hypervisors may treat all differential checkpoints as current). As such, it is more desirable to avoid explicit API for getting at the one current checkpoint, and instead have the List API include a filter for that purpose. Still, it is easier to implement that filter directly in the common virDomainMomentObjList code, since that is the only code that tracks the one moment that is current (both for existing snapshots, and for how qemu will be using current checkpoints). Signed-off-by: Eric Blake --- src/conf/virdomainmomentobjlist.h | 11 +++++++++-- src/conf/virdomainmomentobjlist.c | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/conf/virdomainmomentobjlist.h b/src/conf/virdomainmomentob= jlist.h index 4067e928f4..7628df5e29 100644 --- a/src/conf/virdomainmomentobjlist.h +++ b/src/conf/virdomainmomentobjlist.h @@ -78,8 +78,10 @@ typedef enum { VIR_DOMAIN_MOMENT_LIST_TOPOLOGICAL =3D (1 << 1), VIR_DOMAIN_MOMENT_LIST_LEAVES =3D (1 << 2), VIR_DOMAIN_MOMENT_LIST_NO_LEAVES =3D (1 << 3), - VIR_DOMAIN_MOMENT_LIST_METADATA =3D (1 << 4), - VIR_DOMAIN_MOMENT_LIST_NO_METADATA =3D (1 << 5), + VIR_DOMAIN_MOMENT_LIST_CURRENT =3D (1 << 4), + VIR_DOMAIN_MOMENT_LIST_NO_CURRENT =3D (1 << 5), + VIR_DOMAIN_MOMENT_LIST_METADATA =3D (1 << 6), + VIR_DOMAIN_MOMENT_LIST_NO_METADATA =3D (1 << 7), } virDomainMomentFilters; #define VIR_DOMAIN_MOMENT_FILTERS_METADATA \ @@ -90,10 +92,15 @@ typedef enum { (VIR_DOMAIN_MOMENT_LIST_LEAVES | \ VIR_DOMAIN_MOMENT_LIST_NO_LEAVES) +#define VIR_DOMAIN_MOMENT_FILTERS_CURRENT \ + (VIR_DOMAIN_MOMENT_LIST_CURRENT | \ + VIR_DOMAIN_MOMENT_LIST_NO_CURRENT) + #define VIR_DOMAIN_MOMENT_FILTERS_ALL \ (VIR_DOMAIN_MOMENT_LIST_ROOTS | \ VIR_DOMAIN_MOMENT_LIST_TOPOLOGICAL | \ VIR_DOMAIN_MOMENT_FILTERS_METADATA | \ + VIR_DOMAIN_MOMENT_FILTERS_CURRENT | \ VIR_DOMAIN_MOMENT_FILTERS_LEAVES) int virDomainMomentObjListGetNames(virDomainMomentObjListPtr moments, diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentob= jlist.c index 0ea5e9af80..55d1db9fb0 100644 --- a/src/conf/virdomainmomentobjlist.c +++ b/src/conf/virdomainmomentobjlist.c @@ -283,6 +283,7 @@ struct virDomainMomentNameData { unsigned int flags; int count; bool error; + virDomainMomentObjPtr current; /* The current moment, if any */ virDomainMomentObjListFilter filter; unsigned int filter_flags; }; @@ -303,6 +304,11 @@ static int virDomainMomentObjListCopyNames(void *paylo= ad, return 0; if ((data->flags & VIR_DOMAIN_MOMENT_LIST_NO_LEAVES) && !obj->nchildre= n) return 0; + if ((data->flags & VIR_DOMAIN_MOMENT_LIST_CURRENT) && obj !=3D data->c= urrent) + return 0; + if ((data->flags & VIR_DOMAIN_MOMENT_LIST_NO_CURRENT) && + obj =3D=3D data->current) + return 0; if (!data->filter(obj, data->filter_flags)) return 0; @@ -327,7 +333,8 @@ virDomainMomentObjListGetNames(virDomainMomentObjListPt= r moments, unsigned int filter_flags) { struct virDomainMomentNameData data =3D { names, maxnames, flags, 0, - false, filter, filter_flags }; + false, moments->current, + filter, filter_flags }; size_t i; virCheckFlags(VIR_DOMAIN_MOMENT_FILTERS_ALL, -1); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387907; cv=none; d=zoho.com; s=zohoarc; b=XhTCi9Zy/Wew9MC/2RtEK1ctTYZ+dP+3dcL+xKQ1aOdoDeojwyyHZRi4mLRHOyrRq4QdPOXPtouuYwLPavd2Ujt+2Z5Zcvon6z6pAmJ5DaZDZ8m/c8hbC7rLaGANJURJPDSFzh+GK0VvRc3BEM50PvDaYOd1ypn3B7tDiaLxmIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387907; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=E9wKlyAGzUskji/RmkCEhTWycHwoDZVrYqB+W5Cz1qo=; b=m3tNimLFp7yY8qx8uxq4IP/Q2gt469QlvgFtwM7qWSSqQfgbgNbMapNvCGktzlrXhXQMavR8NdhHwFx0am75GdCg0deFonx77i+FD4Y9D4H9nyJokCCwA9HAIQAkWk2bsvy1v1MdeO9p3/aBcfzA6bEb7TEndbX/wi+RfS9SryI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562387907288442.1953213968927; Fri, 5 Jul 2019 21:38:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7246307D91E; Sat, 6 Jul 2019 04:38:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94A6883EBB; Sat, 6 Jul 2019 04:38:25 +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 53BE2C59A; Sat, 6 Jul 2019 04:38:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664blaK006767 for ; Sat, 6 Jul 2019 00:37:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6E7F1001B19; Sat, 6 Jul 2019 04:37:47 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE2341001B04 for ; Sat, 6 Jul 2019 04:37:47 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:34 -0500 Message-Id: <20190706043735.26284-8-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/8] snapshot: Add ListAll filters for current snapshot 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Sat, 06 Jul 2019 04:38:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add a new filter group VIR_DOMAIN_SNAPSHOT_LIST_CURRENT/NO_CURRENT, which restricts the output based on whether a snapshot is the domain's current snapshot. This is redundant with existing API (both virDomainHasCurrentSnapshot and virDomainSnapshotCurrent can be emulated by a single call to virDomainListAllSnapshots, and replacing virDomainSnapshotIsCurrent is also possible but a bit more indirect). However, adding the new filters makes snapshots slightly more consistent with the plans for the upcoming checkpoint API additions to ONLY provide access to the notion of being current via list filters or XML inspection. Signed-off-by: Eric Blake --- include/libvirt/libvirt-domain-snapshot.h | 5 +++++ src/conf/virdomainsnapshotobjlist.h | 7 ++++++- src/conf/virdomainsnapshotobjlist.c | 4 ++++ src/libvirt-domain-snapshot.c | 14 ++++++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/libvirt/libvirt-domain-snapshot.h b/include/libvirt/li= bvirt-domain-snapshot.h index 90673ed0fb..02cdabafbc 100644 --- a/include/libvirt/libvirt-domain-snapshot.h +++ b/include/libvirt/libvirt-domain-snapshot.h @@ -141,6 +141,11 @@ typedef enum { VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL =3D (1 << 10), /* Ensure parents = occur before children in the resulting lis= t */ + + VIR_DOMAIN_SNAPSHOT_LIST_CURRENT =3D (1 << 11), /* Filter to just = current + snapshot */ + VIR_DOMAIN_SNAPSHOT_LIST_NO_CURRENT =3D (1 << 12), /* Filter out curr= ent + snapshot */ } virDomainSnapshotListFlags; /* Return the number of snapshots for this domain */ diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapsh= otobjlist.h index fed8d22bc8..59a176aaef 100644 --- a/src/conf/virdomainsnapshotobjlist.h +++ b/src/conf/virdomainsnapshotobjlist.h @@ -73,11 +73,16 @@ int virDomainSnapshotCheckCycles(virDomainSnapshotObjLi= stPtr snapshots, (VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | \ VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL) +#define VIR_DOMAIN_SNAPSHOT_FILTERS_CURRENT \ + (VIR_DOMAIN_SNAPSHOT_LIST_CURRENT | \ + VIR_DOMAIN_SNAPSHOT_LIST_NO_CURRENT) + #define VIR_DOMAIN_SNAPSHOT_FILTERS_ALL \ (VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA | \ VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES | \ VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS | \ - VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION) + VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION | \ + VIR_DOMAIN_SNAPSHOT_FILTERS_CURRENT) int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots, virDomainMomentObjPtr from, diff --git a/src/conf/virdomainsnapshotobjlist.c b/src/conf/virdomainsnapsh= otobjlist.c index 99bc4bb0c5..cac0834e1f 100644 --- a/src/conf/virdomainsnapshotobjlist.c +++ b/src/conf/virdomainsnapshotobjlist.c @@ -124,6 +124,10 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjL= istPtr snapshots, VIR_DOMAIN_MOMENT_LIST_LEAVES, }, { VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, VIR_DOMAIN_MOMENT_LIST_NO_LEAVES, }, + { VIR_DOMAIN_SNAPSHOT_LIST_CURRENT, + VIR_DOMAIN_MOMENT_LIST_CURRENT, }, + { VIR_DOMAIN_SNAPSHOT_LIST_NO_CURRENT, + VIR_DOMAIN_MOMENT_LIST_NO_CURRENT, }, { VIR_DOMAIN_SNAPSHOT_LIST_METADATA, VIR_DOMAIN_MOMENT_LIST_METADATA, }, { VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c index 2687a34b96..5dd2c5390b 100644 --- a/src/libvirt-domain-snapshot.c +++ b/src/libvirt-domain-snapshot.c @@ -465,6 +465,12 @@ virDomainSnapshotListNames(virDomainPtr domain, char *= *names, int nameslen, * whether the snapshot is stored inside the disk images or as * additional files. * + * The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_CURRENT and + * VIR_DOMAIN_SNAPSHOT_LIST_NO_CURRENT, to filter based on whether a + * snapshot is current. This filter provides the same functionality as + * virDomainHasCurrentSnapshot(), virDomainSnapshotCurrent(), and + * virDomainSnapshotIsCurrent(). + * * Returns the number of domain snapshots found or -1 and sets @snaps to * NULL in case of error. On success, the array stored into @snaps is * guaranteed to have an extra allocated element set to NULL but not inclu= ded @@ -736,7 +742,9 @@ virDomainSnapshotLookupByName(virDomainPtr domain, * @domain: pointer to the domain object * @flags: extra flags; not used yet, so callers should always pass 0 * - * Determine if the domain has a current snapshot. + * Determine if the domain has a current snapshot. This can also be + * determined by using virDomainListAllSnapshots() with the + * VIR_DOMAIN_SNAPSHOT_LIST_CURRENT filter. * * Returns 1 if such snapshot exists, 0 if it doesn't, -1 on error. */ @@ -771,7 +779,9 @@ virDomainHasCurrentSnapshot(virDomainPtr domain, unsign= ed int flags) * @domain: a domain object * @flags: extra flags; not used yet, so callers should always pass 0 * - * Get the current snapshot for a domain, if any. + * Get the current snapshot for a domain, if any. This can also be + * determined by using virDomainListAllSnapshots() with the + * VIR_DOMAIN_SNAPSHOT_LIST_CURRENT filter. * * virDomainSnapshotFree should be used to free the resources after the * snapshot object is no longer needed. --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 21:27:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562387904; cv=none; d=zoho.com; s=zohoarc; b=mcEXyXfQHHwUrdBvfNdXWrYJ3qYzlGMrbfdav51PQimGoJwU9LedaH+TLeruXs8Jp5XfJ8R61qU23oSIGIzJMYNYU5759PArYG5w+ZUL+FH//QXfUAj14rpBvE/DB3/9vunaBVZ6dWtI5omoDzu/PlpZM3Sss6zYBtJTkNbbK0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562387904; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UAsddxfI4bJichzrpr4lJtW25Efm95d3JhOANIwIok8=; b=jgkIVT4RyInXAcr0urJ2LCxaqtjAw7bCp35GooSufhqzGZNZF33GhJ7SY5Sug1cHQEw1eyVwE6xGNA/NhKviqew8Q/UCQOysNcYrxxqb/Hfz/5BQwJkqnYu4YTTOkeZKTZxVtPlic33tn/b0YpyJReohJWLtaq1EFqQaxSUozQU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562387904071325.19911728461943; Fri, 5 Jul 2019 21:38:24 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 5FA563082B46; Sat, 6 Jul 2019 04:38:22 +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 3B4AA86E2E; Sat, 6 Jul 2019 04:38:22 +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 F2BFD18184B8; Sat, 6 Jul 2019 04:38:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x664bmkm006772 for ; Sat, 6 Jul 2019 00:37:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E2371001947; Sat, 6 Jul 2019 04:37:48 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 165421001B04 for ; Sat, 6 Jul 2019 04:37:48 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Fri, 5 Jul 2019 23:37:35 -0500 Message-Id: <20190706043735.26284-9-eblake@redhat.com> In-Reply-To: <20190706043735.26284-1-eblake@redhat.com> References: <20190706043735.26284-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/8] snapshot: Expose new filter flags in virsh 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Sat, 06 Jul 2019 04:38:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We already burned 'virsh snapshot-list --current' for a different purpose, so this adds --current-only/--no-current as the new bool flags to select the new filter bits. Update tests/virsh-snapshot to exercise the new flags. Signed-off-by: Eric Blake --- tests/virsh-snapshot | 8 +++++++- tools/virsh-snapshot.c | 10 ++++++++++ tools/virsh.pod | 7 ++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/virsh-snapshot b/tests/virsh-snapshot index 510904f470..8b0813233f 100755 --- a/tests/virsh-snapshot +++ b/tests/virsh-snapshot @@ -52,6 +52,7 @@ $abs_top_builddir/tools/virsh --connect test:///default >= out 2>err ' snapshot-current test --name # Deleting current root leads to multiple roots, demonstrate list filter= ing snapshot-delete test --current + snapshot-list test --current-only --name echo --err marker snapshot-current test --name echo --err marker @@ -63,7 +64,7 @@ $abs_top_builddir/tools/virsh --connect test:///default >= out 2>err ' # More fun with delete flags, current node moves up to remaining parent snapshot-current test s4 snapshot-delete test --children-only s6 - snapshot-current test --name + snapshot-list test --current-only --name snapshot-delete test --children s7 snapshot-current test --name snapshot-delete test s6 @@ -71,6 +72,7 @@ $abs_top_builddir/tools/virsh --connect test:///default >= out 2>err ' # Now the tree is linear, so we have an unambiguous topological order snapshot-list test --name snapshot-list test --name --topological + snapshot-list test --name --no-current # Capture some XML for later redefine echo "" snapshot-dumpxml test s3 @@ -123,6 +125,7 @@ Domain snapshot s1 deleted + Name Creation Time State --------------------------------------------- s3 TIMESTAMP running @@ -155,6 +158,7 @@ Snapshot s4 set as current Domain snapshot s6 children deleted s6 + Domain snapshot s7 deleted s6 @@ -167,6 +171,8 @@ s3 s3 s2 +s2 + EOF compare exp out.cooked || fail=3D1 diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index f7772ce549..9f8d1c5e5c 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1463,6 +1463,14 @@ static const vshCmdOptDef opts_snapshot_list[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("sort list topologically rather than by name"), }, + {.name =3D "current-only", + .type =3D VSH_OT_BOOL, + .help =3D N_("filter to just the current snapshot"), + }, + {.name =3D "no-current", + .type =3D VSH_OT_BOOL, + .help =3D N_("filter out the current snapshot"), + }, {.name =3D NULL} }; @@ -1522,6 +1530,8 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) FILTER("disk-only", DISK_ONLY); FILTER("internal", INTERNAL); FILTER("external", EXTERNAL); + FILTER("current-only", CURRENT); + FILTER("no-current", NO_CURRENT); #undef FILTER if (vshCommandOptBool(cmd, "topological")) diff --git a/tools/virsh.pod b/tools/virsh.pod index 865fb2b0da..546727a90f 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -4767,7 +4767,8 @@ with I<--current>. [{I<--parent> | I<--roots> | [{I<--tree> | I<--name>}]}] [I<--topological>] [{[I<--from>] B | I<--current>} [I<--descendants>]] [I<--leaves>] [I<--no-leaves>] [I<--inactive>] [I<--active>] -[I<--disk-only>] [I<--internal>] [I<--external>] +[I<--disk-only>] [I<--internal>] [I<--external>] [I<--current-only>] +[I<--no-current>] List all of the available snapshots for the given domain, defaulting to show columns for the snapshot name, creation time, and domain state. @@ -4824,6 +4825,10 @@ that use internal storage of existing disk images. = If I<--external> is specified, the list will be filtered to snapshots that use external files for disk images or memory state. +If I<--current-only> is specified, the list will be filtered to just +the current snapshot (if it meets all other filters). If I<--no-current> +is specified, the list will be filtered to exclude the current snapshot. + =3Ditem B I I [I<--security-info>] Output the snapshot XML for the domain's snapshot named I. --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list