def setUp(self): # setup plumbing for a working resource tracker with required # database models and a compatible compute driver: super(BaseTrackerTestCase, self).setUp() self.tracker = self._tracker() self._migrations = {} self._fake_inventories = {} self.stub_out('nova.db.compute_node_get_by_host_and_nodename', self._fake_compute_node_get_by_host_and_nodename) self.stub_out('nova.db.compute_node_get', self._fake_compute_node_get) self.stub_out('nova.db.compute_node_update', self._fake_compute_node_update) self.stub_out('nova.db.migration_update', self._fake_migration_update) self.stub_out('nova.db.migration_get_in_progress_by_host_and_node', self._fake_migration_get_in_progress_by_host_and_node) self.stub_out('nova.objects.resource_provider._create_inventory_in_db', self._fake_inventory_create) self.stub_out('nova.objects.resource_provider._create_rp_in_db', self._fake_rp_create) # Note that this must be called before the call to _init_tracker() patcher = pci_fakes.fake_pci_whitelist() self.addCleanup(patcher.stop) self._init_tracker() self.limits = self._limits()
def setUp(self): super(PciDeviceStatsTestCase, self).setUp() self.pci_stats = stats.PciDeviceStats() # The following two calls need to be made before adding the devices. patcher = fakes.fake_pci_whitelist() self.addCleanup(patcher.stop) self._create_fake_devs()
def setUp(self): super(PciDevTrackerTestCase, self).setUp() self.stubs.Set(db, 'pci_device_get_all_by_node', self._fake_get_pci_devices) # The fake_pci_whitelist must be called before creating the fake # devices patcher = pci_fakes.fake_pci_whitelist() self.addCleanup(patcher.stop) self._create_fake_instance() self.tracker = manager.PciDevTracker(1)
def setUp(self): super(PciDevTrackerTestCase, self).setUp() self.fake_context = context.get_admin_context() self.stub_out('nova.db.pci_device_get_all_by_node', self._fake_get_pci_devices) # The fake_pci_whitelist must be called before creating the fake # devices patcher = pci_fakes.fake_pci_whitelist() self.addCleanup(patcher.stop) self._create_fake_instance() self.tracker = manager.PciDevTracker(self.fake_context, 1)
def _setup_pci_stats(self, numa_topology=None): """Exists for tests that need to setup pci_stats with a specific NUMA topology, while still allowing tests that don't care to get the default "empty" one. """ if not numa_topology: numa_topology = objects.NUMATopology() self.pci_stats = stats.PciDeviceStats(numa_topology) # The following two calls need to be made before adding the devices. patcher = fakes.fake_pci_whitelist() self.addCleanup(patcher.stop) self._create_fake_devs()
def setUp(self): super(PciDevTrackerTestCase, self).setUp() self.fake_context = context.get_admin_context() self.fake_devs = fake_db_devs[:] self.stub_out('nova.db.pci_device_get_all_by_node', self._fake_get_pci_devices) # The fake_pci_whitelist must be called before creating the fake # devices patcher = pci_fakes.fake_pci_whitelist() self.addCleanup(patcher.stop) self._create_fake_instance() self._create_tracker(fake_db_devs[:]) self.stubs.Set(db, 'compute_node_get_by_host_and_nodename', self._fake_compute_node_get_by_host_and_nodename) self.stubs.Set(db, 'service_get', _fake_service_get)