diff --git a/ui/addhardware.ui b/ui/addhardware.ui index 4fc82fe9..97d03c0e 100644 --- a/ui/addhardware.ui +++ b/ui/addhardware.ui @@ -326,6 +326,83 @@ False + + + True + False + 6 + 6 + + + True + False + 0 + _Type: + True + + + 0 + 0 + 1 + 1 + + + + + True + False + 0 + _Model: + True + + + 0 + 1 + 1 + 1 + + + + + True + False + + + + 1 + 0 + 1 + 1 + + + + + True + False + + + 1 + 1 + 1 + 1 + + + + + 2 + + + + + True + False + Controller + + + 2 + False + + True @@ -491,7 +568,7 @@ - 2 + 3 @@ -501,7 +578,7 @@ net - 2 + 3 False @@ -539,7 +616,7 @@ - 3 + 4 @@ -549,7 +626,7 @@ input - 3 + 4 False @@ -562,7 +639,7 @@ - 4 + 5 @@ -572,7 +649,7 @@ gfx - 4 + 5 False @@ -611,7 +688,7 @@ - 5 + 6 @@ -621,7 +698,7 @@ sound - 5 + 6 False @@ -671,7 +748,7 @@ - 6 + 7 @@ -681,7 +758,7 @@ host - 6 + 7 False @@ -1050,6 +1127,8 @@ 0 5 + 1 + 1 @@ -1060,11 +1139,13 @@ 1 5 + 1 + 1 - 7 + 8 @@ -1074,7 +1155,7 @@ char - 7 + 8 False @@ -1113,7 +1194,7 @@ - 8 + 9 @@ -1123,7 +1204,7 @@ vid - 8 + 9 False @@ -1192,7 +1273,7 @@ - 9 + 10 @@ -1202,7 +1283,7 @@ wdog - 9 + 10 False @@ -1216,7 +1297,7 @@ - 10 + 11 @@ -1226,7 +1307,7 @@ fs - 10 + 11 False @@ -1265,7 +1346,7 @@ - 11 + 12 @@ -1275,7 +1356,7 @@ sc - 11 + 12 False @@ -1385,7 +1466,7 @@ - 12 + 13 @@ -1395,7 +1476,7 @@ usbr - 12 + 13 False @@ -1464,7 +1545,7 @@ - 13 + 14 @@ -1474,7 +1555,7 @@ tpm - 13 + 14 False @@ -1732,7 +1813,7 @@ - 14 + 15 @@ -1742,7 +1823,7 @@ rng - 14 + 15 False @@ -1809,7 +1890,7 @@ - 15 + 16 @@ -1819,7 +1900,7 @@ panic - 15 + 16 False diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index 519aa2b9..5e8030b0 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -44,6 +44,7 @@ from virtManager.addstorage import vmmAddStorage (PAGE_ERROR, PAGE_DISK, +PAGE_CONTROLLER, PAGE_NETWORK, PAGE_INPUT, PAGE_GRAPHICS, @@ -58,7 +59,7 @@ PAGE_USBREDIR, PAGE_TPM, PAGE_RNG, PAGE_PANIC, -) = range(0, 16) +) = range(0, 17) class vmmAddHardware(vmmGObjectUI): @@ -313,6 +314,19 @@ class vmmAddHardware(vmmGObjectUI): combo = self.widget("panic-type") self.build_panic_address_type(combo) + # Controller widgets + combo = self.widget("controller-type") + target_model = Gtk.ListStore(str, str) + combo.set_model(target_model) + uiutil.set_combo_text_column(combo, 1) + combo = self.widget("controller-model") + target_model = Gtk.ListStore(str, str) + combo.set_model(target_model) + uiutil.set_combo_text_column(combo, 1) + # FIXME: we should deal with controller model + combo.set_visible(False) + self.widget("controller-model-label").set_visible(False) + # Available HW options is_local = not self.conn.is_remote() is_storage_capable = self.conn.is_storage_capable() @@ -332,6 +346,7 @@ class vmmAddHardware(vmmGObjectUI): add_hw_option("Storage", "drive-harddisk", PAGE_DISK, have_storage, have_storage and storage_tooltip or None) + add_hw_option("Controller", "device_pci", PAGE_CONTROLLER, True, None) add_hw_option("Network", "network-idle", PAGE_NETWORK, True, None) add_hw_option("Input", "input-mouse", PAGE_INPUT, self.vm.is_hvm(), _("Not supported for this guest type.")) @@ -455,6 +470,9 @@ class vmmAddHardware(vmmGObjectUI): # Panic device params self.widget("panic-iobase").set_text("0x505") + # Controller device params + self.populate_controller_type() + self.set_hw_selection(0) @@ -813,6 +831,19 @@ class vmmAddHardware(vmmGObjectUI): if not create: format_list.get_child().set_text("") + def populate_controller_type(self): + widget = self.widget("controller-type") + model = widget.get_model() + model.clear() + + for t in VirtualController.TYPES: + if t == VirtualController.TYPE_PCI: + continue + model.append([t, VirtualController.pretty_type(t)]) + + if len(model) > 0: + widget.set_active(0) + ######################## # get_config_* methods # @@ -1008,6 +1039,13 @@ class vmmAddHardware(vmmGObjectUI): def get_config_rng_backend_mode(self): return uiutil.get_list_selection(self.widget("rng-backend-mode"), 0) + # CONTROLLER getters + def get_config_controller_type(self): + return uiutil.get_list_selection(self.widget("controller-type"), 0) + + def get_config_controller_model(self): + return uiutil.get_list_selection(self.widget("controller-model"), 0) + ################ # UI listeners # ################ @@ -1115,6 +1153,8 @@ class vmmAddHardware(vmmGObjectUI): return _("Error") if page == PAGE_DISK: return _("Storage") + if page == PAGE_CONTROLLER: + return _("Controller") if page == PAGE_NETWORK: return _("Network") if page == PAGE_INPUT: @@ -1372,6 +1412,8 @@ class vmmAddHardware(vmmGObjectUI): return True elif page_num == PAGE_DISK: return self.validate_page_storage() + elif page_num == PAGE_CONTROLLER: + return self.validate_page_controller() elif page_num == PAGE_NETWORK: return self.validate_page_network() elif page_num == PAGE_INPUT: @@ -1727,6 +1769,20 @@ class vmmAddHardware(vmmGObjectUI): except Exception, e: return self.err.val_err(_("Panic device parameter error"), e) + def validate_page_controller(self): + conn = self.conn.get_backend() + controller_type = self.get_config_controller_type() + self._dev = VirtualController(conn) + + controllers = self.vm.get_controller_devices() + controller_num = [x for x in controllers if + (x.type == controller_type)] + if len(controller_num) > 0: + index_new = max([x.index for x in controller_num]) + 1 + self._dev.index = index_new + + self._dev.type = controller_type + def validate_page_rng(self): conn = virtinst.VirtualRNGDevice.BACKEND_MODE_CONNECT in \ self.get_config_rng_backend_mode()