virt-manager/virtman-allow-other-disk-formats.patch

49 lines
2.1 KiB
Diff

Reference: bsc#938942
Allow something other than qcow2 to be selected as the initial boot disk
from the 'Customize configuration before install' screen. This is valid
only when the disk has not yet been created.
Index: virt-manager-1.2.1/virtManager/details.py
===================================================================
--- virt-manager-1.2.1.orig/virtManager/details.py
+++ virt-manager-1.2.1/virtManager/details.py
@@ -1830,7 +1830,13 @@ class vmmDetails(vmmGObjectUI):
self.enable_apply(EDIT_BOOTORDER)
def disk_format_changed(self, ignore):
- self.widget("disk-format-warn").show()
+ # Allow changing the disk format if disk hasn't yet been created
+ disk = self.get_hw_selection(HW_LIST_COL_DEVICE)
+ show_warn = (disk and \
+ virtinst.VirtualDisk.path_definitely_exists(disk.conn, disk.path)) and not \
+ self.is_customize_dialog
+ if show_warn:
+ self.widget("disk-format-warn").show()
self.enable_apply(EDIT_DISK_FORMAT)
# IO Tuning
@@ -2694,10 +2700,22 @@ class vmmDetails(vmmGObjectUI):
iotune_wbs = (disk.iotune_wbs or 0) / 1024
iotune_wis = (disk.iotune_wis or 0)
- show_format = (not self.is_customize_dialog or
+ show_format = (not self.is_customize_dialog or not
virtinst.VirtualDisk.path_definitely_exists(
disk.conn, disk.path))
+ # If customizing and disk doesn't exist, allow format type to change
+ if show_format and self.is_customize_dialog:
+ fmt = uiutil.get_list_selection(self.widget("disk-format"))
+ guest = self.vm.get_backend()
+ if guest and fmt:
+ for d in guest.get_devices("disk"):
+ if d.path == disk.path:
+ dvol = d.get_vol_install()
+ if fmt in dvol.list_formats():
+ dvol.format = fmt
+ break
+
size = _("Unknown")
if not path:
size = "-"