Fix device plugin port handling for pci-passthrough
While generating the SR-IOV device plugin configuration data, it is necessary to get the underlying port information. For SR-IOV ports there is special handling required to deal with the case of a 'VF' subinterface. For PCI-Passthrough, the port can and should be accessed directly. Closes-Bug: 1856587 Co-Authored-By: Steven Webster <steven.webster@windriver.com> Change-Id: I70f315669776a591e23e69c6653098e720815b99 Signed-off-by: Thomas Gao <Thomas.Gao@windriver.com>
This commit is contained in:
parent
f34ceeb0f5
commit
227ddec618
|
@ -339,7 +339,10 @@ class KubernetesPuppet(base.BasePuppet):
|
|||
interfaces = self._get_network_interfaces_by_class(ifclass)
|
||||
for iface in interfaces:
|
||||
|
||||
port = interface.get_sriov_interface_port(self.context, iface)
|
||||
if ifclass == constants.INTERFACE_CLASS_PCI_SRIOV:
|
||||
port = interface.get_sriov_interface_port(self.context, iface)
|
||||
else:
|
||||
port = interface.get_interface_port(self.context, iface)
|
||||
if not port:
|
||||
continue
|
||||
|
||||
|
|
|
@ -767,6 +767,16 @@ class InterfaceTestCase(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
|
|||
value = interface.get_sriov_interface_port(self.context, vf)
|
||||
self.assertEqual(value, port)
|
||||
|
||||
def test_get_sriov_interface_port_invalid(self):
|
||||
port, iface = self._create_ethernet_test('pthru',
|
||||
constants.INTERFACE_CLASS_PCI_PASSTHROUGH,
|
||||
constants.NETWORK_TYPE_PCI_PASSTHROUGH)
|
||||
self._update_context()
|
||||
self.assertRaises(AssertionError,
|
||||
interface.get_sriov_interface_port,
|
||||
self.context,
|
||||
iface)
|
||||
|
||||
def test_get_sriov_interface_vf_addrs(self):
|
||||
vf_addr1 = "0000:81:00.0"
|
||||
vf_addr2 = "0000:81:01.0"
|
||||
|
|
Loading…
Reference in New Issue