From 26b7c43ca1fe94f937d6a6d89b3114ce9931c74d Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Sat, 21 Jan 2012 08:04:19 +0000 Subject: Make start_instance cast directly to compute host Fixes bug 918615 start_instance doesn't need to go through scheduler because it still has instance['host'] set and resources are still accounted for in the scheduler, which means there's still room to restart it on its assigned host (even though it is deleted from the virt layer) Change-Id: I3cdd73b7ad2297b57f7e36be84819ff233ac8f08 --- nova/tests/scheduler/test_multi_scheduler.py | 7 +++++-- nova/tests/scheduler/test_scheduler.py | 28 ---------------------------- 2 files changed, 5 insertions(+), 30 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/scheduler/test_multi_scheduler.py b/nova/tests/scheduler/test_multi_scheduler.py index cefc31b7e..7468a2447 100644 --- a/nova/tests/scheduler/test_multi_scheduler.py +++ b/nova/tests/scheduler/test_multi_scheduler.py @@ -31,7 +31,10 @@ class FakeComputeScheduler(driver.Scheduler): def schedule_run_instance(self, *args, **kwargs): pass - def schedule_start_instance(self, *args, **kwargs): + def schedule_live_migration(self, *args, **kwargs): + pass + + def schedule_prep_resize(self, *args, **kwargs): pass def schedule(self, *args, **kwargs): @@ -76,7 +79,7 @@ class MultiDriverTestCase(test_scheduler.SchedulerTestCase): compute_driver = mgr.drivers['compute'] volume_driver = mgr.drivers['volume'] - test_methods = {compute_driver: ['run_instance', 'start_instance'], + test_methods = {compute_driver: ['run_instance', 'prep_resize'], volume_driver: ['create_volume', 'create_volumes']} for driver, methods in test_methods.iteritems(): diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py index 19591c080..73b538768 100644 --- a/nova/tests/scheduler/test_scheduler.py +++ b/nova/tests/scheduler/test_scheduler.py @@ -231,34 +231,6 @@ class SchedulerManagerTestCase(test.TestCase): self.manager.run_instance(self.context, self.topic, *self.fake_args, **self.fake_kwargs) - def test_start_instance_exception_puts_instance_in_error_state(self): - """Test that an NoValidHost exception for start_instance puts - the instance in ERROR state and eats the exception. - """ - - fake_instance_id = 'fake-instance-id' - self.fake_kwargs['instance_id'] = fake_instance_id - - # Make sure the method exists that we're going to test call - def stub_method(*args, **kwargs): - pass - - setattr(self.manager.driver, 'schedule_start_instance', stub_method) - - self.mox.StubOutWithMock(self.manager.driver, - 'schedule_start_instance') - self.mox.StubOutWithMock(db, 'instance_update') - - self.manager.driver.schedule_start_instance(self.context, - *self.fake_args, **self.fake_kwargs).AndRaise( - exception.NoValidHost(reason="")) - db.instance_update(self.context, fake_instance_id, - {'vm_state': vm_states.ERROR}) - - self.mox.ReplayAll() - self.manager.start_instance(self.context, self.topic, - *self.fake_args, **self.fake_kwargs) - class SchedulerTestCase(test.TestCase): """Test case for base scheduler driver class""" -- cgit