mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-03 01:18:00 +03:00
createvm: Tweaks to new UEFI pref
* Make it clear in code and UI that this is x86 only. Other arches either require UEFI (aarch64) or don't support it * Drop the internal 'bios' values since we don't handle them and may not want them anyways, since when win11 support lands we will need to explicitly throw an error if the user tries to force bios * Add UI tests Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
0a1dd8b822
commit
c3e9db5f3a
@ -268,7 +268,7 @@
|
||||
<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>
|
||||
<description>Firmware used for new VMs. Possible values are default and UEFI. The firmware used is determined by libvirt unless a specific firmware is selected from the Customize dialog.</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
13
tests/uitests/data/keyfile/uefi.ini
Normal file
13
tests/uitests/data/keyfile/uefi.ini
Normal file
@ -0,0 +1,13 @@
|
||||
[org/virt-manager/virt-manager/vmlist-fields]
|
||||
disk-usage=false
|
||||
network-traffic=false
|
||||
|
||||
[org/virt-manager/virt-manager/connections]
|
||||
uris=['test:///default']
|
||||
autoconnect=['test:///default']
|
||||
|
||||
[org/virt-manager/virt-manager/details]
|
||||
show-toolbar=true
|
||||
|
||||
[org/virt-manager/virt-manager/new-vm]
|
||||
firmware=uefi
|
@ -375,7 +375,8 @@ def testNewVMURL(app):
|
||||
New VM with URL and distro detection, plus having fun with
|
||||
the storage browser and network selection.
|
||||
"""
|
||||
app.uri = tests.utils.URIs.kvm_x86
|
||||
# Also test default UEFI from prefs
|
||||
app.open(keyfile="uefi.ini", uri=tests.utils.URIs.kvm_x86)
|
||||
newvm = _open_newvm(app)
|
||||
|
||||
newvm.find_fuzzy("Network Install", "radio").click()
|
||||
|
@ -43,6 +43,7 @@ def testPrefsAll(app):
|
||||
tab.combo_select("CPU default:", "host-passthrough")
|
||||
tab.combo_select("Storage format:", "Raw")
|
||||
tab.combo_select("Graphics type", "VNC")
|
||||
tab.combo_select("x86 Firmware", "UEFI")
|
||||
|
||||
win.find("Console", "page tab").click()
|
||||
tab = consoletab
|
||||
|
@ -412,7 +412,7 @@
|
||||
<property name="can-focus">False</property>
|
||||
<property name="left-padding">12</property>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=3 -->
|
||||
<!-- n-columns=2 n-rows=4 -->
|
||||
<object class="GtkGrid" id="table4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
@ -501,27 +501,27 @@ identical CPUs in order to migrate the VM.</property>
|
||||
<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="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>
|
||||
<property name="label" translatable="yes">x86 _Firmware:</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>
|
||||
<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>
|
||||
<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>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -221,7 +221,6 @@ 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
|
||||
@ -533,12 +532,10 @@ 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):
|
||||
def get_default_firmware_setting(self):
|
||||
ret = self.conf.get("/new-vm/firmware")
|
||||
if ret not in ["default", "bios", "uefi"]:
|
||||
if ret not in ["default", "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())
|
||||
|
@ -478,7 +478,10 @@ class vmmCreateVM(vmmGObjectUI):
|
||||
guest.os.is_ppc64() or
|
||||
guest.os.is_s390x())
|
||||
|
||||
default_efi = self.config.get_default_firmware_setting() == "uefi"
|
||||
default_efi = (
|
||||
self.config.get_default_firmware_setting() == "uefi" and
|
||||
guest.os.is_x86() and
|
||||
guest.os.is_hvm())
|
||||
if default_efi:
|
||||
log.debug("UEFI default requested via app preferences")
|
||||
|
||||
|
@ -180,9 +180,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
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"],
|
||||
for row in [["default", _("System default")],
|
||||
["uefi", "UEFI"]]:
|
||||
model.append(row)
|
||||
combo.set_model(model)
|
||||
@ -249,7 +247,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
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)
|
||||
val = self.config.get_default_firmware_setting()
|
||||
uiutil.set_list_selection(combo, val)
|
||||
|
||||
def refresh_cpu_poll(self):
|
||||
|
Loading…
Reference in New Issue
Block a user