summaryrefslogtreecommitdiff
path: root/nova/pci
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-12-23 13:26:43 +0000
committerGerrit Code Review <review@openstack.org>2020-12-23 13:26:43 +0000
commit96e9124ad705df82fb4866c9241fac5e5e98b761 (patch)
treee02f91035014b20918c6cc6510c3f45312321aac /nova/pci
parentd41bcf9d91b1ff11f7bd9d2e557ce1751b460546 (diff)
parent8c9d6fc8f073cde78b79ae259c9915216f5d59b0 (diff)
downloadnova-96e9124ad705df82fb4866c9241fac5e5e98b761.tar.gz
Merge "Ignore PCI devices with 32bit domain"
Diffstat (limited to 'nova/pci')
-rw-r--r--nova/pci/manager.py38
1 files changed, 36 insertions, 2 deletions
diff --git a/nova/pci/manager.py b/nova/pci/manager.py
index a7b4f346f9..0c823934fa 100644
--- a/nova/pci/manager.py
+++ b/nova/pci/manager.py
@@ -117,8 +117,42 @@ class PciDevTracker(object):
devices = []
for dev in jsonutils.loads(devices_json):
- if self.dev_filter.device_assignable(dev):
- devices.append(dev)
+ try:
+ if self.dev_filter.device_assignable(dev):
+ devices.append(dev)
+ except exception.PciConfigInvalidWhitelist as e:
+ # The raised exception is misleading as the problem is not with
+ # the whitelist config but with the host PCI device reported by
+ # libvirt. The code that matches the host PCI device to the
+ # withelist spec reuses the WhitelistPciAddress object to parse
+ # the host PCI device address. That parsing can fail if the
+ # PCI address has a 32 bit domain. But this should not prevent
+ # processing the rest of the devices. So we simply skip this
+ # device and continue.
+ # Please note that this except block does not ignore the
+ # invalid whitelist configuration. The whitelist config has
+ # already been parsed or rejected in case it was invalid. At
+ # this point the self.dev_filter representes the parsed and
+ # validated whitelist config.
+ LOG.debug(
+ 'Skipping PCI device %s reported by the hypervisor: %s',
+ {k: v for k, v in dev.items()
+ if k in ['address', 'parent_addr']},
+ # NOTE(gibi): this is ugly but the device_assignable() call
+ # uses the PhysicalPciAddress class to parse the PCI
+ # addresses and that class reuses the code from
+ # PciAddressSpec that was originally designed to parse
+ # whitelist spec. Hence the raised exception talks about
+ # whitelist config. This is misleading as in our case the
+ # PCI address that we failed to parse came from the
+ # hypervisor.
+ # TODO(gibi): refactor the false abstraction to make the
+ # code reuse clean from the false assumption that we only
+ # parse whitelist config with
+ # devspec.PciAddressSpec._set_pci_dev_info()
+ str(e).replace(
+ 'Invalid PCI devices Whitelist config:', 'The'))
+
self._set_hvdevs(devices)
@staticmethod