[PATCH v2 10/13] qemu: enable basic qcow2 data-file feature support

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

 



- propogate data-file to cmdline
- determine data-file within disk chain
- enable live disk insertion

Signed-off-by: Nikolai Barybin <nikolai.barybin@xxxxxxxxxxxxx>
---
 src/qemu/qemu_block.c   |  7 +++++++
 src/qemu/qemu_command.c |  5 +++++
 src/qemu/qemu_domain.c  | 14 +++++++++++++-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 6e90bae9f2..5d2a638a56 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1301,6 +1301,13 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorageSource *src,
                               NULL) < 0)
         return -1;
 
+    if (src->dataFileStore) {
+        if (virJSONValueObjectAdd(&props,
+                                  "s:data-file", src->dataFileStore->nodenameformat,
+                                  NULL) < 0)
+        return -1;
+    }
+
     return 0;
 }
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1b992d8eed..503374f470 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -11178,6 +11178,11 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSource *top)
         if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n,
                                                                 n->backingStore) < 0)
             return NULL;
+
+        if (n->dataFileStore &&
+            qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n->dataFileStore,
+                                                                n->dataFileStore->backingStore) < 0)
+            return NULL;
     }
 
     return g_steal_pointer(&data);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 86362393e2..0555bc8cfd 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8102,9 +8102,17 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver,
                                     true) < 0)
         return -1;
 
+    if (src->dataFileStore &&
+        qemuDomainPrepareStorageSource(src->dataFileStore, vm, disk, cfg) < 0)
+        return -1;
+
     for (n = src->backingStore; virStorageSourceIsBacking(n); n = n->backingStore) {
         if (qemuDomainPrepareStorageSource(n, vm, disk, cfg) < 0)
             return -1;
+
+        if (n->dataFileStore &&
+            qemuDomainPrepareStorageSource(n->dataFileStore, vm, disk, cfg) < 0)
+            return -1;
     }
 
     if (qemuDomainStorageSourceValidateDepth(disksrc, 0, disk->dst) < 0)
@@ -11298,7 +11306,7 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDef *disk,
         return;
 
     /* transfer properties valid only for the top level image */
-    if (src == disk->src)
+    if (src == disk->src || src == disk->src->dataFileStore)
         src->detect_zeroes = disk->detect_zeroes;
 
     /* transfer properties valid for the full chain */
@@ -11527,6 +11535,10 @@ qemuDomainPrepareDiskSourceBlockdev(virDomainDiskDef *disk,
     for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
         if (qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0)
             return -1;
+
+        if (n->dataFileStore &&
+            qemuDomainPrepareStorageSourceBlockdev(disk, n->dataFileStore, priv, cfg) < 0)
+            return -1;
     }
 
     return 0;
-- 
2.43.5



[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