From: Chen Hanxiao <chenhanxiao@xxxxxxxxx> We could turn on/off multifunction of hostdev in page details. Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx> --- ui/details.ui | 74 ++++++++++++++++++++++++++++++-------------------- virtManager/details.py | 13 ++++++++- virtManager/domain.py | 8 +++++- 3 files changed, 64 insertions(+), 31 deletions(-) diff --git a/ui/details.ui b/ui/details.ui index 5932860..66284f7 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -132,9 +132,9 @@ <signal name="delete-event" handler="on_vmm_details_delete_event" swapped="no"/> <child> <object class="GtkBox" id="vbox2"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkMenuBar" id="details-menubar"> <property name="visible">True</property> @@ -400,7 +400,6 @@ </child> <child> <object class="GtkBox" id="toolbar-box"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <child> @@ -593,16 +592,15 @@ <signal name="switch-page" handler="on_details_pages_switch_page" after="yes" swapped="no"/> <child> <object class="GtkBox" id="hbox1"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="border_width">12</property> <property name="spacing">12</property> <child> <object class="GtkBox" id="vbox53"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkScrolledWindow" id="scrolledwindow5"> @@ -670,9 +668,9 @@ </child> <child> <object class="GtkBox" id="vbox1"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkNotebook" id="hw-panel"> @@ -682,9 +680,9 @@ <property name="show_border">False</property> <child> <object class="GtkBox" id="vbox6"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkFrame" id="frame2"> @@ -1702,9 +1700,9 @@ if you know what you are doing.</small></property> <property name="orientation">vertical</property> <child> <object class="GtkBox" id="vbox5"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkFrame" id="frame24"> @@ -1990,10 +1988,10 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox14"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">start</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkFrame" id="CPUs"> @@ -2009,7 +2007,6 @@ if you know what you are doing.</small></property> <property name="left_padding">12</property> <child> <object class="GtkBox" id="hbox5"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">6</property> @@ -2132,7 +2129,6 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="cpu-vcpus-warn-box"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">6</property> @@ -2292,9 +2288,9 @@ if you know what you are doing.</small></property> <property name="right_padding">12</property> <child> <object class="GtkBox" id="vbox15"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">4</property> <child> <object class="GtkCheckButton" id="cpu-topology-enable"> @@ -2322,7 +2318,6 @@ if you know what you are doing.</small></property> <property name="xscale">0</property> <child> <object class="GtkBox" id="hbox26"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">6</property> @@ -2437,7 +2432,6 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="cpu-topology-warn-box"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">6</property> @@ -2527,9 +2521,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox7"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame5"> <property name="visible">True</property> @@ -2612,7 +2606,6 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="hbox46"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">3</property> @@ -2662,7 +2655,6 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="hbox47"> - <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">3</property> @@ -3191,9 +3183,9 @@ if you know what you are doing.</small></property> <property name="left_padding">12</property> <child> <object class="GtkBox" id="bootvbox"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="boot-menu"> @@ -3346,9 +3338,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox55"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkFrame" id="frame10"> @@ -3364,9 +3356,9 @@ if you know what you are doing.</small></property> <property name="left_padding">12</property> <child> <object class="GtkBox" id="vbox13"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkGrid" id="table32"> @@ -3923,9 +3915,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox54"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkFrame" id="frame9"> @@ -4109,9 +4101,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox56"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkFrame" id="frame11"> @@ -4220,9 +4212,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox57"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="vnc-frame"> <property name="visible">True</property> @@ -4273,9 +4265,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox58"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame13"> <property name="visible">True</property> @@ -4366,9 +4358,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox59"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame14"> <property name="visible">True</property> @@ -4572,9 +4564,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox8"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame6"> <property name="visible">True</property> @@ -4646,6 +4638,30 @@ if you know what you are doing.</small></property> <property name="top_attach">1</property> </packing> </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Multifunction</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="hostdev-multifunction"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_hostdev_multifunction_toggled" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> </object> </child> </object> @@ -4683,9 +4699,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox9"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame8"> <property name="visible">True</property> @@ -4844,9 +4860,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox12"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame15"> <property name="visible">True</property> @@ -5115,9 +5131,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox16"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkFrame" id="frame18"> <property name="visible">True</property> @@ -5303,9 +5319,9 @@ if you know what you are doing.</small></property> </child> <child> <object class="GtkBox" id="vbox17"> - <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkFrame" id="frame20"> diff --git a/virtManager/details.py b/virtManager/details.py index f3c9080..b0dc41f 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -107,8 +107,9 @@ EDIT_TPM_TYPE, EDIT_FS, EDIT_HOSTDEV_ROMBAR, +EDIT_HOSTDEV_MULTIFUNCTION, -) = range(1, 49) +) = range(1, 50) # Columns in hw list model @@ -565,6 +566,8 @@ class vmmDetails(vmmGObjectUI): "on_hostdev_rombar_toggled": lambda *x: self.enable_apply( x, EDIT_HOSTDEV_ROMBAR), + "on_hostdev_multifunction_toggled": lambda *x: self.enable_apply( + x, EDIT_HOSTDEV_MULTIFUNCTION), "on_controller_model_combo_changed": (lambda *x: self.enable_apply(x, EDIT_CONTROLLER_MODEL)), @@ -2271,6 +2274,8 @@ class vmmDetails(vmmGObjectUI): if self.edited(EDIT_HOSTDEV_ROMBAR): kwargs["rom_bar"] = self.widget("hostdev-rombar").get_active() + if self.edited(EDIT_HOSTDEV_MULTIFUNCTION): + kwargs["multifunction"] = self.widget("hostdev-multifunction").get_active() return vmmAddHardware.change_config_helper(self.vm.define_hostdev, kwargs, self.vm, self.err, @@ -2945,8 +2950,13 @@ class vmmDetails(vmmGObjectUI): return rom_bar = hostdev.rom_bar + multifunction = hostdev.multifunction if rom_bar is None: rom_bar = True + if multifunction == 'on': + multifunction = True + else: + multifunction = False devtype = hostdev.type if hostdev.type == 'usb': @@ -2970,6 +2980,7 @@ class vmmDetails(vmmGObjectUI): self.widget("hostdev-title").set_markup(devlabel) self.widget("hostdev-source").set_text(pretty_name) self.widget("hostdev-rombar").set_active(rom_bar) + self.widget("hostdev-multifunction").set_active(multifunction) def refresh_video_page(self): vid = self.get_hw_selection(HW_LIST_COL_DEVICE) diff --git a/virtManager/domain.py b/virtManager/domain.py index 6b94455..401e5a6 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -1057,7 +1057,8 @@ class vmmDomain(vmmLibvirtObject): self._redefine_xmlobj(xmlobj) - def define_hostdev(self, devobj, do_hotplug, rom_bar=_SENTINEL): + def define_hostdev(self, devobj, do_hotplug, rom_bar=_SENTINEL, + multifunction=_SENTINEL): xmlobj = self._make_xmlobj_to_define() editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) if not editdev: @@ -1066,6 +1067,11 @@ class vmmDomain(vmmLibvirtObject): if rom_bar != _SENTINEL: editdev.rom_bar = rom_bar + if multifunction is True: + editdev.multifunction = "on" + else: + editdev.multifunction = "off" + if do_hotplug: self.hotplug(device=editdev) else: -- 2.7.4 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list