def setUp(self): super(TestNovaManagePlacementSyncAggregates, self).setUp() self.cli = manage.PlacementCommands() # Start two computes. At least two computes are useful for testing # to make sure removing one from an aggregate doesn't remove the other. self._start_compute('host1') self._start_compute('host2') # Make sure we have two hypervisors reported in the API. hypervisors = self.admin_api.api_get( '/os-hypervisors').body['hypervisors'] self.assertEqual(2, len(hypervisors)) self.output = StringIO() self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output))
def setUp(self): # Since the CachingScheduler does not use Placement, we want to use # the CachingScheduler to create instances and then we can heal their # allocations via the CLI. self.flags(driver='caching_scheduler', group='scheduler') super(TestNovaManagePlacementHealAllocations, self).setUp() self.cli = manage.PlacementCommands() # We need to start a compute in each non-cell0 cell. for cell_name, cell_mapping in self.cell_mappings.items(): if cell_mapping.uuid == objects.CellMapping.CELL0_UUID: continue self._start_compute(cell_name, cell_name=cell_name) # Make sure we have two hypervisors reported in the API. hypervisors = self.admin_api.api_get( '/os-hypervisors').body['hypervisors'] self.assertEqual(2, len(hypervisors)) self.flavor = self.api.get_flavors()[0] self.output = StringIO() self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output))
def setUp(self): super(TestNovaManagePlacementHealAllocations, self).setUp() self.cli = manage.PlacementCommands() # We need to start a compute in each non-cell0 cell. for cell_name, cell_mapping in self.cell_mappings.items(): if cell_mapping.uuid == objects.CellMapping.CELL0_UUID: continue self._start_compute(cell_name, cell_name=cell_name) # Make sure we have two hypervisors reported in the API. hypervisors = self.admin_api.api_get( '/os-hypervisors').body['hypervisors'] self.assertEqual(2, len(hypervisors)) self.flavor = self.api.get_flavors()[0] self.output = StringIO() self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output)) # We need to mock the FilterScheduler to not use Placement so that # allocations won't be created during scheduling and then we can heal # them in the CLI. self.scheduler_service.manager.driver.USES_ALLOCATION_CANDIDATES = \ False