Enable virt-manager GUI to support add, edit, remove, hot-plug and hot-unplug of mediated devices (like DASDs, APQNs and PCIs) in virtual server. It is not possible to edit mdev when a virtual server is in running state, as this is not supported by libvirt. The patch-series "virt-install: Add mediated device support" is the base patch for this patch. Signed-off-by: Shalini Chellathurai Saroja <shalini@xxxxxxxxxxxxx> --- tests/uitests/test_addhardware.py | 6 ++++++ virtManager/addhardware.py | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/uitests/test_addhardware.py b/tests/uitests/test_addhardware.py index ce3da57c..56acc2fa 100644 --- a/tests/uitests/test_addhardware.py +++ b/tests/uitests/test_addhardware.py @@ -459,6 +459,12 @@ def testAddHosts(app): app.click_alert_button("device is already in use by", "Yes") lib.utils.check(lambda: details.active) + # Add MDEV device + _open_addhw(app, details) + tab = _select_hw(addhw, "MDEV Host Device", "host-tab") + tab.find_fuzzy("mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110", + "table cell").click() + _finish(addhw, check=details) def testAddChars(app): diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index cbf19f58..2df84bf5 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -249,6 +249,10 @@ class vmmAddHardware(vmmGObjectUI): add_hw_option(_("PCI Host Device"), "system-run", PAGE_HOSTDEV, nodedev_enabled, nodedev_errstr, "pci") + add_hw_option(_("MDEV Host Device"), "system-run", PAGE_HOSTDEV, + self.conn.support.conn_nodedev(), + _("Connection does not support host device enumeration"), + "mdev") add_hw_option(_("Video"), "video-display", PAGE_VIDEO, True, _("Libvirt version does not support video devices.")) add_hw_option(_("Watchdog"), "device_pci", PAGE_WATCHDOG, @@ -656,6 +660,9 @@ class vmmAddHardware(vmmGObjectUI): (dehex(hostdev.domain), dehex(hostdev.bus), dehex(hostdev.slot), dehex(hostdev.function))) + elif hostdev.uuid: + label += " %s" % (str(hostdev.uuid)) + return label @@ -775,6 +782,11 @@ class vmmAddHardware(vmmGObjectUI): if dev.xmlobj.name == subdev.xmlobj.parent: prettyname += " (%s)" % subdev.pretty_name() + if devtype == "mdev": + for subdev in self.conn.filter_nodedevs("mdev"): + if dev.xmlobj.name == subdev.xmlobj.parent: + prettyname += " (%s)" % subdev.pretty_name() + model.append([dev.xmlobj, prettyname]) if len(model) == 0: @@ -981,11 +993,13 @@ class vmmAddHardware(vmmGObjectUI): if page == PAGE_HOSTDEV: # Need to do this here, since we share the hostdev page - # between two different HW options + # between different HW options row = self._get_hw_selection() devtype = "usb_device" if row and row[5] == "pci": devtype = "pci" + if row and row[5] == "mdev": + devtype = "mdev" self._populate_hostdev_model(devtype) if page == PAGE_CONTROLLER: @@ -1036,6 +1050,8 @@ class vmmAddHardware(vmmGObjectUI): row = self._get_hw_selection() if row and row[5] == "pci": return _("PCI Device") + if row and row[5] == "mdev": + return _("MDEV Device") return _("USB Device") raise RuntimeError("Unknown page %s" % page) # pragma: no cover -- 2.30.2