[libvirt PATCH 5/7] qemu_snapshot: fix reverting external snapshot when not all disks are included

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

 



We need to skip all disks that have snapshot type other than 'external'.

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 d943281e35..ff85d56572 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2058,6 +2058,9 @@ qemuSnapshotRevertExternalPrepare(virDomainObj *vm,
         virDomainSnapshotDiskDef *snapdisk = &tmpsnapdef->disks[i];
         virDomainDiskDef *domdisk = domdef->disks[i];
 
+        if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+            continue;
+
         if (qemuSnapshotPrepareDiskExternal(domdisk, snapdisk, active, false) < 0)
             return -1;
     }
@@ -2098,6 +2101,9 @@ qemuSnapshotRevertExternalActive(virDomainObj *vm,
         return -1;
 
     for (i = 0; i < tmpsnapdef->ndisks; i++) {
+        if (tmpsnapdef->disks[i].snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+            continue;
+
         if (qemuSnapshotDiskPrepareOne(snapctxt,
                                        vm->def->disks[i],
                                        tmpsnapdef->disks + i,
@@ -2188,6 +2194,9 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm,
         for (i = 0; i < curdef->nrevertdisks; i++) {
             virDomainSnapshotDiskDef *snapdisk = &(curdef->revertdisks[i]);
 
+            if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+                continue;
+
             if (virStorageSourceInit(snapdisk->src) < 0 ||
                 virStorageSourceUnlink(snapdisk->src) < 0) {
                 VIR_WARN("Failed to remove snapshot image '%s'",
@@ -2203,6 +2212,9 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm,
         for (i = 0; i < curdef->ndisks; i++) {
             virDomainSnapshotDiskDef *snapdisk = &(curdef->disks[i]);
 
+            if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+                continue;
+
             if (virStorageSourceInit(snapdisk->src) < 0 ||
                 virStorageSourceUnlink(snapdisk->src) < 0) {
                 VIR_WARN("Failed to remove snapshot image '%s'",
-- 
2.41.0




[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