Blob Blame History Raw
From 287db7fde2511199afa62af511acff4b00607c11 Mon Sep 17 00:00:00 2001
Message-Id: <287db7fde2511199afa62af511acff4b00607c11@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:07:39 +0100
Subject: [PATCH] qemu: Fix value of 'device' argument for block-commit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When using blockdev configurations the 'device' argument of
'blockdev-commit' 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 when calling block-commit.

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

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6a209ccb75..e651c9e819 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18815,7 +18815,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
         jobname = job->name;
         nodetop = topSource->nodeformat;
         nodebase = baseSource->nodeformat;
-        device = disk->src->nodeformat;
+        device = qemuDomainDiskGetTopNodename(disk);
         if (!backingPath && top_parent &&
             !(backingPath = qemuBlockGetBackingStoreString(baseSource)))
             goto endjob;
-- 
2.25.0