[libvirt PATCH 16/20] qemu_snapshot: don't allow creating external snapshot after reverting

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

 



This would allow creating new branch in the external snapshot history
which we currently don't support.

The issue with branching the external snapshot history is that deleting
some snapshot would require calling block-stream instead of
block-commit which is currently not implemented.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_snapshot.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 513bcb5a86..95297cfe6a 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -665,6 +665,8 @@ qemuSnapshotPrepare(virDomainObj *vm,
     bool found_internal = false;
     bool forbid_internal = false;
     int external = 0;
+    virDomainMomentObj *curSnap = NULL;
+    virDomainSnapshotDef *curDef = NULL;
 
     for (i = 0; i < def->ndisks; i++) {
         virDomainSnapshotDiskDef *disk = &def->disks[i];
@@ -801,6 +803,16 @@ qemuSnapshotPrepare(virDomainObj *vm,
         return -1;
     }
 
+    curSnap = virDomainSnapshotGetCurrent(vm->snapshots);
+    if (curSnap)
+        curDef = virDomainSnapshotObjGetDef(curSnap);
+
+    if (curDef && curDef->revertdisks) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("creating external snapshot after reverting to not last snapshot is not supported"));
+        return -1;
+    }
+
     /* Alter flags to let later users know what we learned.  */
     if (external && !active)
         *flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY;
-- 
2.39.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