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 <lma@suse.com>
This commit is contained in:
Lin Ma 2017-03-27 10:22:32 +08:00 committed by Cole Robinson
parent 899f53b993
commit 262376d16f
2 changed files with 7 additions and 0 deletions

View File

@ -279,6 +279,11 @@ class TestNodeDev(unittest.TestCase):
obj = self._nodeDevFromName(nodename) obj = self._nodeDevFromName(nodename)
self.assertEqual(obj.iommu_group, 3) 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): def testNodeDevFail(self):
nodename = "usb_device_1d6b_1_0000_00_1d_1_if0" nodename = "usb_device_1d6b_1_0000_00_1d_1_if0"
devfile = "" devfile = ""

View File

@ -183,6 +183,8 @@ class PCIDevice(NodeDevice):
vendor_name = XMLProperty("./capability/vendor") vendor_name = XMLProperty("./capability/vendor")
vendor_id = XMLProperty("./capability/vendor/@id") vendor_id = XMLProperty("./capability/vendor/@id")
capability_type = XMLProperty("./capability/capability/@type")
iommu_group = XMLProperty("./capability/iommuGroup/@number", is_int=True) iommu_group = XMLProperty("./capability/iommuGroup/@number", is_int=True)
def pretty_name(self): def pretty_name(self):