a41c76
From 3959e3ef365e95ee4f5e68eb1ab189d6e8cb189d Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <3959e3ef365e95ee4f5e68eb1ab189d6e8cb189d@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 4 Feb 2020 15:07:38 +0100
a41c76
Subject: [PATCH] qemu: Fix value of 'device' argument for blockdev-mirror
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
When using blockdev configurations the 'device' argument of
a41c76
'blockdev-mirror' must correspond to the topmost node in the block node
a41c76
graph. Libvirt didn't do this properly in case when 'copy_on_read'
a41c76
option was enabled on the disk.
a41c76
a41c76
Use qemuDomainDiskGetTopNodename to fix it for the blockdev-mirror calls
a41c76
in qemuDomainBlockCopy and the non-shared-storage migration.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Eric Blake <eblake@redhat.com>
a41c76
(cherry picked from commit e3137539a9c4af25ab085506d5467ec0847b0ecc)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1792195
a41c76
Message-Id: <1b3e7edbec684588424e78ed5009bfcb0ce7e183.1580824112.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_driver.c    | 2 +-
a41c76
 src/qemu/qemu_migration.c | 2 +-
a41c76
 2 files changed, 2 insertions(+), 2 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
a41c76
index 83f24d7231..6a209ccb75 100644
a41c76
--- a/src/qemu/qemu_driver.c
a41c76
+++ b/src/qemu/qemu_driver.c
a41c76
@@ -18388,7 +18388,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
a41c76
 
a41c76
     if (blockdev) {
a41c76
         ret = qemuMonitorBlockdevMirror(priv->mon, job->name, true,
a41c76
-                                        disk->src->nodeformat,
a41c76
+                                        qemuDomainDiskGetTopNodename(disk),
a41c76
                                         mirror->nodeformat, bandwidth,
a41c76
                                         granularity, buf_size, mirror_shallow);
a41c76
     } else {
a41c76
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
a41c76
index b56ccbdc3c..03f058051d 100644
a41c76
--- a/src/qemu/qemu_migration.c
a41c76
+++ b/src/qemu/qemu_migration.c
a41c76
@@ -931,7 +931,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver,
a41c76
 
a41c76
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
a41c76
         jobname = diskAlias;
a41c76
-        sourcename = disk->src->nodeformat;
a41c76
+        sourcename = qemuDomainDiskGetTopNodename(disk);
a41c76
         persistjob = true;
a41c76
     } else {
a41c76
         jobname = NULL;
a41c76
-- 
a41c76
2.25.0
a41c76