[PATCH 4/4] qemu: Fix value of 'device' argument for block-commit

Peter Krempa posted 4 patches 6 years ago
[PATCH 4/4] qemu: Fix value of 'device' argument for block-commit
Posted by Peter Krempa 6 years ago
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>
---
 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 9e2a94306c..0b23c747ce 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18813,7 +18813,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.24.1

Re: [PATCH 4/4] qemu: Fix value of 'device' argument for block-commit
Posted by Eric Blake 6 years ago
On 1/23/20 9:57 AM, Peter Krempa wrote:
> 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>
> ---
>   src/qemu/qemu_driver.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 9e2a94306c..0b23c747ce 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -18813,7 +18813,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;
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org