59b2222711
bsc#1192238 [Build58.2][KVM] The latest supported OracleLinux as guest versions are not included anywhere add-missing-oracle-linux-versions.patch - bsc#1188223 - L3: Sles12sp3 DomU won't boot after adding phys hard drive virtinst-xenbus-disk-index-fix.patch - jsc#SLE-21540 Dev: Prefer UEFI when creating new virtual machines. Add a preferences option to allow users to default to UEFI when creating a new VM. Libvirt decides which firmware file to use. virtman-add-firmware-preferences.patch - Renamed patch virtinst-modify-gui-defaults.patch to virtman-modify-gui-defaults.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=551
188 lines
8.9 KiB
Diff
188 lines
8.9 KiB
Diff
From d30b50139e60afc6e5da1e38f130b27859d31a83 Mon Sep 17 00:00:00 2001
|
|
From: Charles Arnold <carnold@suse.com>
|
|
Date: Mon, 25 Oct 2021 16:16:06 -0600
|
|
Subject: [PATCH 1/1] virt-manager: Add firmware preferences for creating a new
|
|
VM
|
|
|
|
See https://bugzilla.redhat.com/show_bug.cgi?id=1997882
|
|
|
|
---
|
|
.../org.virt-manager.virt-manager.gschema.xml | 6 +++++
|
|
ui/preferences.ui | 26 +++++++++++++++++++
|
|
virtManager/config.py | 11 ++++++++
|
|
virtManager/createvm.py | 4 +++
|
|
virtManager/preferences.py | 20 ++++++++++++++
|
|
5 files changed, 67 insertions(+)
|
|
|
|
Index: virt-manager-3.2.0/data/org.virt-manager.virt-manager.gschema.xml
|
|
===================================================================
|
|
--- virt-manager-3.2.0.orig/data/org.virt-manager.virt-manager.gschema.xml
|
|
+++ virt-manager-3.2.0/data/org.virt-manager.virt-manager.gschema.xml
|
|
@@ -265,6 +265,12 @@
|
|
<description>CPU setting to use for new VMs. Limited to VMs matching the host architecture. Possible values: default (virt-manager default), hv-default (qemu's default), host-model-only (just the model, not the additional features), host-model (libvirt's host-model setting), host-passthrough (libvirt's host-passthrough setting).</description>
|
|
</key>
|
|
|
|
+ <key name="firmware" type="s">
|
|
+ <default>'default'</default>
|
|
+ <summary>Use selected firmware for new VM booting</summary>
|
|
+ <description>Firmware used for new VMs. Possible values are BIOS (default) and UEFI. The firmware used is determined by libvirt unless a specific firmware is selected from the Customize dialog.</description>
|
|
+ </key>
|
|
+
|
|
</schema>
|
|
|
|
<schema id="org.virt-manager.virt-manager.paths"
|
|
Index: virt-manager-3.2.0/ui/preferences.ui
|
|
===================================================================
|
|
--- virt-manager-3.2.0.orig/ui/preferences.ui
|
|
+++ virt-manager-3.2.0/ui/preferences.ui
|
|
@@ -494,6 +494,32 @@ identical CPUs in order to migrate the V
|
|
<property name="top_attach">2</property>
|
|
</packing>
|
|
</child>
|
|
+ <child>
|
|
+ <object class="GtkLabel" id="label127">
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">False</property>
|
|
+ <property name="tooltip_text" translatable="yes">Default Firmware for new VMs. Boot using either BIOS or UEFI.</property>
|
|
+ <property name="halign">start</property>
|
|
+ <property name="label" translatable="yes">_Firmware default:</property>
|
|
+ <property name="use_underline">True</property>
|
|
+ <property name="mnemonic_widget">prefs-firmware-default</property>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="left_attach">0</property>
|
|
+ <property name="top_attach">3</property>
|
|
+ </packing>
|
|
+ </child>
|
|
+ <child>
|
|
+ <object class="GtkComboBox" id="prefs-firmware-default">
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">False</property>
|
|
+ <signal name="changed" handler="on_prefs_firmware_default_changed" swapped="no"/>
|
|
+ </object>
|
|
+ <packing>
|
|
+ <property name="left_attach">1</property>
|
|
+ <property name="top_attach">3</property>
|
|
+ </packing>
|
|
+ </child>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
Index: virt-manager-3.2.0/virtManager/config.py
|
|
===================================================================
|
|
--- virt-manager-3.2.0.orig/virtManager/config.py
|
|
+++ virt-manager-3.2.0/virtManager/config.py
|
|
@@ -221,6 +221,7 @@ class vmmConfig(object):
|
|
|
|
self.default_storage_format_from_config = "qcow2"
|
|
self.default_console_resizeguest = 0
|
|
+ self.default_firmware_from_config = "bios"
|
|
|
|
self._objects = []
|
|
self.color_insensitive = None
|
|
@@ -532,6 +533,16 @@ class vmmConfig(object):
|
|
def set_default_cpu_setting(self, val):
|
|
self.conf.set("/new-vm/cpu-default", val.lower())
|
|
|
|
+ def get_default_firmware_setting(self, raw=False):
|
|
+ ret = self.conf.get("/new-vm/firmware")
|
|
+ if ret not in ["default", "bios", "uefi"]:
|
|
+ ret = "default" # pragma: no cover
|
|
+ if ret == "default" and not raw:
|
|
+ return self.default_firmware_from_config
|
|
+ return ret
|
|
+ def set_firmware_setting(self, val):
|
|
+ self.conf.set("/new-vm/firmware", val.lower())
|
|
+
|
|
|
|
# URL/Media path history
|
|
def _url_add_helper(self, gsettings_path, url):
|
|
Index: virt-manager-3.2.0/virtManager/createvm.py
|
|
===================================================================
|
|
--- virt-manager-3.2.0.orig/virtManager/createvm.py
|
|
+++ virt-manager-3.2.0/virtManager/createvm.py
|
|
@@ -105,6 +105,7 @@ class _GuestData:
|
|
self.os_variant = None
|
|
self.uefi_path = None
|
|
self.name = None
|
|
+ self.firmware = None
|
|
|
|
self.vcpus = None
|
|
self.memory = None
|
|
@@ -159,6 +160,8 @@ class _GuestData:
|
|
guest.currentMemory = self.currentMemory
|
|
if self.memory:
|
|
guest.memory = self.memory
|
|
+ if self.firmware == "uefi":
|
|
+ guest.os.firmware = "efi"
|
|
|
|
return guest
|
|
|
|
@@ -1507,6 +1510,7 @@ class vmmCreateVM(vmmGObjectUI):
|
|
|
|
gdata.default_graphics_type = self.config.get_graphics_type()
|
|
gdata.x86_cpu_default = self.config.get_default_cpu_setting()
|
|
+ gdata.firmware = self.config.get_default_firmware_setting()
|
|
|
|
return gdata
|
|
|
|
Index: virt-manager-3.2.0/virtManager/preferences.py
|
|
===================================================================
|
|
--- virt-manager-3.2.0.orig/virtManager/preferences.py
|
|
+++ virt-manager-3.2.0/virtManager/preferences.py
|
|
@@ -46,6 +46,7 @@ class vmmPreferences(vmmGObjectUI):
|
|
self.refresh_graphics_type()
|
|
self.refresh_storage_format()
|
|
self.refresh_cpu_default()
|
|
+ self.refresh_firmware_default()
|
|
self.refresh_cpu_poll()
|
|
self.refresh_disk_poll()
|
|
self.refresh_net_poll()
|
|
@@ -73,6 +74,7 @@ class vmmPreferences(vmmGObjectUI):
|
|
"on_prefs_graphics_type_changed": self.change_graphics_type,
|
|
"on_prefs_storage_format_changed": self.change_storage_format,
|
|
"on_prefs_cpu_default_changed": self.change_cpu_default,
|
|
+ "on_prefs_firmware_default_changed": self.change_firmware_default,
|
|
"on_prefs_stats_enable_cpu_toggled": self.change_cpu_poll,
|
|
"on_prefs_stats_enable_disk_toggled": self.change_disk_poll,
|
|
"on_prefs_stats_enable_net_toggled": self.change_net_poll,
|
|
@@ -175,6 +177,17 @@ class vmmPreferences(vmmGObjectUI):
|
|
combo.set_model(model)
|
|
uiutil.init_combo_text_column(combo, 1)
|
|
|
|
+ combo = self.widget("prefs-firmware-default")
|
|
+ # [gsettings value, string]
|
|
+ model = Gtk.ListStore(str, str)
|
|
+ for row in [["default", _("System default (%s)") %
|
|
+ self.config.default_firmware_from_config],
|
|
+ ["bios", "BIOS"],
|
|
+ ["uefi", "UEFI"]]:
|
|
+ model.append(row)
|
|
+ combo.set_model(model)
|
|
+ uiutil.init_combo_text_column(combo, 1)
|
|
+
|
|
if not vmmInspection.libguestfs_installed(): # pragma: no cover
|
|
self.widget("prefs-libguestfs").set_sensitive(False)
|
|
self.widget("prefs-libguestfs").set_tooltip_text(
|
|
@@ -234,6 +247,10 @@ class vmmPreferences(vmmGObjectUI):
|
|
combo = self.widget("prefs-cpu-default")
|
|
val = self.config.get_default_cpu_setting()
|
|
uiutil.set_list_selection(combo, val)
|
|
+ def refresh_firmware_default(self):
|
|
+ combo = self.widget("prefs-firmware-default")
|
|
+ val = self.config.get_default_firmware_setting(raw=True)
|
|
+ uiutil.set_list_selection(combo, val)
|
|
|
|
def refresh_cpu_poll(self):
|
|
self.widget("prefs-stats-enable-cpu").set_active(
|
|
@@ -374,6 +391,9 @@ class vmmPreferences(vmmGObjectUI):
|
|
def change_cpu_default(self, src):
|
|
typ = uiutil.get_list_selection(src) or "default"
|
|
self.config.set_default_cpu_setting(typ.lower())
|
|
+ def change_firmware_default(self, src):
|
|
+ typ = uiutil.get_list_selection(src) or "default"
|
|
+ self.config.set_firmware_setting(typ.lower())
|
|
|
|
def change_cpu_poll(self, src):
|
|
self.config.set_stats_enable_cpu_poll(src.get_active())
|