[libvirt RFC 24/24] qemu_snapshot: allow deletion of external snapshot with internal snapshot children

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

 



---

Just example how we could support this specific use-case where snapshot
in question is external and all children are only internal. But I would
rather drop this patch and in the following patch series drop support
for both children flags completely as users or management applications
can to that themselves.

 src/qemu/qemu_snapshot.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 29d147f834..092bec6cc2 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2835,6 +2835,7 @@ static int
 qemuSnapshotDeleteChildren(virDomainObj *vm,
                            virDomainMomentObj *snap,
                            virQEMUDriver *driver,
+                           GPtrArray *externalData,
                            bool metadata_only,
                            unsigned int flags)
 {
@@ -2850,7 +2851,7 @@ qemuSnapshotDeleteChildren(virDomainObj *vm,
         return -1;
 
     if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) {
-        return qemuSnapshotDeleteSingle(vm, snap, driver, NULL, metadata_only);
+        return qemuSnapshotDeleteSingle(vm, snap, driver, externalData, metadata_only);
     }
 
     return 0;
@@ -2906,13 +2907,6 @@ qemuSnapshotDeleteValidate(virDomainMomentObj *snap,
         return -1;
     }
 
-    if (virDomainSnapshotIsExternal(snap) &&
-        (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("deletion of external disk snapshot with internal children disk snapshots not supported"));
-        return -1;
-    }
-
     return 0;
 }
 
@@ -2943,9 +2937,7 @@ qemuSnapshotDelete(virDomainObj *vm,
         if (qemuSnapshotDeleteValidate(snap, flags) < 0)
             goto endjob;
 
-        if (virDomainSnapshotIsExternal(snap) &&
-            !(flags & (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
-                       VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY))) {
+        if (virDomainSnapshotIsExternal(snap)) {
             if (!virDomainObjIsActive(vm)) {
                 if (qemuProcessStart(NULL, driver, vm, NULL, VIR_ASYNC_JOB_NONE,
                                      NULL, -1, NULL, NULL,
@@ -2965,7 +2957,8 @@ qemuSnapshotDelete(virDomainObj *vm,
 
     if (flags & (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
                  VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)) {
-        ret = qemuSnapshotDeleteChildren(vm, snap, driver, metadata_only, flags);
+        ret = qemuSnapshotDeleteChildren(vm, snap, driver, externalData,
+                                         metadata_only, flags);
     } else {
         ret = qemuSnapshotDeleteSingle(vm, snap, driver, externalData, metadata_only);
     }
-- 
2.37.2




[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