summaryrefslogtreecommitdiff
path: root/nova/tests/unit/pci
diff options
context:
space:
mode:
authorBalazs Gibizer <balazs.gibizer@est.tech>2020-10-08 14:27:44 +0200
committerBalazs Gibizer <balazs.gibizer@est.tech>2020-11-16 11:16:57 +0100
commit8c9d6fc8f073cde78b79ae259c9915216f5d59b0 (patch)
tree5b6a94041f588fd262d80f9ecc9217de23f71d25 /nova/tests/unit/pci
parent976ac722d36439d16ea4ec1bf5037c482c89ef55 (diff)
downloadnova-8c9d6fc8f073cde78b79ae259c9915216f5d59b0.tar.gz
Ignore PCI devices with 32bit domain
Nova and QEMU[1] supports PCI devices with a PCI address that has 16 bit domain. However there are hypervisors that reports PCI addresses with 32 bit domain. While today we cannot assign these to guests this should not prevent the nova-compute service to start. This patch changes the PCI manager to ignore such PCI devices. Please note that this patch does not change fact that nova does not allow specifying PCI addresses with 32bit domain in the [pci]/passthrough_whitelist configuration. Such configuration is still rejected at nova-compute service startup. Closes-Bug: #1897528 [1] https://github.com/qemu/qemu/blob/f2a1cf9180f63e88bb38ff21c169da97c3f2bad5/hw/core/qdev-properties.c#L993 Change-Id: I59a0746b864610b6a314078cf5661d3d2b84b1d4
Diffstat (limited to 'nova/tests/unit/pci')
-rw-r--r--nova/tests/unit/pci/test_manager.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/nova/tests/unit/pci/test_manager.py b/nova/tests/unit/pci/test_manager.py
index 19f08aa891..004cae380b 100644
--- a/nova/tests/unit/pci/test_manager.py
+++ b/nova/tests/unit/pci/test_manager.py
@@ -22,7 +22,6 @@ from oslo_utils.fixture import uuidsentinel
import nova
from nova.compute import vm_states
from nova import context
-from nova import exception
from nova import objects
from nova.objects import fields
from nova.pci import manager
@@ -237,7 +236,9 @@ class PciDevTrackerTestCase(test.NoDBTestCase):
tracker.update_devices_from_hypervisor_resources(fake_pci_devs_json)
self.assertEqual(2, len(tracker.pci_devs))
- def test_update_devices_from_hypervisor_resources_32bit_domain(self):
+ @mock.patch("nova.pci.manager.LOG.debug")
+ def test_update_devices_from_hypervisor_resources_32bit_domain(
+ self, mock_debug):
self.flags(
group='pci',
passthrough_whitelist=[
@@ -261,17 +262,13 @@ class PciDevTrackerTestCase(test.NoDBTestCase):
fake_pci_devs_json = jsonutils.dumps(fake_pci_devs)
tracker = manager.PciDevTracker(self.fake_context)
# We expect that the device with 32bit PCI domain is ignored
- # tracker.update_devices_from_hypervisor_resources(fake_pci_devs_json)
- # self.assertEqual(0, len(tracker.pci_devs))
- #
- # This is the bug 1897528
- ex = self.assertRaises(
- exception.PciConfigInvalidWhitelist,
- tracker.update_devices_from_hypervisor_resources,
- fake_pci_devs_json)
- self.assertEqual(
- 'Invalid PCI devices Whitelist config: property domain (10000) is '
- 'greater than the maximum allowable value (FFFF).', str(ex))
+ tracker.update_devices_from_hypervisor_resources(fake_pci_devs_json)
+ self.assertEqual(0, len(tracker.pci_devs))
+ mock_debug.assert_called_once_with(
+ 'Skipping PCI device %s reported by the hypervisor: %s',
+ {'address': '10000:00:02.0', 'parent_addr': None},
+ 'The property domain (10000) is greater than the maximum '
+ 'allowable value (FFFF).')
def test_set_hvdev_new_dev(self):
fake_pci_3 = dict(fake_pci, address='0000:00:00.4', vendor_id='v2')