[PATCH 8/9] conf: snapshot: support persistent config on redefine

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

 



This patch just adds basic checks for persistent domain config
on snapshot metadata redefine. It also lets use previous version
of config if it exists in previous version of metadata and
not explicitly specified in new one just as in case of top level
config.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/conf/snapshot_conf.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index fa1cd6b..b003a07 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -1315,6 +1315,22 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
         goto cleanup;
     }
 
+    if (def->persistDom &&
+        memcmp(def->persistDom->uuid, domain->uuid, VIR_UUID_BUFLEN)) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("persistent definition for snapshot %s must use uuid %s"),
+                       def->name, uuidstr);
+        goto cleanup;
+    }
+
+    if (def->persistDom &&
+        STRNEQ(def->persistDom->name, domain->name)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("persistent definition for snapshot %s must use name %s"),
+                       def->name, domain->name);
+        goto cleanup;
+    }
+
     other = virDomainSnapshotFindByName(vm->snapshots, def->name);
     if (other) {
         if ((other->def->state == VIR_DOMAIN_RUNNING ||
@@ -1349,6 +1365,11 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
             }
         }
 
+        if (other->def->persistDom && !def->persistDom) {
+            def->persistDom = other->def->persistDom;
+            other->def->persistDom = NULL;
+        }
+
         if (def->dom) {
             if (def->state == VIR_DOMAIN_DISK_SNAPSHOT ||
                 virDomainSnapshotDefIsExternal(def)) {
@@ -1363,6 +1384,10 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
                     other->def->dom = def->dom;
                     def->dom = NULL;
                 }
+                if (def->persistDom && !other->def->persistDom) {
+                    other->def->persistDom = def->persistDom;
+                    def->persistDom = NULL;
+                }
                 goto cleanup;
             }
         }
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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