[PATCH 6/9] qemu: blockjob: Esure that persistent definition source does not copy irrelevant data

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

 



Since we copy everything from the original storage source including some
runtime data which are not relevant for the config we should clear them.

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

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index f9e79db131..f5574b7e03 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -433,6 +433,25 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver,
     virObjectEventStateQueue(driver->domainEventState, event2);
 }

+/**
+ * qemuBlockJobCleanStorageSourceRuntime:
+ * @src: storage source to clean from runtime data
+ *
+ * Remove all runtime related data from the storage source.
+ */
+static void
+qemuBlockJobCleanStorageSourceRuntime(virStorageSourcePtr src)
+{
+    src->id = 0;
+    src->detected = false;
+    VIR_FREE(src->relPath);
+    VIR_FREE(src->backingStoreRaw);
+    VIR_FREE(src->nodestorage);
+    VIR_FREE(src->nodeformat);
+    VIR_FREE(src->tlsAlias);
+    VIR_FREE(src->tlsCertdir);
+}
+

 /**
  * qemuBlockJobRewriteConfigDiskSource:
@@ -467,6 +486,8 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm,
         return;
     }

+    qemuBlockJobCleanStorageSourceRuntime(copy);
+
     virObjectUnref(persistDisk->src);
     VIR_STEAL_PTR(persistDisk->src, copy);
 }
-- 
2.21.0

--
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