2d558399a0
57db4185-virt-clone-fix-force-copy-of-empty-cdrom-or-floppy-disk.patch 26a433fc-virtManager-clone-check-which-storage-pools-supports-volume-cloning.patch 4f66c423-cloner-Handle-nonsparse-for-qcow2-images.patch a02fc0d0-virtManager-clone-build-default-clone-path-if-we-know-how.patch 1856c1fa-support-Fix-minimum-version-check.patch 74bbc3db-urldetect-Check-also-for-treeinfo.patch 708af01c-osdict-Add-supports_virtioinput.patch f23b01be-guest-Add-VirtIO-input-devices-to-s390x-guests-with-graphics.patch 7afbb90b-virt-xml-Handle-VM-names-that-look-like-id-uuid.patch a0ca387a-cli-Fix-pool-default-when-path-belongs-to-another-pool.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=465
58 lines
2.1 KiB
Diff
58 lines
2.1 KiB
Diff
Subject: cloner: Handle --nonsparse for qcow2 images (bz 1675743)
|
|
From: Cole Robinson crobinso@redhat.com Mon Mar 4 13:20:51 2019 -0500
|
|
Date: Mon Mar 4 14:04:34 2019 -0500:
|
|
Git: 4f66c423f7833e270b61536d53a0772ce1242abc
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1675743
|
|
|
|
diff --git a/tests/clone-xml/cross-pool-disks-out.xml b/tests/clone-xml/cross-pool-disks-out.xml
|
|
index 260f321c..6093e240 100644
|
|
--- a/tests/clone-xml/cross-pool-disks-out.xml
|
|
+++ b/tests/clone-xml/cross-pool-disks-out.xml
|
|
@@ -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>
|
|
diff --git a/virtinst/cloner.py b/virtinst/cloner.py
|
|
index ba89a26f..b29027e3 100644
|
|
--- a/virtinst/cloner.py
|
|
+++ b/virtinst/cloner.py
|
|
@@ -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:
|
|
diff --git a/virtinst/storage.py b/virtinst/storage.py
|
|
index 3249c454..2e92c5d6 100644
|
|
--- a/virtinst/storage.py
|
|
+++ b/virtinst/storage.py
|
|
@@ -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,
|