[libvirt] [PATCHv3 33/36] lib: Introduce flag VIR_DOMAIN_BLOCK_REBASE_RELATIVE

Eric Blake eblake at redhat.com
Tue Jun 3 04:21:47 UTC 2014


On 05/30/2014 02:37 AM, Peter Krempa wrote:
> Introduce flag for the block rebase API to allow the rebase operation to
> leave the chain relatively addressed. Also adds a virsh switch to enable
> this behavior.
> ---
>  include/libvirt/libvirt.h.in |  2 ++
>  tools/virsh-domain.c         | 22 +++++++++++++++++++---
>  tools/virsh.pod              |  4 ++++
>  3 files changed, 25 insertions(+), 3 deletions(-)
> 

Again, missing doc changes in libvirt.c mentioning the flag.


> -        else
> +        if (base) {
> +          if (vshCommandOptBool(cmd, "keep-relative"))
> +              flags |= VIR_DOMAIN_BLOCK_REBASE_RELATIVE;

Why not parse this flag unconditionally, to check that the code has a
sane error path if the flag is present but base was not specified?  In
other words, filtering at the virsh level is too high when it comes to
validating lower levels.

> +    {.name = "keep-relative",
> +     .type = VSH_OT_BOOL,
> +     .help = N_("keep the backing chain relative if it was relatively "
> +                "referenced if it was before")

s/if it was before/before/

> @@ -2091,6 +2100,13 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
>      bool quit = false;
>      int abort_flags = 0;
> 
> +    if (vshCommandOptBool(cmd, "keep-relative") &&
> +        !vshCommandOptBool(cmd, "base")) {
> +        vshError(ctl, "%s", _("--keep-relative is supported only with partial "
> +                              "pull operations with --base specified"));

Again, let the lower level flag this, to prove that error message is sane.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list