|
|
01947c |
From bacab3883858b137f82ab2b3dea308289f65138c Mon Sep 17 00:00:00 2001
|
|
|
01947c |
From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
|
|
|
01947c |
Date: Mon, 7 Jun 2021 11:34:21 +0200
|
|
|
01947c |
Subject: [PATCH] virt-manager: enable MDEV support
|
|
|
01947c |
|
|
|
01947c |
Enable virt-manager GUI to support add, edit, remove, hot-plug and
|
|
|
01947c |
hot-unplug of mediated devices (like DASDs, APQNs and PCIs) in virtual
|
|
|
01947c |
server.
|
|
|
01947c |
|
|
|
01947c |
It is not possible to edit MDEV when a virtual server is in
|
|
|
01947c |
running state, as this is not supported by libvirt.
|
|
|
01947c |
|
|
|
01947c |
Reviewed-by: Cole Robinson <crobinso@redhat.com>
|
|
|
01947c |
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
|
|
|
01947c |
(cherry picked from commit 0e15cd51dfbdaa09f7d34ed1edce2f5416130361)
|
|
|
01947c |
|
|
|
01947c |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1995125
|
|
|
01947c |
|
|
|
01947c |
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
01947c |
---
|
|
|
01947c |
tests/data/testdriver/testdriver.xml | 39 ++++++++++++++++++++++++++++
|
|
|
01947c |
tests/uitests/test_addhardware.py | 6 +++++
|
|
|
01947c |
virtManager/addhardware.py | 19 +++++++++++++-
|
|
|
01947c |
3 files changed, 63 insertions(+), 1 deletion(-)
|
|
|
01947c |
|
|
|
01947c |
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
|
|
|
01947c |
index b8d67bac..5875732a 100644
|
|
|
01947c |
--- a/tests/data/testdriver/testdriver.xml
|
|
|
01947c |
+++ b/tests/data/testdriver/testdriver.xml
|
|
|
01947c |
@@ -3645,6 +3645,27 @@ ba</description>
|
|
|
01947c |
</capability>
|
|
|
01947c |
</device>
|
|
|
01947c |
|
|
|
01947c |
+<device>
|
|
|
01947c |
+ <name>css_0_0_0023</name>
|
|
|
01947c |
+ <path>/sys/devices/css0/0.0.0023</path>
|
|
|
01947c |
+ <parent>computer</parent>
|
|
|
01947c |
+ <driver>
|
|
|
01947c |
+ <name>vfio_ccw</name>
|
|
|
01947c |
+ </driver>
|
|
|
01947c |
+ <capability type='css'>
|
|
|
01947c |
+ <cssid>0x0</cssid>
|
|
|
01947c |
+ <ssid>0x0</ssid>
|
|
|
01947c |
+ <devno>0x0023</devno>
|
|
|
01947c |
+ <capability type='mdev_types'>
|
|
|
01947c |
+ <type id='vfio_ccw-io'>
|
|
|
01947c |
+ <name>I/O subchannel (Non-QDIO)</name>
|
|
|
01947c |
+ <deviceAPI>vfio-ccw</deviceAPI>
|
|
|
01947c |
+ <availableInstances>0</availableInstances>
|
|
|
01947c |
+ </type>
|
|
|
01947c |
+ </capability>
|
|
|
01947c |
+ </capability>
|
|
|
01947c |
+</device>
|
|
|
01947c |
+
|
|
|
01947c |
<device>
|
|
|
01947c |
<name>mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110</name>
|
|
|
01947c |
<path>/sys/devices/css0/0.0.0023/8e37ee90-2b51-45e3-9b25-bf8283c03110</path>
|
|
|
01947c |
@@ -3658,6 +3679,24 @@ ba</description>
|
|
|
01947c |
</capability>
|
|
|
01947c |
</device>
|
|
|
01947c |
|
|
|
01947c |
+<device>
|
|
|
01947c |
+ <name>ap_matrix</name>
|
|
|
01947c |
+ <path>/sys/devices/vfio_ap/matrix</path>
|
|
|
01947c |
+ <parent>computer</parent>
|
|
|
01947c |
+ <driver>
|
|
|
01947c |
+ <name>vfio_ap</name>
|
|
|
01947c |
+ </driver>
|
|
|
01947c |
+ <capability type='ap_matrix'>
|
|
|
01947c |
+ <capability type='mdev_types'>
|
|
|
01947c |
+ <type id='vfio_ap-passthrough'>
|
|
|
01947c |
+ <name>VFIO AP Passthrough Device</name>
|
|
|
01947c |
+ <deviceAPI>vfio-ap</deviceAPI>
|
|
|
01947c |
+ <availableInstances>65536</availableInstances>
|
|
|
01947c |
+ </type>
|
|
|
01947c |
+ </capability>
|
|
|
01947c |
+ </capability>
|
|
|
01947c |
+</device>
|
|
|
01947c |
+
|
|
|
01947c |
<device>
|
|
|
01947c |
<name>mdev_11f92c9d_b0b0_4016_b306_a8071277f8b9</name>
|
|
|
01947c |
<path>/sys/devices/vfio_ap/matrix/11f92c9d-b0b0-4016-b306-a8071277f8b9</path>
|
|
|
01947c |
diff --git a/tests/uitests/test_addhardware.py b/tests/uitests/test_addhardware.py
|
|
|
01947c |
index ce3da57c..56acc2fa 100644
|
|
|
01947c |
--- a/tests/uitests/test_addhardware.py
|
|
|
01947c |
+++ b/tests/uitests/test_addhardware.py
|
|
|
01947c |
@@ -459,6 +459,12 @@ def testAddHosts(app):
|
|
|
01947c |
app.click_alert_button("device is already in use by", "Yes")
|
|
|
01947c |
lib.utils.check(lambda: details.active)
|
|
|
01947c |
|
|
|
01947c |
+ # Add MDEV device
|
|
|
01947c |
+ _open_addhw(app, details)
|
|
|
01947c |
+ tab = _select_hw(addhw, "MDEV Host Device", "host-tab")
|
|
|
01947c |
+ tab.find_fuzzy("mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110",
|
|
|
01947c |
+ "table cell").click()
|
|
|
01947c |
+ _finish(addhw, check=details)
|
|
|
01947c |
|
|
|
01947c |
|
|
|
01947c |
def testAddChars(app):
|
|
|
01947c |
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
|
|
|
01947c |
index cbf19f58..13b899c3 100644
|
|
|
01947c |
--- a/virtManager/addhardware.py
|
|
|
01947c |
+++ b/virtManager/addhardware.py
|
|
|
01947c |
@@ -249,6 +249,10 @@ class vmmAddHardware(vmmGObjectUI):
|
|
|
01947c |
add_hw_option(_("PCI Host Device"), "system-run", PAGE_HOSTDEV,
|
|
|
01947c |
nodedev_enabled, nodedev_errstr, "pci")
|
|
|
01947c |
|
|
|
01947c |
+ add_hw_option(_("MDEV Host Device"), "system-run", PAGE_HOSTDEV,
|
|
|
01947c |
+ self.conn.support.conn_nodedev(),
|
|
|
01947c |
+ _("Connection does not support host device enumeration"),
|
|
|
01947c |
+ "mdev")
|
|
|
01947c |
add_hw_option(_("Video"), "video-display", PAGE_VIDEO, True,
|
|
|
01947c |
_("Libvirt version does not support video devices."))
|
|
|
01947c |
add_hw_option(_("Watchdog"), "device_pci", PAGE_WATCHDOG,
|
|
|
01947c |
@@ -656,6 +660,9 @@ class vmmAddHardware(vmmGObjectUI):
|
|
|
01947c |
(dehex(hostdev.domain), dehex(hostdev.bus),
|
|
|
01947c |
dehex(hostdev.slot), dehex(hostdev.function)))
|
|
|
01947c |
|
|
|
01947c |
+ elif hostdev.uuid:
|
|
|
01947c |
+ label += " %s" % (str(hostdev.uuid))
|
|
|
01947c |
+
|
|
|
01947c |
return label
|
|
|
01947c |
|
|
|
01947c |
|
|
|
01947c |
@@ -775,6 +782,12 @@ class vmmAddHardware(vmmGObjectUI):
|
|
|
01947c |
if dev.xmlobj.name == subdev.xmlobj.parent:
|
|
|
01947c |
prettyname += " (%s)" % subdev.pretty_name()
|
|
|
01947c |
|
|
|
01947c |
+ if devtype == "mdev":
|
|
|
01947c |
+ for parentdev in self.conn.list_nodedevs():
|
|
|
01947c |
+ if dev.xmlobj.parent == parentdev.xmlobj.name:
|
|
|
01947c |
+ prettyname = "%s %s" % (
|
|
|
01947c |
+ parentdev.pretty_name(), prettyname)
|
|
|
01947c |
+
|
|
|
01947c |
model.append([dev.xmlobj, prettyname])
|
|
|
01947c |
|
|
|
01947c |
if len(model) == 0:
|
|
|
01947c |
@@ -981,11 +994,13 @@ class vmmAddHardware(vmmGObjectUI):
|
|
|
01947c |
|
|
|
01947c |
if page == PAGE_HOSTDEV:
|
|
|
01947c |
# Need to do this here, since we share the hostdev page
|
|
|
01947c |
- # between two different HW options
|
|
|
01947c |
+ # between different HW options
|
|
|
01947c |
row = self._get_hw_selection()
|
|
|
01947c |
devtype = "usb_device"
|
|
|
01947c |
if row and row[5] == "pci":
|
|
|
01947c |
devtype = "pci"
|
|
|
01947c |
+ if row and row[5] == "mdev":
|
|
|
01947c |
+ devtype = "mdev"
|
|
|
01947c |
self._populate_hostdev_model(devtype)
|
|
|
01947c |
|
|
|
01947c |
if page == PAGE_CONTROLLER:
|
|
|
01947c |
@@ -1036,6 +1051,8 @@ class vmmAddHardware(vmmGObjectUI):
|
|
|
01947c |
row = self._get_hw_selection()
|
|
|
01947c |
if row and row[5] == "pci":
|
|
|
01947c |
return _("PCI Device")
|
|
|
01947c |
+ if row and row[5] == "mdev":
|
|
|
01947c |
+ return _("MDEV Device")
|
|
|
01947c |
return _("USB Device")
|
|
|
01947c |
|
|
|
01947c |
raise RuntimeError("Unknown page %s" % page) # pragma: no cover
|
|
|
01947c |
--
|
|
|
01947c |
2.31.1
|
|
|
01947c |
|