[PATCH 5/9] qemuSnapshotForEachQcow2: Handle also NVRAM image for internal snapshots

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

 



The live VM snapshot code already does handle the NVRAM image when it's
in use, so we should also handle it when modifying/creating the
snapshots via qemu-img when inactive.

Add the handling to qemuSnapshotForEachQcow2 which is used for all
inactive operations.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_snapshot.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index f560cf270c..4a17935627 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -347,6 +347,26 @@ qemuSnapshotForEachQcow2(virDomainDef *def,
         }
     }

+    if (def->os.loader && def->os.loader->nvram) {
+        virStorageSource *nvram = def->os.loader->nvram;
+
+        if (virStorageSourceIsLocalStorage(nvram) &&
+            nvram->format == VIR_STORAGE_FILE_QCOW2) {
+            if (qemuSnapshotForEachQcow2One(nvram, op, snap->def->name) < 0) {
+                if (create) {
+                    nrollback = def->ndisks;
+                    virErrorPreserveLast(&orig_err);
+                    goto rollback;
+                } else {
+                    VIR_WARN("failed 'qemu-img snapshot %s' action on NVRAM image",
+                             op);
+                    skipped = true;
+                    virResetLastError();
+                }
+            }
+        }
+    }
+
     return skipped ? 1 : 0;

  rollback:
-- 
2.47.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