[PATCH 09/14] conf: snapshot: Remove VIR_DOMAIN_SNAPSHOT_PARSE_DISKS flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All callers except the one in the 'esx' driver pass the flag. The 'esx'
driver has a check that 'def->ndisks' is zero after parsing the
definition. This means that we can simply always parse the disks.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/snapshot_conf.c              | 22 ++++++++--------------
 src/conf/snapshot_conf.h              |  7 +++----
 src/qemu/qemu_driver.c                |  1 -
 src/qemu/qemu_snapshot.c              |  2 +-
 src/test/test_driver.c                |  3 +--
 src/vbox/vbox_common.c                |  4 +---
 src/vz/vz_driver.c                    |  2 +-
 tests/qemudomainsnapshotxml2xmltest.c |  2 +-
 8 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index f5ae2ee212..f477b67785 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -359,21 +359,15 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,

     if ((n = virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0)
         goto cleanup;
-    if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_DISKS) {
-        if (n)
-            def->disks = g_new0(virDomainSnapshotDiskDef, n);
-        def->ndisks = n;
-        for (i = 0; i < def->ndisks; i++) {
-            if (virDomainSnapshotDiskDefParseXML(nodes[i], ctxt, &def->disks[i],
-                                                 flags, xmlopt) < 0)
-                goto cleanup;
-        }
-        VIR_FREE(nodes);
-    } else if (n) {
-        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
-                       _("unable to handle disk requests in snapshot"));
-        goto cleanup;
+    if (n)
+        def->disks = g_new0(virDomainSnapshotDiskDef, n);
+    def->ndisks = n;
+    for (i = 0; i < def->ndisks; i++) {
+        if (virDomainSnapshotDiskDefParseXML(nodes[i], ctxt, &def->disks[i],
+                                             flags, xmlopt) < 0)
+            goto cleanup;
     }
+    VIR_FREE(nodes);

     if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL) {
         if (!current) {
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index b7e0d441ff..8823af1ac1 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -84,10 +84,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSnapshotDef, virObjectUnref);

 typedef enum {
     VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE = 1 << 0,
-    VIR_DOMAIN_SNAPSHOT_PARSE_DISKS    = 1 << 1,
-    VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL = 1 << 2,
-    VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE  = 1 << 3,
-    VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE = 1 << 4,
+    VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL = 1 << 1,
+    VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE  = 1 << 2,
+    VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE = 1 << 3,
 } virDomainSnapshotParseFlags;

 typedef enum {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c1b3bd8536..de7d2b93b9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -347,7 +347,6 @@ qemuDomainSnapshotLoad(virDomainObj *vm,
     virDomainMomentObj *current = NULL;
     bool cur;
     unsigned int flags = (VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE |
-                          VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
                           VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL);
     int ret = -1;
     int direrr;
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index c5fc7dcf67..3fb1d3abe0 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1530,7 +1530,7 @@ qemuSnapshotCreateXMLParse(virDomainObj *vm,
                            unsigned int flags)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
-    unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
+    unsigned int parse_flags = 0;

     if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE)
         parse_flags |= VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index da1c6c8f6e..9ceb0b45c8 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -978,7 +978,6 @@ testParseDomainSnapshots(testDriver *privconn,
                                             privconn->xmlopt,
                                             NULL,
                                             &cur,
-                                            VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
                                             VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL |
                                             VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE);
         if (!def)
@@ -8777,7 +8776,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
     virObjectEvent *event = NULL;
     bool update_current = true;
     bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
-    unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
+    unsigned int parse_flags = 0;
     g_autoptr(virDomainSnapshotDef) def = NULL;

     /*
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 36db6e06be..acd18494d3 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -5364,8 +5364,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
     nsresult rc;
     resultCodeUnion result;
     virDomainSnapshotPtr ret = NULL;
-    unsigned int parse_flags = (VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
-                                VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE);
+    unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE;
     g_autoptr(virDomainSnapshotDef) def = NULL;

     if (!data->vboxObj)
@@ -6783,7 +6782,6 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
     }
     def = virDomainSnapshotDefParseString(defXml,
                                           data->xmlopt, NULL, NULL,
-                                          VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
                                           VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE);
     if (!def) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index fdd776282e..2107785ab2 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -2580,7 +2580,7 @@ vzDomainSnapshotCreateXML(virDomainPtr domain,
     virDomainObj *dom;
     struct _vzConn *privconn = domain->conn->privateData;
     struct _vzDriver *driver = privconn->driver;
-    unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
+    unsigned int parse_flags = 0;
     virDomainSnapshotObjList *snapshots = NULL;
     virDomainMomentObj *current;
     bool job = false;
diff --git a/tests/qemudomainsnapshotxml2xmltest.c b/tests/qemudomainsnapshotxml2xmltest.c
index 735d0e21a1..3fa932e755 100644
--- a/tests/qemudomainsnapshotxml2xmltest.c
+++ b/tests/qemudomainsnapshotxml2xmltest.c
@@ -34,7 +34,7 @@ testCompareXMLToXMLFiles(const char *inxml,
     g_autofree char *inXmlData = NULL;
     g_autofree char *outXmlData = NULL;
     g_autofree char *actual = NULL;
-    unsigned int parseflags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
+    unsigned int parseflags = 0;
     unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE;
     bool cur = false;
     g_autoptr(virDomainSnapshotDef) def = NULL;
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux