Remove topic from scheduler run_instance.
This argument to run_instance was unused, so just remove it. Change-Id: I42366514285a2355f647c776af140effc1618b7d
This commit is contained in:
@@ -745,7 +745,7 @@ class API(base.Base):
|
||||
}
|
||||
|
||||
return self.scheduler_rpcapi.run_instance(context,
|
||||
topic=FLAGS.compute_topic, request_spec=request_spec,
|
||||
request_spec=request_spec,
|
||||
admin_password=admin_password, injected_files=injected_files,
|
||||
requested_networks=requested_networks, is_first_time=True,
|
||||
filter_properties=filter_properties,
|
||||
|
||||
@@ -598,7 +598,7 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
|
||||
LOG.debug(_("Re-scheduling instance: attempt %d"),
|
||||
retry['num_attempts'], instance_uuid=instance_uuid)
|
||||
self.scheduler_rpcapi.run_instance(context, FLAGS.compute_topic,
|
||||
self.scheduler_rpcapi.run_instance(context,
|
||||
request_spec, admin_password, injected_files,
|
||||
requested_networks, is_first_time, filter_properties,
|
||||
reservations=None, call=False)
|
||||
|
||||
@@ -60,7 +60,7 @@ class ChanceScheduler(driver.Scheduler):
|
||||
host = self._schedule(context, topic, None, filter_properties)
|
||||
driver.cast_to_host(context, topic, host, method, **kwargs)
|
||||
|
||||
def schedule_run_instance(self, context, topic, request_spec,
|
||||
def schedule_run_instance(self, context, request_spec,
|
||||
admin_password, injected_files,
|
||||
requested_networks, is_first_time,
|
||||
filter_properties, reservations):
|
||||
|
||||
@@ -192,7 +192,7 @@ class Scheduler(object):
|
||||
msg = _("Driver must implement schedule_prep_resize")
|
||||
raise NotImplementedError(msg)
|
||||
|
||||
def schedule_run_instance(self, context, topic, request_spec,
|
||||
def schedule_run_instance(self, context, request_spec,
|
||||
admin_password, injected_files,
|
||||
requested_networks, is_first_time,
|
||||
filter_properties, reservations):
|
||||
|
||||
@@ -51,7 +51,7 @@ class FilterScheduler(driver.Scheduler):
|
||||
msg = _("No host selection for %s defined.") % topic
|
||||
raise exception.NoValidHost(reason=msg)
|
||||
|
||||
def schedule_run_instance(self, context, topic, request_spec,
|
||||
def schedule_run_instance(self, context, request_spec,
|
||||
admin_password, injected_files,
|
||||
requested_networks, is_first_time,
|
||||
filter_properties, reservations):
|
||||
|
||||
@@ -53,7 +53,7 @@ QUOTAS = quota.QUOTAS
|
||||
class SchedulerManager(manager.Manager):
|
||||
"""Chooses a host to run instances on."""
|
||||
|
||||
RPC_API_VERSION = '1.1'
|
||||
RPC_API_VERSION = '1.2'
|
||||
|
||||
def __init__(self, scheduler_driver=None, *args, **kwargs):
|
||||
if not scheduler_driver:
|
||||
@@ -115,14 +115,14 @@ class SchedulerManager(manager.Manager):
|
||||
{'vm_state': vm_states.ERROR},
|
||||
context, ex, request_spec)
|
||||
|
||||
def run_instance(self, context, topic, request_spec, admin_password,
|
||||
def run_instance(self, context, request_spec, admin_password,
|
||||
injected_files, requested_networks, is_first_time,
|
||||
filter_properties, reservations):
|
||||
filter_properties, reservations, topic=None):
|
||||
"""Tries to call schedule_run_instance on the driver.
|
||||
Sets instance vm_state to ERROR on exceptions
|
||||
"""
|
||||
try:
|
||||
result = self.driver.schedule_run_instance(context, topic,
|
||||
result = self.driver.schedule_run_instance(context,
|
||||
request_spec, admin_password, injected_files,
|
||||
requested_networks, is_first_time, filter_properties,
|
||||
reservations)
|
||||
|
||||
@@ -36,6 +36,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
- remove instance_uuid, add instance
|
||||
- remove instance_type_id, add instance_type
|
||||
- remove topic, it was unused
|
||||
1.2 - Remove topic from run_instance, it was unused
|
||||
'''
|
||||
|
||||
BASE_RPC_API_VERSION = '1.0'
|
||||
@@ -44,17 +45,17 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
super(SchedulerAPI, self).__init__(topic=FLAGS.scheduler_topic,
|
||||
default_version=self.BASE_RPC_API_VERSION)
|
||||
|
||||
def run_instance(self, ctxt, topic, request_spec, admin_password,
|
||||
def run_instance(self, ctxt, request_spec, admin_password,
|
||||
injected_files, requested_networks, is_first_time,
|
||||
filter_properties, reservations, call=True):
|
||||
rpc_method = self.call if call else self.cast
|
||||
return rpc_method(ctxt, self.make_msg('run_instance', topic=topic,
|
||||
return rpc_method(ctxt, self.make_msg('run_instance',
|
||||
request_spec=request_spec, admin_password=admin_password,
|
||||
injected_files=injected_files,
|
||||
requested_networks=requested_networks,
|
||||
is_first_time=is_first_time,
|
||||
filter_properties=filter_properties,
|
||||
reservations=reservations))
|
||||
reservations=reservations), version='1.2')
|
||||
|
||||
def prep_resize(self, ctxt, instance, instance_type, image,
|
||||
update_db, request_spec, filter_properties):
|
||||
|
||||
@@ -118,7 +118,7 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
driver.encode_instance(instance2).AndReturn(instance2_encoded)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
result = self.driver.schedule_run_instance(ctxt, None, request_spec,
|
||||
result = self.driver.schedule_run_instance(ctxt, request_spec,
|
||||
None, None, None, None, {}, reservations)
|
||||
expected = [instance1_encoded, instance2_encoded]
|
||||
self.assertEqual(result, expected)
|
||||
@@ -178,7 +178,7 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
driver.encode_instance(instance2).AndReturn(instance2)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
self.driver.schedule_run_instance(ctxt, '', request_spec, None, None,
|
||||
self.driver.schedule_run_instance(ctxt, request_spec, None, None,
|
||||
None, None, {}, None)
|
||||
|
||||
def test_basic_schedule_run_instance_no_hosts(self):
|
||||
@@ -200,7 +200,7 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
self.assertRaises(exception.NoValidHost,
|
||||
self.driver.schedule_run_instance, ctxt, '', request_spec,
|
||||
self.driver.schedule_run_instance, ctxt, request_spec,
|
||||
None, None, None, None, {}, None)
|
||||
|
||||
def test_basic_schedule_fallback(self):
|
||||
|
||||
@@ -50,7 +50,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
'ephemeral_gb': 0},
|
||||
'instance_properties': {'project_id': 1}}
|
||||
self.assertRaises(exception.NoValidHost, sched.schedule_run_instance,
|
||||
fake_context, '', request_spec, None, None, None,
|
||||
fake_context, request_spec, None, None, None,
|
||||
None, {}, None)
|
||||
|
||||
def test_run_instance_non_admin(self):
|
||||
@@ -72,7 +72,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
request_spec = {'instance_type': {'memory_mb': 1, 'local_gb': 1},
|
||||
'instance_properties': {'project_id': 1}}
|
||||
self.assertRaises(exception.NoValidHost, sched.schedule_run_instance,
|
||||
fake_context, '', request_spec, None, None, None,
|
||||
fake_context, request_spec, None, None, None,
|
||||
None, {}, None)
|
||||
self.assertTrue(self.was_admin)
|
||||
|
||||
@@ -127,7 +127,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
{}, None, None, None, None).AndReturn(instance2)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
self.driver.schedule_run_instance(context_fake, '', request_spec,
|
||||
self.driver.schedule_run_instance(context_fake, request_spec,
|
||||
None, None, None, None, {}, None)
|
||||
|
||||
def test_schedule_happy_day(self):
|
||||
|
||||
@@ -66,19 +66,19 @@ class SchedulerRpcAPITestCase(test.TestCase):
|
||||
|
||||
def test_run_instance_call(self):
|
||||
self._test_scheduler_api('run_instance', rpc_method='call',
|
||||
topic='fake_topic', request_spec='fake_request_spec',
|
||||
request_spec='fake_request_spec',
|
||||
admin_password='pw', injected_files='fake_injected_files',
|
||||
requested_networks='fake_requested_networks',
|
||||
is_first_time=True, filter_properties='fake_filter_properties',
|
||||
reservations=None)
|
||||
reservations=None, version='1.2')
|
||||
|
||||
def test_run_instance_cast(self):
|
||||
self._test_scheduler_api('run_instance', rpc_method='cast',
|
||||
topic='fake_topic', request_spec='fake_request_spec',
|
||||
request_spec='fake_request_spec',
|
||||
admin_password='pw', injected_files='fake_injected_files',
|
||||
requested_networks='fake_requested_networks',
|
||||
is_first_time=True, filter_properties='fake_filter_properties',
|
||||
reservations=None)
|
||||
reservations=None, version='1.2')
|
||||
|
||||
def test_prep_resize(self):
|
||||
self._test_scheduler_api('prep_resize', rpc_method='cast',
|
||||
|
||||
@@ -221,14 +221,14 @@ class SchedulerManagerTestCase(test.TestCase):
|
||||
request_spec = {'instance_properties':
|
||||
{'uuid': fake_instance_uuid}}
|
||||
|
||||
self.manager.driver.schedule_run_instance(self.context, self.topic,
|
||||
self.manager.driver.schedule_run_instance(self.context,
|
||||
request_spec, None, None, None, None, {}, None).AndRaise(
|
||||
exception.NoValidHost(reason=""))
|
||||
db.instance_update_and_get_original(self.context, fake_instance_uuid,
|
||||
{"vm_state": vm_states.ERROR}).AndReturn((inst, inst))
|
||||
|
||||
self.mox.ReplayAll()
|
||||
self.manager.run_instance(self.context, self.topic, request_spec,
|
||||
self.manager.run_instance(self.context, request_spec,
|
||||
None, None, None, None, {}, None)
|
||||
|
||||
def test_prep_resize_no_valid_host_back_in_active_state(self):
|
||||
@@ -771,7 +771,7 @@ class SchedulerDriverBaseTestCase(SchedulerTestCase):
|
||||
|
||||
self.assertRaises(NotImplementedError,
|
||||
self.driver.schedule_run_instance,
|
||||
self.context, '', fake_request_spec, None, None, None,
|
||||
self.context, fake_request_spec, None, None, None,
|
||||
None, None, None)
|
||||
|
||||
def test_unimplemented_schedule_prep_resize(self):
|
||||
|
||||
Reference in New Issue
Block a user