[libvirt] [PATCHv7 2/4] lib: Introduce flag VIR_DOMAIN_BLOCK_REBASE_RELATIVE

Eric Blake eblake at redhat.com
Mon Jul 7 22:28:13 UTC 2014


On 07/04/2014 05:22 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 |  3 +++
>  src/libvirt.c                |  3 +++
>  tools/virsh-domain.c         | 12 ++++++++++--
>  tools/virsh.pod              |  4 ++++
>  4 files changed, 20 insertions(+), 2 deletions(-)
> 

> +++ b/src/libvirt.c
> @@ -19721,6 +19721,9 @@ virDomainBlockPull(virDomainPtr dom, const char *disk,
>   * exists.  If the job is aborted, a new one can be started later to
>   * resume from the same point.
>   *
> + * If @flags contains VIR_DOMAIN_BLOCK_REBASE_RELATIVE, the name recorded
> + * into the active disk as the location for @base will be kept relative.

in 1/4, you had wording mentioning that the operation will fail if
libvirt cannot infer a relative name.  I think you should copy that
wording here, too.

> +++ b/tools/virsh-domain.c
> @@ -1488,10 +1488,14 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
>      case VSH_CMD_BLOCK_JOB_PULL:
>          if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0)
>              goto cleanup;
> -        if (base)
> -            ret = virDomainBlockRebase(dom, path, base, bandwidth, 0);
> +      if (vshCommandOptBool(cmd, "keep-relative"))
> +          flags |= VIR_DOMAIN_BLOCK_REBASE_RELATIVE;

Indentation looks off.

> +
> +        if (base || flags)
> +            ret = virDomainBlockRebase(dom, path, base, bandwidth, flags);
>          else
>              ret = virDomainBlockPull(dom, path, bandwidth, 0);

ACK with those 2 changes.

-- 
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/20140707/00501e87/attachment-0001.sig>


More information about the libvir-list mailing list