[virt-tools-list] [virt-manager PATCH 1/3] virt-clone: introduce --reflink for btrfs COW copy
Chen, Hanxiao
chenhanxiao at cn.fujitsu.com
Thu Jan 29 10:03:00 UTC 2015
> -----Original Message-----
> From: Cole Robinson [mailto:crobinso at redhat.com]
> Sent: Thursday, January 29, 2015 3:02 AM
> To: Chen, Hanxiao/陈 晗霄; virt-tools-list at redhat.com
> Subject: Re: [virt-tools-list] [virt-manager PATCH 1/3] virt-clone: introduce
> --reflink for btrfs COW copy
>
> On 01/27/2015 11:12 PM, Chen Hanxiao wrote:
> > libvirt commit 466b29c8c3593b2dac92acad5dd8ec923c428259
> > introduce btrfsCloneFile() for COW copy.
> > This patch add support for --reflink option for virt-clone.
> > When specified --reflink, if src and dst images all on a btrfs
> > fs, we could take advantage of COW copy.
> > If not, error out.
> >
>
> Rather than pass reflink to disk.setup() and have to alter the call in a ton
> of places, I'd recommend:
>
> - Add a property StorageVolume.reflink. If it's set, use the REFLINK flag when
> creating the volume.
> - Add a property Cloner.reflink
> - Cloner should also get this:
>
> diff --git a/virtinst/cloner.py b/virtinst/cloner.py
> index 5e76413..9ccb97a 100644
> --- a/virtinst/cloner.py
> +++ b/virtinst/cloner.py
> @@ -343,6 +343,7 @@ class Cloner(object):
> clone_vol_install.input_vol = orig_disk.get_vol_object()
> vol_install = clone_vol_install
>
> + vol_install.reflink = self.reflink
> clone_disk.set_vol_install(vol_install)
> elif orig_disk.path:
> clone_disk.set_local_disk_to_clone(orig_disk, self.clone_sparse)
>
>
> That's simpler, and closer to existing code conventions.
>
Thanks for the comments, that's a much better solution.
I'll send a v2 patch soon.
Regards,
- Chen
More information about the virt-tools-list
mailing list