Skip to content

Commit 0354d4d

Browse files
Balazs Gibizerstephenfin
authored andcommitted
Reproduce bug 1897528
The nova-compute fails to start if the hypervisor has PCI addresses 32bit domain. Change-Id: I48dcb7faa17fe9f8346445a1746cff5845baf358 Related-Bug: #1897528 (cherry picked from commit 976ac72)
1 parent e954a56 commit 0354d4d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

nova/tests/unit/pci/test_manager.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import nova
2323
from nova.compute import vm_states
2424
from nova import context
25+
from nova import exception
2526
from nova import objects
2627
from nova.objects import fields
2728
from nova.pci import manager
@@ -236,6 +237,42 @@ def test_update_devices_from_hypervisor_resources(self, _mock_dev_assign):
236237
tracker.update_devices_from_hypervisor_resources(fake_pci_devs_json)
237238
self.assertEqual(2, len(tracker.pci_devs))
238239

240+
def test_update_devices_from_hypervisor_resources_32bit_domain(self):
241+
self.flags(
242+
group='pci',
243+
passthrough_whitelist=[
244+
'{"product_id":"2032", "vendor_id":"8086"}'])
245+
# There are systems where 32 bit PCI domain is used. See bug 1897528
246+
# for example. While nova (and qemu) does not support assigning such
247+
# devices but the existence of such device in the system should not
248+
# lead to an error.
249+
fake_pci = {
250+
'compute_node_id': 1,
251+
'address': '10000:00:02.0',
252+
'product_id': '2032',
253+
'vendor_id': '8086',
254+
'request_id': None,
255+
'status': fields.PciDeviceStatus.AVAILABLE,
256+
'dev_type': fields.PciDeviceType.STANDARD,
257+
'parent_addr': None,
258+
'numa_node': 0}
259+
260+
fake_pci_devs = [fake_pci]
261+
fake_pci_devs_json = jsonutils.dumps(fake_pci_devs)
262+
tracker = manager.PciDevTracker(self.fake_context)
263+
# We expect that the device with 32bit PCI domain is ignored
264+
# tracker.update_devices_from_hypervisor_resources(fake_pci_devs_json)
265+
# self.assertEqual(0, len(tracker.pci_devs))
266+
#
267+
# This is the bug 1897528
268+
ex = self.assertRaises(
269+
exception.PciConfigInvalidWhitelist,
270+
tracker.update_devices_from_hypervisor_resources,
271+
fake_pci_devs_json)
272+
self.assertEqual(
273+
'Invalid PCI devices Whitelist config: property domain (10000) is '
274+
'greater than the maximum allowable value (FFFF).', str(ex))
275+
239276
def test_set_hvdev_new_dev(self):
240277
fake_pci_3 = dict(fake_pci, address='0000:00:00.4', vendor_id='v2')
241278
fake_pci_devs = [copy.deepcopy(fake_pci), copy.deepcopy(fake_pci_1),

0 commit comments

Comments
 (0)