-----Original Message-----
From: John Ferlan [mailto:jferlan@redhat.com]
Sent: Monday, February 02, 2015 7:52 PM
To: Chen, Hanxiao/陈 晗霄; libvir-list(a)redhat.com
Subject: Re: [libvirt] [PATCH] virsh-volume: add support for --reflink
On 02/01/2015 10:14 PM, Chen Hanxiao wrote:
> add support for --reflink to specify
> VIR_STORAGE_VOL_CREATE_REFLINK flag.
>
> Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
> ---
> tools/virsh-volume.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
What about the man page (virsh.pod) to describe --reflink?
I'll add a man-page patch and resend it.
Thanks,
- Chen
> diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
> index d585ee2..db94154 100644
> --- a/tools/virsh-volume.c
> +++ b/tools/virsh-volume.c
> @@ -204,6 +204,7 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
>
> if (vshCommandOptBool(cmd, "prealloc-metadata"))
> flags |= VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
> +
> if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
> return false;
>
> @@ -378,6 +379,7 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd)
>
> if (vshCommandOptBool(cmd, "prealloc-metadata"))
> flags |= VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
> +
> if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
> return false;
>
> @@ -441,6 +443,10 @@ static const vshCmdOptDef opts_vol_create_from[] = {
> .type = VSH_OT_BOOL,
> .help = N_("preallocate metadata (for qcow2 instead of full
allocation)")
> },
> + {.name = "reflink",
> + .type = VSH_OT_BOOL,
> + .help = N_("use btrfs COW lightweight copy")
> + },
> {.name = NULL}
> };
>
> @@ -460,6 +466,9 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd)
> if (vshCommandOptBool(cmd, "prealloc-metadata"))
> flags |= VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
>
> + if (vshCommandOptBool(cmd, "reflink"))
> + flags |= VIR_STORAGE_VOL_CREATE_REFLINK;
> +
> if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
> goto cleanup;
>
> @@ -554,6 +563,10 @@ static const vshCmdOptDef opts_vol_clone[] = {
> .type = VSH_OT_BOOL,
> .help = N_("preallocate metadata (for qcow2 instead of full
allocation)")
> },
> + {.name = "reflink",
> + .type = VSH_OT_BOOL,
> + .help = N_("use btrfs COW lightweight copy")
> + },
> {.name = NULL}
> };
>
> @@ -574,6 +587,9 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
> if (vshCommandOptBool(cmd, "prealloc-metadata"))
> flags |= VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
>
> + if (vshCommandOptBool(cmd, "reflink"))
> + flags |= VIR_STORAGE_VOL_CREATE_REFLINK;
> +
> origpool = virStoragePoolLookupByVolume(origvol);
> if (!origpool) {
> vshError(ctl, "%s", _("failed to get parent pool"));
>