[libvirt] [PATCH] qemu: blockcopy: Probe image format only with VIR_DOMAIN_BLOCK_COPY_REUSE_EXT

Peter Krempa posted 1 patch 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/e03b01edcaf68352a46cf7d69b948f6cb1edb3e2.1505221251.git.pkrempa@redhat.com
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] qemu: blockcopy: Probe image format only with VIR_DOMAIN_BLOCK_COPY_REUSE_EXT
Posted by Peter Krempa 6 years, 7 months ago
Commit 703abf1d7 changed the logic so that we don't attempt to re-create
the image if it's a block device. This was done by modifying the
'reuse' variable. Unfortunately after modifying it one of the uses was
to infer whether we should probe the disk format. After changes in the
commit mentioned above we would attempt the probe if the target of the
copy is a block device and the format was not provided explicitly rather
than using the format of the disk.

Fix it by explicitly checking whether the user requested a reuse of the
disk rather than the modified boolean flag.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1490826
---
 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 70cdc88e1..23a51359d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16988,7 +16988,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
         goto endjob;

     if (!mirror->format) {
-        if (!reuse) {
+        if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
             mirror->format = disk->src->format;
         } else {
             /* If the user passed the REUSE_EXT flag, then either they
-- 
2.14.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: blockcopy: Probe image format only with VIR_DOMAIN_BLOCK_COPY_REUSE_EXT
Posted by Eric Blake 6 years, 7 months ago
On 09/12/2017 08:00 AM, Peter Krempa wrote:
> Commit 703abf1d7 changed the logic so that we don't attempt to re-create
> the image if it's a block device. This was done by modifying the
> 'reuse' variable. Unfortunately after modifying it one of the uses was
> to infer whether we should probe the disk format. After changes in the
> commit mentioned above we would attempt the probe if the target of the
> copy is a block device and the format was not provided explicitly rather
> than using the format of the disk.
> 
> Fix it by explicitly checking whether the user requested a reuse of the
> disk rather than the modified boolean flag.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1490826
> ---
>  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 70cdc88e1..23a51359d 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -16988,7 +16988,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
>          goto endjob;
> 
>      if (!mirror->format) {
> -        if (!reuse) {
> +        if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
>              mirror->format = disk->src->format;
>          } else {
>              /* If the user passed the REUSE_EXT flag, then either they
> 

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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list