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

Giuseppe Scrivano gscrivan at redhat.com
Wed Jan 28 09:21:00 UTC 2015


Chen Hanxiao <chenhanxiao at cn.fujitsu.com> writes:

> 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.
>
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
>  virt-clone              |  4 +++-
>  virtinst/cloner.py      |  5 +++--
>  virtinst/devicedisk.py  |  4 ++--
>  virtinst/diskbackend.py | 14 ++++++++------
>  virtinst/storage.py     |  5 ++++-
>  5 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/virtinst/storage.py b/virtinst/storage.py
> index bdbd064..fe7f9cb 100644
> --- a/virtinst/storage.py
> +++ b/virtinst/storage.py
> @@ -723,7 +723,7 @@ class StorageVolume(_StorageObject):
>                                 "setting allocation equal to capacity"))
>                  self.allocation = self.capacity
>  
> -    def install(self, meter=None):
> +    def install(self, meter=None, reflink=None):
>          """
>          Build and install storage volume from xml
>          """
> @@ -748,6 +748,9 @@ class StorageVolume(_StorageObject):
>                  self.conn.SUPPORT_POOL_METADATA_PREALLOC, self.pool)):
>              createflags |= libvirt.VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
>  
> +        if reflink:
> +            cloneflags |= libvirt.VIR_STORAGE_VOL_CREATE_REFLINK
> +

you should check that the VIR_STORAGE_VOL_CREATE_REFLINK flag is defined
before using it.  You can do this in support.py.

Thanks,
Giuseppe




More information about the virt-tools-list mailing list