From f686e36e429f99be6c9771c956b9cd5e777c03b6 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 31 May 2014 20:13:08 -0400 Subject: [PATCH] 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. --- ui/details.ui | 112 +++++++++++++++++++++++++++++++++++++++++ virtManager/details.py | 78 +++++++++++++++++++++------- 2 files changed, 173 insertions(+), 17 deletions(-) diff --git a/ui/details.ui b/ui/details.ui index 421c5e48..13a77920 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -1018,6 +1018,118 @@ 1 + + + True + False + 2 + 1 + 0 + Chipse_t: + True + middle + + + 0 + 4 + 1 + 1 + + + + + True + False + 3 + + + False + 6 + + + True + False + start + False + 0 + gtk-dialog-warning + + + False + True + 0 + + + + + True + False + <small>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.</small> + True + + + False + True + 1 + + + + + 0 + 1 + 1 + 1 + + + + + True + False + + + True + False + start + False + + + + False + True + 0 + + + + + True + False + 0 + label + + + False + True + 1 + + + + + 0 + 0 + 1 + 1 + + + + + 1 + 4 + 1 + 1 + + diff --git a/virtManager/details.py b/virtManager/details.py index c151781f..7dac216e 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -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)