<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 6/1/21 11:13 PM, Cole Robinson
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9b550a6d-a42d-ec32-014d-38c7de699ab6@redhat.com">
      <pre class="moz-quote-pre" wrap="">On 5/31/21 3:54 PM, Shalini Chellathurai Saroja wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Enable support for mediated devices in virt-xml tool and virt-manager
GUI tool.

</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">Thanks! I pushed 1-3 with a small tweak to patch #1 to keep code
coverage at 100%.</pre>
    </blockquote>
    <p>Good morning Cole,</p>
    <p>Thank you for reviewing and pushing the virt-xml patch.<br>
    </p>
    <blockquote type="cite"
      cite="mid:9b550a6d-a42d-ec32-014d-38c7de699ab6@redhat.com">
      <pre class="moz-quote-pre" wrap="">In order to get the parent naming stuff in addhardware.py to trigger I
needed to change things a bit:

diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 2df84bf5..13b899c3 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -783,9 +783,10 @@ class vmmAddHardware(vmmGObjectUI):
                         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()
+                for parentdev in self.conn.list_nodedevs():
+                    if dev.xmlobj.parent == parentdev.xmlobj.name:
+                        prettyname = "%s %s" % (
+                                parentdev.pretty_name(), prettyname)

             model.append([dev.xmlobj, prettyname])


Was it working in your code before that, like on a real system with mdev
devices? Or was the Add Hardware->MDEV only listing devices with name
`mdev_$UUID` ?</pre>
    </blockquote>
    MDEV devices are listed as mdev_$UUID in my system with MDEV
    devices. <br>
    I have provided a screenshot with my code below.
    <p><img src="cid:part1.2E547CC8.A2639918@linux.ibm.com" alt=""
        class="" width="643" height="576"></p>
    <blockquote type="cite"
      cite="mid:9b550a6d-a42d-ec32-014d-38c7de699ab6@redhat.com">
      <pre class="moz-quote-pre" wrap="">The point of this code is to give more descriptive names to what we list
in the UI, if we can help it. The names for 'mdev' devices are not
descriptive. </pre>
    </blockquote>
    Yes, your code provides a more descriptive name and helps to <br>
    identify the device type (like CCW/PCI/AP device) . We can use it. <br>
    I have provided a screenshot with your code below.<br>
    <p><img src="cid:part2.B782F942.C77AAC1C@linux.ibm.com" alt=""
        class=""></p>
    <blockquote type="cite"
      cite="mid:9b550a6d-a42d-ec32-014d-38c7de699ab6@redhat.com">
      <pre class="moz-quote-pre" wrap="">Their type id=XXX values are a bit better:
vfio_ap-passthrough, nvidia-11, etc. Maybe we can just use that? The
parent devices have a bit more info under <capability><type><name> but
it's not clear if that's always available. Maybe we can get away with
just using the <type id=XXX> value in the mdev pretty_name() definition</pre>
    </blockquote>
    More than one MDEV device can have the same type id as shown below.
    <br>
    May be, we can use type id in combination with mdev_$uuid. <br>
    I feel like your suggested code is better, as we could identify the
    parent <br>
    device and MDEV device type with this code.
    <p># virsh nodedev-dumpxml mdev_8e782fea_e5f4_45fa_a0f9_024cf66e5009<br>
      <device><br>
       
      <name>mdev_8e782fea_e5f4_45fa_a0f9_024cf66e5009</name><br>
       
<path>/sys/devices/css0/0.0.0024/8e782fea-e5f4-45fa-a0f9-024cf66e5009</path><br>
        <parent>css_0_0_0024</parent><br>
        <driver><br>
          <name>vfio_mdev</name><br>
        </driver><br>
        <capability type='mdev'><br>
          <b><type id='vfio_ccw-io'/></b><br>
          <uuid>8e782fea-e5f4-45fa-a0f9-024cf66e5009</uuid><br>
          <iommuGroup number='1'/><br>
        </capability><br>
      </device><br>
    </p>
    <p># virsh nodedev-dumpxml mdev_92cc4b96_95d8_47ce_923c_c688d061bc41<br>
      <device><br>
       
      <name>mdev_92cc4b96_95d8_47ce_923c_c688d061bc41</name><br>
       
<path>/sys/devices/css0/0.0.0023/92cc4b96-95d8-47ce-923c-c688d061bc41</path><br>
        <parent>css_0_0_0023</parent><br>
        <driver><br>
          <name>vfio_mdev</name><br>
        </driver><br>
        <capability type='mdev'><br>
          <b><type id='vfio_ccw-io'/></b><br>
          <uuid>92cc4b96-95d8-47ce-923c-c688d061bc41</uuid><br>
          <iommuGroup number='2'/><br>
        </capability><br>
      </device><br>
    </p>
    Similarly, <capability><type><name> info in MDEV
    parent device <br>
    can also be same for more than one MDEV device. <br>
    <p># virsh nodedev-dumpxml css_0_0_0023<br>
      <device><br>
        <name>css_0_0_0023</name><br>
        <path>/sys/devices/css0/0.0.0023</path><br>
        <parent>computer</parent><br>
        <driver><br>
          <name>vfio_ccw</name><br>
        </driver><br>
        <capability type='css'><br>
          <cssid>0x0</cssid><br>
          <ssid>0x0</ssid><br>
          <devno>0x0023</devno><br>
          <capability type='mdev_types'><br>
            <type id='vfio_ccw-io'><br>
              <b><name>I/O subchannel (Non-QDIO)</name></b><br>
              <deviceAPI>vfio-ccw</deviceAPI><br>
              <availableInstances>0</availableInstances><br>
            </type><br>
          </capability><br>
        </capability><br>
      </device><br>
    </p>
    <p># virsh nodedev-dumpxml css_0_0_0024<br>
      <device><br>
        <name>css_0_0_0024</name><br>
        <path>/sys/devices/css0/0.0.0024</path><br>
        <parent>computer</parent><br>
        <driver><br>
          <name>vfio_ccw</name><br>
        </driver><br>
        <capability type='css'><br>
          <cssid>0x0</cssid><br>
          <ssid>0x0</ssid><br>
          <devno>0x0024</devno><br>
          <capability type='mdev_types'><br>
            <type id='vfio_ccw-io'><br>
              <b><name>I/O subchannel (Non-QDIO)</name></b><br>
              <deviceAPI>vfio-ccw</deviceAPI><br>
              <availableInstances>0</availableInstances><br>
            </type><br>
          </capability><br>
        </capability><br>
      </device><br>
    </p>
    Are you ok with using your suggested code (parent name mdev_$uuid) <br>
    for prettyname? Please let me know your feedback. <br>
    <blockquote type="cite"
      cite="mid:9b550a6d-a42d-ec32-014d-38c7de699ab6@redhat.com">
      <pre class="moz-quote-pre" wrap="">Thanks,
Cole

</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Kind regards
Shalini Chellathurai Saroja
Linux on Z and Virtualization Development
Vorsitzende des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294</pre>
  </body>
</html>