[virt-tools-list] [virt-manager PATCH 2/4 v2] nodedev: Parse PCI capability_type for SR-IOV device

Lin Ma lma at suse.com
Mon Mar 27 02:22:32 UTC 2017


This will be used in the following patch to recognize SR-IOV capable
device.

Signed-off-by: Lin Ma <lma at suse.com>
---
 tests/nodedev.py    | 5 +++++
 virtinst/nodedev.py | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/tests/nodedev.py b/tests/nodedev.py
index 15e54b1..db6a7fc 100644
--- a/tests/nodedev.py
+++ b/tests/nodedev.py
@@ -279,6 +279,11 @@ class TestNodeDev(unittest.TestCase):
         obj = self._nodeDevFromName(nodename)
         self.assertEqual(obj.iommu_group, 3)
 
+    def testNodeDevSRIOV(self):
+        nodename = "pci_8086_10fb"
+        obj = self._nodeDevFromName(nodename)
+        self.assertEqual(obj.capability_type, "virt_functions")
+
     def testNodeDevFail(self):
         nodename = "usb_device_1d6b_1_0000_00_1d_1_if0"
         devfile = ""
diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py
index f27cfbb..7796ca6 100644
--- a/virtinst/nodedev.py
+++ b/virtinst/nodedev.py
@@ -183,6 +183,8 @@ class PCIDevice(NodeDevice):
     vendor_name = XMLProperty("./capability/vendor")
     vendor_id = XMLProperty("./capability/vendor/@id")
 
+    capability_type = XMLProperty("./capability/capability/@type")
+
     iommu_group = XMLProperty("./capability/iommuGroup/@number", is_int=True)
 
     def pretty_name(self):
-- 
2.9.2




More information about the virt-tools-list mailing list