[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:05:21 UTC 2015



> -----Original Message-----
> From: Giuseppe Scrivano [mailto:gscrivan at redhat.com]
> Sent: Wednesday, January 28, 2015 5:21 PM
> To: Chen, Hanxiao/陈 晗霄
> Cc: virt-tools-list at redhat.com
> Subject: Re: [virt-tools-list] [virt-manager PATCH 1/3] virt-clone: introduce
> --reflink for btrfs COW copy
> 
> 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.
> 

Right, thanks for your remind.

Regards,

-Chen




More information about the virt-tools-list mailing list