[libvirt] [PATCH] blockcommit: document semantics of committing active layer

Peter Krempa pkrempa at redhat.com
Sun May 18 15:27:06 UTC 2014


On 05/16/14 22:17, Eric Blake wrote:

...
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> 
> This patch should probably be backported, even if later patches
> in the series are not, so that users avoid getting hung.
> 
>  include/libvirt/libvirt.h.in | 12 ++++++----
>  src/libvirt.c                | 55 +++++++++++++++++++++++++++++---------------
>  src/qemu/qemu_driver.c       |  9 ++++++++
>  3 files changed, 54 insertions(+), 22 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 260c971..127de11 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in

> @@ -2588,6 +2590,8 @@ typedef enum {
>      VIR_DOMAIN_BLOCK_COMMIT_DELETE  = 1 << 1, /* Delete any files that are now
>                                                   invalid after their contents
>                                                   have been committed */
> +    VIR_DOMAIN_BLOCK_COMMIT_ACTIVE  = 1 << 2, /* Allow a two-phase commit when
> +                                                 top is the active layer */

[1] ...

>  } virDomainBlockCommitFlags;
> 
>  int virDomainBlockCommit(virDomainPtr dom, const char *disk, const char *base,

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 55b4755..75c59e0 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c

...

> @@ -15423,6 +15424,14 @@ qemuDomainBlockCommit(virDomainPtr dom,
>                                                       &top_parent)))
>          goto endjob;
> 
> +    /* XXX Should we auto-pivot when COMMIT_ACTIVE is not specified? */
> +    if (topSource == &disk->src && !(flags & VIR_DOMAIN_BLOCK_COPY_ACTIVE)) {

This fails to compile as VIR_DOMAIN_BLOCK_COPY_ACTIVE differs from the
one declared at [1].

> +        virReportError(VIR_ERR_INVALID_ARG,
> +                       _("commit of '%s' active layer requires active flag"),
> +                       disk->dst);
> +        goto endjob;
> +    }
> +
>      if (!topSource->backingStore) {
>          virReportError(VIR_ERR_INVALID_ARG,
>                         _("top '%s' in chain for '%s' has no backing file"),
> 

I'll do a full review on Monday.

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140518/4cf2d6f2/attachment-0001.sig>


More information about the libvir-list mailing list