Signed-off-by: Shalini Chellathurai Saroja <shalini@xxxxxxxxxxxxx>
---
tests/data/testdriver/testdriver.xml | 28 ++++++++++++++++++++++++++++
tests/test_nodedev.py | 27 +++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
index e4880936..13f40136 100644
--- a/tests/data/testdriver/testdriver.xml
+++ b/tests/data/testdriver/testdriver.xml
@@ -3679,6 +3679,20 @@ ba</description>
</capability>
</device>
+<device>
+ <name>mdev_c6c57090_3490_428e_a7fb_8d557f985717_0_0_0023</name>
+ <path>/sys/devices/css0/0.0.0023/c6c57090-3490-428e-a7fb-8d557f985717</path>
+ <parent>css_0_0_0023</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='vfio_ccw-io'/>
+ <uuid>c6c57090-3490-428e-a7fb-8d557f985717</uuid>
+ <iommuGroup number='0'/>
+ </capability>
+</device>
+
<device>
<name>ap_matrix</name>
<path>/sys/devices/vfio_ap/matrix</path>
@@ -3712,6 +3726,20 @@ ba</description>
</capability>
</device>
+<device>
+ <name>mdev_45938d10_4d5d_4e8f_b5ce_27be07b5bab6_matrix</name>
+ <path>/sys/devices/vfio_ap/matrix/45938d10-4d5d-4e8f-b5ce-27be07b5bab6</path>
+ <parent>ap_matrix</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='vfio_ap-passthrough'/>
+ <uuid>45938d10-4d5d-4e8f-b5ce-27be07b5bab6</uuid>
+ <iommuGroup number='2'/>
+ </capability>
+</device>
+
<device>
<name>mdev_4b20d080_1b54_4048_85b3_a6a62d165c01</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/4b20d080-1b54-4048-85b3-a6a62d165c01</path>
diff --git a/tests/test_nodedev.py b/tests/test_nodedev.py
index 41435262..8de0facf 100644
--- a/tests/test_nodedev.py
+++ b/tests/test_nodedev.py
@@ -135,6 +135,7 @@ def testDASDMdev():
assert dev.parent == "css_0_0_0023"
assert dev.device_type == "mdev"
assert dev.type_id == "vfio_ccw-io"
+ assert dev.get_mdev_uuid() == "8e37ee90-2b51-45e3-9b25-bf8283c03110"
def testAPQNMdev():
@@ -145,6 +146,7 @@ def testAPQNMdev():
assert dev.parent == "ap_matrix"
assert dev.device_type == "mdev"
assert dev.type_id == "vfio_ap-passthrough"
+ assert dev.get_mdev_uuid() == "11f92c9d-b0b0-4016-b306-a8071277f8b9"
def testPCIMdev():
@@ -157,7 +159,32 @@ def testPCIMdev():
assert dev.type_id == "nvidia-11"
assert dev.get_mdev_uuid() == "4b20d080-1b54-4048-85b3-a6a62d165c01"
+
# libvirt <7.3.0 doesn't support <uuid> in the mdev node device xml
+@pytest.mark.skipif(libvirt.getVersion() < 7003000, reason="libvirt version doesn't support new mdev format")
+def testDASDMdevNewFormat():
+ conn = utils.URIs.open_testdriver_cached()
+ devname = "mdev_c6c57090_3490_428e_a7fb_8d557f985717_0_0_0023"
+ dev = _nodeDevFromName(conn, devname)
+ assert dev.name == devname
+ assert dev.parent == "css_0_0_0023"
+ assert dev.device_type == "mdev"
+ assert dev.type_id == "vfio_ccw-io"
+ assert dev.get_mdev_uuid() == "c6c57090-3490-428e-a7fb-8d557f985717"
+
+
+@pytest.mark.skipif(libvirt.getVersion() < 7003000, reason="libvirt version doesn't support new mdev format")
+def testAPQNMdevNewFormat():
+ conn = utils.URIs.open_testdriver_cached()
+ devname = "mdev_45938d10_4d5d_4e8f_b5ce_27be07b5bab6_matrix"
+ dev = _nodeDevFromName(conn, devname)
+ assert dev.name == devname
+ assert dev.parent == "ap_matrix"
+ assert dev.device_type == "mdev"
+ assert dev.type_id == "vfio_ap-passthrough"
+ assert dev.get_mdev_uuid() == "45938d10-4d5d-4e8f-b5ce-27be07b5bab6"
+
+
@pytest.mark.skipif(libvirt.getVersion() < 7003000, reason="libvirt version doesn't support new mdev format")
def testPCIMdevNewFormat():
conn = utils.URIs.open_testdriver_cached()
--
2.30.2