22
22
import nova
23
23
from nova .compute import vm_states
24
24
from nova import context
25
- from nova import exception
26
25
from nova import objects
27
26
from nova .objects import fields
28
27
from nova .pci import manager
@@ -237,7 +236,9 @@ def test_update_devices_from_hypervisor_resources(self, _mock_dev_assign):
237
236
tracker .update_devices_from_hypervisor_resources (fake_pci_devs_json )
238
237
self .assertEqual (2 , len (tracker .pci_devs ))
239
238
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 ):
241
242
self .flags (
242
243
group = 'pci' ,
243
244
passthrough_whitelist = [
@@ -261,17 +262,13 @@ def test_update_devices_from_hypervisor_resources_32bit_domain(self):
261
262
fake_pci_devs_json = jsonutils .dumps (fake_pci_devs )
262
263
tracker = manager .PciDevTracker (self .fake_context )
263
264
# 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).' )
275
272
276
273
def test_set_hvdev_new_dev (self ):
277
274
fake_pci_3 = dict (fake_pci , address = '0000:00:00.4' , vendor_id = 'v2' )
0 commit comments