Re: [PATCH virt-manager v2 1/2] tests: add tests to support MDEV name change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 12, 2021 at 11:51:48AM +0100, Shalini Chellathurai Saroja wrote:
> Add tests to ensure that the UUID of mediated devices are parsed
> correctly in both newer and older(<7.3.0) versions of libvirt.
> 
> The node device names of mediated devices are changed from
> 'MDEV_$UUID'(eg: mdev_b204c698_6731_4f25_b5f4_894614a05ec0) to
> 'MDEV_$UUID_$PARENT'(eg:
> mdev_b204c698_6731_4f25_b5f4_894614a05ec0_0_0_0014) in libvirt version
> 7.8.0. This change impacted the UUID parsing of mediated devices,
> which is fixed with commit 0c146b250384ddddcefd2cc0d76b9e808377ebe5.

Commit 0c146b250384ddddcefd2cc0d76b9e808377ebe5 introduced
test coverage for this changed approach.  I'm not seeing
what scenarios this covers that aren't already covered ?

There are only two codepaths in get_mdev_uuid() and we
test both of them.

> 
> 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
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux