[RFC virt-manager] virt-manager: enable mdev support

Cole Robinson crobinso at redhat.com
Sun May 23 21:57:50 UTC 2021


On 5/5/21 11:42 AM, Shalini Chellathurai Saroja wrote:
> 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 at linux.ibm.com>
> ---
>  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()
> +
Patch looks pretty good. This bit here isn't covered by the UI test
suite though because none of the nodedev parent devices were added to
the testdriver.xml with your previous patch. Can you send a v2 adding
the referenced parent devices too?

Thanks,
Cole




More information about the virt-tools-list mailing list