diff --git a/nova/virt/libvirt/host.py b/nova/virt/libvirt/host.py index 1de93137b590..ade1ef620031 100644 --- a/nova/virt/libvirt/host.py +++ b/nova/virt/libvirt/host.py @@ -1269,11 +1269,24 @@ class Host(object): } parent_ifname = None # NOTE(sean-k-mooney): if the VF is a parent of a netdev - # the PF should also have a netdev. + # the PF should also have a netdev, however on some exotic + # hardware such as Cavium ThunderX this may not be the case + # see bug #1915255 for details. As such we wrap this in a + # try except block. if device.name() in net_dev_parents: - parent_ifname = pci_utils.get_ifname_by_pci_address( - pci_address, pf_interface=True) - result['parent_ifname'] = parent_ifname + try: + parent_ifname = ( + pci_utils.get_ifname_by_pci_address( + pci_address, pf_interface=True)) + result['parent_ifname'] = parent_ifname + except exception.PciDeviceNotFoundById: + # NOTE(sean-k-mooney): we ignore this error as it + # is expected when the virtual function is not a + # NIC or the VF does not have a parent PF with a + # netdev. We do not log here as this is called + # in a periodic task and that would be noisy at + # debug level. + pass if device.name() in vdpa_parents: result['dev_type'] = fields.PciDeviceType.VDPA return result diff --git a/releasenotes/notes/fix-pci-passthrough-for-cavium-thunderx-8fbd1c40718569e2.yaml b/releasenotes/notes/fix-pci-passthrough-for-cavium-thunderx-8fbd1c40718569e2.yaml new file mode 100644 index 000000000000..8166b4c2abcf --- /dev/null +++ b/releasenotes/notes/fix-pci-passthrough-for-cavium-thunderx-8fbd1c40718569e2.yaml @@ -0,0 +1,12 @@ +--- +fixes: + - | + On some hardware platforms, an SR-IOV virtual function for a NIC port may + exist without being associated with a parent physical function that has + an assocatied netdev. In such a case the the PF interface name lookup + will fail. As the ``PciDeviceNotFoundById`` exception was not handled + this would prevent the nova compute agent from starting on affected + hardware. See: https://bugs.launchpad.net/nova/+bug/1915255 for more + details. This edgecase has now been addressed, however, features + that depend on the PF name such as minimum bandwidth based QoS cannot + be supported on these platforms.