render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 3959e3ef365e95ee4f5e68eb1ab189d6e8cb189d Mon Sep 17 00:00:00 2001
Message-Id: <3959e3ef365e95ee4f5e68eb1ab189d6e8cb189d@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:07:38 +0100
Subject: [PATCH] qemu: Fix value of 'device' argument for blockdev-mirror
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When using blockdev configurations the 'device' argument of
'blockdev-mirror' must correspond to the topmost node in the block node
graph. Libvirt didn't do this properly in case when 'copy_on_read'
option was enabled on the disk.

Use qemuDomainDiskGetTopNodename to fix it for the blockdev-mirror calls
in qemuDomainBlockCopy and the non-shared-storage migration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit e3137539a9c4af25ab085506d5467ec0847b0ecc)

https://bugzilla.redhat.com/show_bug.cgi?id=1792195
Message-Id: <1b3e7edbec684588424e78ed5009bfcb0ce7e183.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_driver.c    | 2 +-
 src/qemu/qemu_migration.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 83f24d7231..6a209ccb75 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18388,7 +18388,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
 
     if (blockdev) {
         ret = qemuMonitorBlockdevMirror(priv->mon, job->name, true,
-                                        disk->src->nodeformat,
+                                        qemuDomainDiskGetTopNodename(disk),
                                         mirror->nodeformat, bandwidth,
                                         granularity, buf_size, mirror_shallow);
     } else {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index b56ccbdc3c..03f058051d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -931,7 +931,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver,
 
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
         jobname = diskAlias;
-        sourcename = disk->src->nodeformat;
+        sourcename = qemuDomainDiskGetTopNodename(disk);
         persistjob = true;
     } else {
         jobname = NULL;
-- 
2.25.0