Reset instance to ACTIVE when no hosts found
bug 928521 modified nova/scheduler/manager.py to reset vm_state to ACTIVE and set task_state to None when prep_resize raises a NoHostsFound refactored run_instance and prep_resize so they don't go through _schedule and now must be implemented in driver Changed behavior to set vm_state to error on any other exception in prep_resize. Change behavior to change instance vm_state to ERROR on exceptions Added tests that the vm_state gets updated Added tests that schedule_prep_resize and schedule_run_instance have no implementation in the Driver base class Had to adjust methods and tests for Multi scheduler to reflect the new Scheduler contract Change-Id: Ibcac7ef0df3456793a2132beb7a711849510da80
This commit is contained in:
@@ -41,10 +41,8 @@ FLAGS = flags.FLAGS
|
|||||||
FLAGS.register_opts(multi_scheduler_opts)
|
FLAGS.register_opts(multi_scheduler_opts)
|
||||||
|
|
||||||
# A mapping of methods to topics so we can figure out which driver to use.
|
# A mapping of methods to topics so we can figure out which driver to use.
|
||||||
_METHOD_MAP = {'run_instance': 'compute',
|
# There are currently no compute methods proxied through the map
|
||||||
'prep_resize': 'compute',
|
_METHOD_MAP = {'create_volume': 'volume',
|
||||||
'live_migration': 'compute',
|
|
||||||
'create_volume': 'volume',
|
|
||||||
'create_volumes': 'volume'}
|
'create_volumes': 'volume'}
|
||||||
|
|
||||||
|
|
||||||
@@ -75,3 +73,9 @@ class MultiScheduler(driver.Scheduler):
|
|||||||
def schedule(self, context, topic, method, *_args, **_kwargs):
|
def schedule(self, context, topic, method, *_args, **_kwargs):
|
||||||
return self.drivers[topic].schedule(context, topic,
|
return self.drivers[topic].schedule(context, topic,
|
||||||
method, *_args, **_kwargs)
|
method, *_args, **_kwargs)
|
||||||
|
|
||||||
|
def schedule_run_instance(self, *args, **kwargs):
|
||||||
|
return self.drivers['compute'].schedule_run_instance(*args, **kwargs)
|
||||||
|
|
||||||
|
def schedule_prep_resize(self, *args, **kwargs):
|
||||||
|
return self.drivers['compute'].schedule_prep_resize(*args, **kwargs)
|
||||||
|
@@ -28,13 +28,7 @@ from nova.tests.scheduler import test_scheduler
|
|||||||
class FakeComputeScheduler(driver.Scheduler):
|
class FakeComputeScheduler(driver.Scheduler):
|
||||||
is_fake_compute = True
|
is_fake_compute = True
|
||||||
|
|
||||||
def schedule_run_instance(self, *args, **kwargs):
|
def schedule_theoretical(self, *args, **kwargs):
|
||||||
pass
|
|
||||||
|
|
||||||
def schedule_live_migration(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def schedule_prep_resize(self, *args, **kwargs):
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def schedule(self, *args, **kwargs):
|
def schedule(self, *args, **kwargs):
|
||||||
@@ -79,7 +73,8 @@ class MultiDriverTestCase(test_scheduler.SchedulerTestCase):
|
|||||||
compute_driver = mgr.drivers['compute']
|
compute_driver = mgr.drivers['compute']
|
||||||
volume_driver = mgr.drivers['volume']
|
volume_driver = mgr.drivers['volume']
|
||||||
|
|
||||||
test_methods = {compute_driver: ['run_instance', 'prep_resize'],
|
#no compute methods are proxied at this time
|
||||||
|
test_methods = {compute_driver: [],
|
||||||
volume_driver: ['create_volume', 'create_volumes']}
|
volume_driver: ['create_volume', 'create_volumes']}
|
||||||
|
|
||||||
for driver, methods in test_methods.iteritems():
|
for driver, methods in test_methods.iteritems():
|
||||||
|
Reference in New Issue
Block a user