[libvirt] [PATCH] qemu: driver: Allow passing disk target as top image with block commit

Peter Krempa posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/ed61e0b368859b25beb5259f84edd4910cd5218f.1495034410.git.pkrempa@redhat.com
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] qemu: driver: Allow passing disk target as top image with block commit
Posted by Peter Krempa 6 years, 11 months ago
Since we allow active layer block commit the users are allowed to commit
the top of the chain (e.g. vda) into the backing image. The API would
not accept that parameter, as it tried to look up the image in the
backing chain.

Add the ability to use the top level image target name explicitly as the
top image of the block commit operation.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1451394
---
 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 1c4873e48..36d8a701a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16942,7 +16942,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
     if (qemuDomainDiskBlockJobIsActive(disk))
         goto endjob;

-    if (!top)
+    if (!top || STREQ(top, disk->dst))
         topSource = disk->src;
     else if (virStorageFileParseChainIndex(disk->dst, top, &topIndex) < 0 ||
              !(topSource = virStorageFileChainLookup(disk->src, NULL,
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: driver: Allow passing disk target as top image with block commit
Posted by Eric Blake 6 years, 11 months ago
On 05/17/2017 10:20 AM, Peter Krempa wrote:
> Since we allow active layer block commit the users are allowed to commit
> the top of the chain (e.g. vda) into the backing image. The API would
> not accept that parameter, as it tried to look up the image in the
> backing chain.
> 
> Add the ability to use the top level image target name explicitly as the
> top image of the block commit operation.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1451394
> ---
>  src/qemu/qemu_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

ACK

> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 1c4873e48..36d8a701a 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -16942,7 +16942,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
>      if (qemuDomainDiskBlockJobIsActive(disk))
>          goto endjob;
> 
> -    if (!top)
> +    if (!top || STREQ(top, disk->dst))
>          topSource = disk->src;
>      else if (virStorageFileParseChainIndex(disk->dst, top, &topIndex) < 0 ||
>               !(topSource = virStorageFileChainLookup(disk->src, NULL,
> 

-- 
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
Re: [libvirt] [PATCH] qemu: driver: Allow passing disk target as top image with block commit
Posted by Peter Krempa 6 years, 11 months ago
On Wed, May 17, 2017 at 10:37:22 -0500, Eric Blake wrote:
> On 05/17/2017 10:20 AM, Peter Krempa wrote:
> > Since we allow active layer block commit the users are allowed to commit
> > the top of the chain (e.g. vda) into the backing image. The API would
> > not accept that parameter, as it tried to look up the image in the
> > backing chain.
> > 
> > Add the ability to use the top level image target name explicitly as the
> > top image of the block commit operation.
> > 
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1451394
> > ---
> >  src/qemu/qemu_driver.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> ACK

Pushed; Thanks for the instant review.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list