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
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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"""
|
||||
|
||||
Reference in New Issue
Block a user