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:
@@ -36,7 +36,6 @@ flags.DEFINE_string('volume_scheduler_driver',
|
||||
|
||||
# A mapping of methods to topics so we can figure out which driver to use.
|
||||
_METHOD_MAP = {'run_instance': 'compute',
|
||||
'start_instance': 'compute',
|
||||
'prep_resize': 'compute',
|
||||
'live_migration': 'compute',
|
||||
'create_volume': 'volume',
|
||||
|
@@ -100,13 +100,6 @@ class SimpleScheduler(chance.ChanceScheduler):
|
||||
del request_spec['instance_properties']['uuid']
|
||||
return instances
|
||||
|
||||
def schedule_start_instance(self, context, instance_id, *_args, **_kwargs):
|
||||
instance_ref = db.instance_get(context, instance_id)
|
||||
host = self._schedule_instance(context, instance_ref,
|
||||
*_args, **_kwargs)
|
||||
driver.cast_to_compute_host(context, host, 'start_instance',
|
||||
instance_id=instance_id, **_kwargs)
|
||||
|
||||
def schedule_create_volume(self, context, volume_id, *_args, **_kwargs):
|
||||
"""Picks a host that is up and has the fewest volumes."""
|
||||
elevated = context.elevated()
|
||||
|
@@ -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():
|
||||
|
Reference in New Issue
Block a user