details: Expose chipset=i440fx/q35 in customize dialog

So enterprising users can choose q35 for x86 qemu/kvm VMs. Some
discussion over here:

http://www.redhat.com/archives/virt-tools-list/2014-May/msg00001.html
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00019.html

We show a warning if q35 is selected, saying it's not well tested.
Hopefully that dissuades people who are just clicking about.
This commit is contained in:
Cole Robinson 2014-05-31 20:13:08 -04:00
parent 03670c38dc
commit f686e36e42
2 changed files with 173 additions and 17 deletions

View File

@ -1018,6 +1018,118 @@
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="overview-chipset-title">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">2</property>
<property name="xalign">1</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Chipse_t:</property>
<property name="use_underline">True</property>
<property name="ellipsize">middle</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkBox" id="overview-chipset-warn-box">
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">False</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-warning</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="overview-chipset-warn">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;small&gt;Q35 is not the default chipset and has received far less testing.
Once this change is made it is difficult to go back. Only use this
if you know what you are doing.&lt;/small&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="overview-chipset-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkComboBoxText" id="overview-chipset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">False</property>
<signal name="changed" handler="on_overview_chipset_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="overview-chipset-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>

View File

@ -435,6 +435,12 @@ def _icon_for_device(dev):
return typemap[devtype]
def _chipset_label_from_machine(machine):
if machine and "q35" in machine:
return "Q35"
return "i440FX"
class vmmDetails(vmmGObjectUI):
__gsignals__ = {
"action-save-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
@ -585,6 +591,7 @@ class vmmDetails(vmmGObjectUI):
"on_overview_name_changed": lambda *x: self.enable_apply(x, EDIT_NAME),
"on_overview_title_changed": lambda *x: self.enable_apply(x, EDIT_TITLE),
"on_machine_type_changed": lambda *x: self.enable_apply(x, EDIT_MACHTYPE),
"on_overview_chipset_changed": lambda *x: self.enable_apply(x, EDIT_MACHTYPE),
"on_idmap_uid_target_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP),
"on_idmap_uid_count_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP),
"on_idmap_gid_target_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP),
@ -887,30 +894,56 @@ class vmmDetails(vmmGObjectUI):
uiutil.set_combo_text_column(machtype_combo, 0)
machtype_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
machines = []
try:
ignore, domain = caps.guest_lookup(
os_type=self.vm.get_abi_type(),
arch=self.vm.get_arch(),
typ=self.vm.get_hv_type(),
machine=self.vm.get_machtype())
machines = domain.machines[:]
except:
logging.exception("Error determining machine list")
show_machine = (arch not in ["i686", "x86_64"] and
not self.vm.is_management_domain())
uiutil.set_grid_row_visible(self.widget("machine-type"),
show_machine)
uiutil.set_grid_row_visible(self.widget("machine-type"), show_machine)
if show_machine:
machines = []
try:
ignore, domain = caps.guest_lookup(
os_type=self.vm.get_abi_type(),
arch=self.vm.get_arch(),
typ=self.vm.get_hv_type(),
machine=self.vm.get_machtype())
machines = domain.machines[:]
except:
logging.exception("Error determining machine list")
for machine in machines:
if machine == "none":
continue
machtype_model.append([machine])
# Chipset
combo = self.widget("overview-chipset")
model = Gtk.ListStore(str, str)
combo.set_model(model)
model.append([_chipset_label_from_machine("pc"), "pc"])
if "q35" in machines:
model.append([_chipset_label_from_machine("q35"), "q35"])
combo.set_active(0)
def chipset_changed(*args):
ignore = args
combo = self.widget("overview-chipset")
model = combo.get_model()
show_warn = (combo.get_active() >= 0 and
model[combo.get_active()][1] == "q35")
uiutil.set_grid_row_visible(
self.widget("overview-chipset-warn-box"), show_warn)
combo.connect("changed", chipset_changed)
self.widget("overview-chipset").set_visible(self.is_customize_dialog)
self.widget("overview-chipset-label").set_visible(
not self.is_customize_dialog)
show_chipset = ((self.conn.is_qemu() or self.conn.is_test_conn()) and
arch in ["i686", "x86_64"] and
not self.vm.is_management_domain())
uiutil.set_grid_row_visible(
self.widget("overview-chipset-title"), show_chipset)
# Inspection page
apps_list = self.widget("inspection-apps")
apps_model = Gtk.ListStore(str, str, str)
@ -1982,8 +2015,12 @@ class vmmDetails(vmmGObjectUI):
hotplug_args["title"] = kwargs["title"]
if self.edited(EDIT_MACHTYPE):
kwargs["machine"] = uiutil.get_combo_entry(
self.widget("machine-type"))
if self.widget("overview-chipset").is_visible():
kwargs["machine"] = uiutil.get_list_selection(
self.widget("overview-chipset"), 1)
else:
kwargs["machine"] = uiutil.get_combo_entry(
self.widget("machine-type"))
if self.edited(EDIT_DESC):
desc_widget = self.widget("overview-description")
@ -2448,6 +2485,13 @@ class vmmDetails(vmmGObjectUI):
if machtype is not None:
uiutil.set_combo_entry(self.widget("machine-type"), machtype)
chipset = _chipset_label_from_machine(machtype)
if self.widget("overview-chipset").is_visible():
uiutil.set_combo_entry(
self.widget("overview-chipset"), chipset)
elif self.widget("overview-chipset-label").is_visible():
self.widget("overview-chipset-label").set_text(chipset)
# User namespace idmap setting
is_container = self.vm.is_container()
self.widget("config-idmap-expander").set_visible(is_container)