mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-27 01:55:20 +03:00
cloner: Handle --nonsparse for qcow2 images (bz 1675743)
https://bugzilla.redhat.com/show_bug.cgi?id=1675743
This commit is contained in:
parent
26a433fc42
commit
4f66c423f7
@ -1,7 +1,7 @@
|
||||
<volume>
|
||||
<name>new1.img</name>
|
||||
<capacity>1000000</capacity>
|
||||
<allocation>50000</allocation>
|
||||
<allocation>1000000</allocation>
|
||||
<target>
|
||||
<format type="qcow2"/>
|
||||
<features>
|
||||
@ -12,7 +12,7 @@
|
||||
<volume>
|
||||
<name>new2.img</name>
|
||||
<capacity>1000000</capacity>
|
||||
<allocation>50000</allocation>
|
||||
<allocation>1000000</allocation>
|
||||
<target>
|
||||
<format type="qcow2"/>
|
||||
<features>
|
||||
|
@ -330,6 +330,8 @@ class Cloner(object):
|
||||
vol_install.input_vol = orig_disk.get_vol_object()
|
||||
vol_install.sync_input_vol(only_format=True)
|
||||
|
||||
if self.clone_sparse:
|
||||
vol_install.allocation = vol_install.capacity
|
||||
vol_install.reflink = self.reflink
|
||||
clone_disk.set_vol_install(vol_install)
|
||||
elif orig_disk.path:
|
||||
|
@ -744,6 +744,10 @@ class StorageVolume(_StorageObject):
|
||||
self.conn.check_support(
|
||||
self.conn.SUPPORT_POOL_METADATA_PREALLOC, self.pool)):
|
||||
createflags |= libvirt.VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
|
||||
if self.capacity == self.allocation:
|
||||
# For cloning, this flag will make libvirt+qemu-img preallocate
|
||||
# the new disk image
|
||||
cloneflags |= libvirt.VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
|
||||
|
||||
if self.reflink:
|
||||
cloneflags |= getattr(libvirt,
|
||||
|
Loading…
Reference in New Issue
Block a user