2222import nova
2323from nova .compute import vm_states
2424from nova import context
25- from nova import exception
2625from nova import objects
2726from nova .objects import fields
2827from nova .pci import manager
@@ -237,7 +236,9 @@ def test_update_devices_from_hypervisor_resources(self, _mock_dev_assign):
237236 tracker .update_devices_from_hypervisor_resources (fake_pci_devs_json )
238237 self .assertEqual (2 , len (tracker .pci_devs ))
239238
240- def test_update_devices_from_hypervisor_resources_32bit_domain (self ):
239+ @mock .patch ("nova.pci.manager.LOG.debug" )
240+ def test_update_devices_from_hypervisor_resources_32bit_domain (
241+ self , mock_debug ):
241242 self .flags (
242243 group = 'pci' ,
243244 passthrough_whitelist = [
@@ -261,17 +262,13 @@ def test_update_devices_from_hypervisor_resources_32bit_domain(self):
261262 fake_pci_devs_json = jsonutils .dumps (fake_pci_devs )
262263 tracker = manager .PciDevTracker (self .fake_context )
263264 # 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 ))
265+ tracker .update_devices_from_hypervisor_resources (fake_pci_devs_json )
266+ self .assertEqual (0 , len (tracker .pci_devs ))
267+ mock_debug .assert_called_once_with (
268+ 'Skipping PCI device %s reported by the hypervisor: %s' ,
269+ {'address' : '10000:00:02.0' , 'parent_addr' : None },
270+ 'The property domain (10000) is greater than the maximum '
271+ 'allowable value (FFFF).' )
275272
276273 def test_set_hvdev_new_dev (self ):
277274 fake_pci_3 = dict (fake_pci , address = '0000:00:00.4' , vendor_id = 'v2' )
0 commit comments