From 262376d16f0739a00d794192aeeee4c4e1fd84d3 Mon Sep 17 00:00:00 2001 From: Lin Ma Date: Mon, 27 Mar 2017 10:22:32 +0800 Subject: [PATCH] nodedev: Parse PCI capability_type for SR-IOV device This will be used in the following patch to recognize SR-IOV capable device. Signed-off-by: Lin Ma --- tests/nodedev.py | 5 +++++ virtinst/nodedev.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tests/nodedev.py b/tests/nodedev.py index 15e54b1d..db6a7fc8 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 f27cfbb2..7796ca62 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):