[virt-tools-list] [virt-manager PATCH 1/3] virt-clone: introduce --reflink for btrfs COW copy

Cole Robinson crobinso at redhat.com
Wed Jan 28 19:02:17 UTC 2015


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.

- Cole




More information about the virt-tools-list mailing list