[libvirt PATCH 5/6] qemu: block: 'top' support in construction of QMP block-stream

Pavel Mores pmores at redhat.com
Wed Mar 4 10:12:39 UTC 2020


This commit only handles submission of block-stream command.  Since
block-stream is a job, we'll need to handle its completion as well
in an upcoming commit.

Signed-off-by: Pavel Mores <pmores at redhat.com>
---
 src/qemu/qemu_driver.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b3f97bf593..b1ffc68e6b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17410,7 +17410,15 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm,
                 !(backingPath = qemuBlockGetBackingStoreString(baseSource)))
                 goto endjob;
         }
-        device = disk->src->nodeformat;
+        if (topSource) {
+            device = topSource->nodeformat;
+            if (qemuDomainStorageSourceAccessAllow(driver, vm, topSource, false, false) < 0) {
+                virReportError(VIR_ERR_ACCESS_DENIED, "can't make 'top' writable");
+                goto endjob;
+            }
+        } else {
+            device = disk->src->nodeformat;
+        }
     } else {
         device = job->name;
     }
@@ -18171,7 +18179,7 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base,
     /* For normal rebase (enhanced blockpull), the common code handles
      * everything, including vm cleanup. */
     if (!(flags & VIR_DOMAIN_BLOCK_REBASE_COPY))
-        return qemuDomainBlockPullCommon(vm, path, base, NULL, bandwidth, flags);
+        return qemuDomainBlockPullCommon(vm, path, base, top, bandwidth, flags);
 
     /* If we got here, we are doing a block copy rebase. */
     if (!(dest = virStorageSourceNew()))
@@ -18302,8 +18310,8 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
 
 
 static int
-qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
-                    unsigned int flags)
+qemuDomainBlockPull(virDomainPtr dom, const char *path,
+                    unsigned long bandwidth, unsigned int flags)
 {
     virDomainObjPtr vm;
     virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1);
-- 
2.24.1




More information about the libvir-list mailing list