[PATCH 2/2] qemuBlockJobProcessEventCompletedPull: Add backingStore terminators if base is NULL

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

 



When doing a blockpull with NULL base the full contents of the disk are
pulled into the topmost image which then becomes fullu self-contained.

qemuBlockJobProcessEventCompletedPull doesn't install the backing chain
terminators though, although it's guaranteed that there will be no
backing chain behind disk->src.

Add the terminators for completness and for disabling backing chain
detection on further boots.

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

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index d708fd18fd..d2a769136d 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -992,6 +992,7 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver,
                                       qemuBlockJobDataPtr job,
                                       qemuDomainAsyncJob asyncJob)
 {
+    virStorageSource *base = NULL;
     virStorageSourcePtr baseparent = NULL;
     virDomainDiskDefPtr cfgdisk = NULL;
     virStorageSourcePtr cfgbase = NULL;
@@ -1015,8 +1016,11 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver,
         return;

     if (job->data.pull.base) {
+        base = job->data.pull.base;
+
         if (cfgdisk)
             cfgbase = cfgdisk->src->backingStore;
+
         for (n = job->disk->src->backingStore; n && n != job->data.pull.base; n = n->backingStore) {
             /* find the image on top of 'base' */

@@ -1027,10 +1031,17 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver,

             baseparent = n;
         }
+    } else {
+        /* create terminators for the chain; since we are pulling everything
+         * into the top image the chain is automatically considered terminated */
+        base = virStorageSourceNew();
+
+        if (cfgdisk)
+            cfgbase = virStorageSourceNew();
     }

     tmp = job->disk->src->backingStore;
-    job->disk->src->backingStore = job->data.pull.base;
+    job->disk->src->backingStore = base;
     if (baseparent)
         baseparent->backingStore = NULL;
     qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, tmp);
-- 
2.30.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