diff --git a/doc/source/admin/pci-passthrough.rst b/doc/source/admin/pci-passthrough.rst index 764922d044..df4aa87e64 100644 --- a/doc/source/admin/pci-passthrough.rst +++ b/doc/source/admin/pci-passthrough.rst @@ -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 diff --git a/nova/compute/pci_placement_translator.py b/nova/compute/pci_placement_translator.py index 49d853b5fa..b0ad6ba4ae 100644 --- a/nova/compute/pci_placement_translator.py +++ b/nova/compute/pci_placement_translator.py @@ -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: diff --git a/nova/tests/functional/libvirt/test_pci_in_placement.py b/nova/tests/functional/libvirt/test_pci_in_placement.py index e731b123ba..c62f433a2b 100644 --- a/nova/tests/functional/libvirt/test_pci_in_placement.py +++ b/nova/tests/functional/libvirt/test_pci_in_placement.py @@ -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={}, + )