virt-manager/virtinst-set-cache-mode-unsafe-for-install.patch
2020-03-24 20:03:25 +00:00

30 lines
1.3 KiB
Diff

Set cache mode for target installation disk to unsafe for better
performance.
Index: virt-manager-2.2.1/virtinst/install/installer.py
===================================================================
--- virt-manager-2.2.1.orig/virtinst/install/installer.py
+++ virt-manager-2.2.1/virtinst/install/installer.py
@@ -422,11 +422,22 @@ class Installer(object):
guest.memory) = data
def _get_install_xml(self, guest, meter):
+ # At install time set the target disk to 'unsafe' for
+ # better performance if the target is not a block device
+ saved_cache = "None"
+ if guest.devices.disk:
+ target_disk = guest.devices.disk[0]
+ saved_cache = target_disk.driver_cache
+ if target_disk.type != DeviceDisk.TYPE_BLOCK and target_disk.driver_io != "native":
+ target_disk.driver_cache = DeviceDisk.CACHE_MODE_UNSAFE
+
data = self._prepare_get_install_xml(guest)
try:
self._alter_bootconfig(guest)
self._alter_install_resources(guest, meter)
ret = guest.get_xml()
+ if saved_cache != "None":
+ target_disk.driver_cache = saved_cache
return ret
finally:
self._remove_install_cdrom_media(guest)