details: Add host-passthrough as an explicit CPU UI choice

Historically we have not advertised host-passthrough because it was
not recommended for general usage. That stance is softening,
tools like gnome-boxes already set it as the default, and users
continue to ask about it.

We may change the default in virt-manager but it will take more
discussion. This is a tiny move in the direction of hiding it less
than we already do.

Drop the label for host-model and call it by its libvirt XML name,
since otherwise it's hard to tell which combo choice is for each
value

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-09-20 17:20:10 -04:00
parent 2f7931da63
commit 295c8a86dd
5 changed files with 14 additions and 7 deletions

View File

@ -262,7 +262,7 @@
<key name="cpu-default" type="s">
<default>'default'</default>
<summary>CPU setting to use for new VMs</summary>
<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).</description>
<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>
</schema>

View File

@ -219,6 +219,9 @@ def testDetailsEditDomain1(app):
tab.find("Hypervisor Default", "menu item").click()
appl.click()
lib.utils.check(lambda: not appl.sensitive)
tab.find("cpu-model").find(None, "text").text = "foobar"
appl.click()
lib.utils.check(lambda: not appl.sensitive)
tab.find("cpu-model").find(None, "text").text = "host-passthrough"
appl.click()
lib.utils.check(lambda: not appl.sensitive)

View File

@ -40,7 +40,7 @@ def testPrefsAll(app):
win.find("New VM", "page tab").click()
tab = newvmtab
tab.check_onscreen()
tab.combo_select("CPU default:", "Copy host")
tab.combo_select("CPU default:", "host-passthrough")
tab.combo_select("Storage format:", "Raw")
tab.combo_select("Graphics type", "VNC")

View File

@ -799,12 +799,16 @@ class vmmDetails(vmmGObjectUI):
cpu_model.set_entry_text_column(0)
cpu_model.set_row_separator_func(sep_func, None)
model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
model.append([_("Application Default"), "1",
model.append([_("Application Default"), "01",
virtinst.DomainCpu.SPECIAL_MODE_APP_DEFAULT, False])
model.append([_("Hypervisor Default"), "2",
model.append([_("Hypervisor Default"), "02",
virtinst.DomainCpu.SPECIAL_MODE_HV_DEFAULT, False])
model.append([_("Clear CPU configuration"), "3",
model.append([_("Clear CPU configuration"), "03",
virtinst.DomainCpu.SPECIAL_MODE_CLEAR, False])
model.append(["host-model", "04",
virtinst.DomainCpu.SPECIAL_MODE_HOST_MODEL, False])
model.append(["host-passthrough", "05",
virtinst.DomainCpu.SPECIAL_MODE_HOST_PASSTHROUGH, False])
model.append([None, None, None, True])
for name in domcaps.get_cpu_models():
model.append([name, name, name, False])

View File

@ -169,8 +169,8 @@ class vmmPreferences(vmmGObjectUI):
[DomainCpu.SPECIAL_MODE_HV_DEFAULT, _("Hypervisor default")],
[DomainCpu.SPECIAL_MODE_HOST_MODEL_ONLY,
_("Nearest host CPU model")],
[DomainCpu.SPECIAL_MODE_HOST_MODEL,
_("Copy host CPU definition")]]:
[DomainCpu.SPECIAL_MODE_HOST_MODEL, "host-model"],
[DomainCpu.SPECIAL_MODE_HOST_PASSTHROUGH, "host-passthrough"]]:
model.append(row)
combo.set_model(model)
uiutil.init_combo_text_column(combo, 1)