Ignore PCI devs with physical_network tag

The first version of the PCI tracking in placement feature will not
handle Neutron based SRIOV devices. So those are now ignored during
placement inventory reporting.

blueprint: pci-device-tracking-in-placement
Change-Id: Ie24969d60c84379673c5450863f4cf58cf09207c
This commit is contained in:
Balazs Gibizer 2022-06-18 12:15:42 +02:00
parent 07f2bf8035
commit 10ba714125
3 changed files with 39 additions and 0 deletions

View File

@ -367,6 +367,13 @@ resource class can be customized via the ``resource_class`` tag in the
tag in that configuration that allows specifying a list of placement traits to
be added to the resource provider representing the matching PCI devices.
.. note::
In nova 26.0.0 (Zed) the Placement resource tracking of PCI devices does not
support SR-IOV devices intended to be consumed via Neutron ports and
therefore having ``physical_network`` tag in
:oslo.config:option:`pci.device_spec`. Such devices are supported via the
legacy PCI tracker code path in Nova.
.. note::
Having different resource class or traits configuration for VFs under the
same parent PF is not supported and the nova-compute service will refuse to

View File

@ -231,6 +231,13 @@ class PlacementView:
def add_dev(
self, dev: pci_device.PciDevice, dev_spec_tags: ty.Dict[str, str]
) -> None:
if dev_spec_tags.get("physical_network"):
# NOTE(gibi): We ignore devices that has physnet configured as
# those are there for Neutron based SRIOV and that is out of scope
# for now. Later these devices will be tracked as PCI_NETDEV
# devices in placement.
return
if dev.dev_type in PARENT_TYPES:
self._add_parent(dev, dev_spec_tags)
elif dev.dev_type in CHILD_TYPES:

View File

@ -284,3 +284,28 @@ class PlacementPCIReportingTests(test_pci_sriov_servers._PCIServersTestBase):
"and CUSTOM_FOO for 0000:81:00.1.",
str(ex)
)
def test_neutron_sriov_devs_ignored(self):
# The fake libvirt will emulate on the host:
# * one type-PF dev in slot 0 with one type-VF under it
pci_info = fakelibvirt.HostPCIDevicesInfo(
num_pci=0, num_pfs=1, num_vfs=1)
# then the config assigns physnet to the dev
device_spec = self._to_device_spec_conf(
[
{
"vendor_id": fakelibvirt.PCI_VEND_ID,
"product_id": fakelibvirt.PF_PROD_ID,
"physical_network": "physnet0",
},
]
)
self.flags(group='pci', device_spec=device_spec)
self.start_compute(hostname="compute1", pci_info=pci_info)
# As every matching dev has physnet configured they are ignored
self.assert_placement_pci_view(
"compute1",
inventories={},
traits={},
)