Scheduler rpcapi 2.9 is not backwards compatible

Patch 552693e4ad51291c8bfd28cd1939ed3609f6eeac which added scheduler
rpcapi version 2.9 does not provide any backwards compatibility.

This patch adds the check using 'self.can_send_version', and falls
back to the latest Grizzly compatible version if it the version is
capped.

Also takes the opportunity to make the docstring more consistent in the
scheduler rpcapi SchedulerAPI class.

Closes-bug: #1220112

Change-Id: I5a1e08c1066cae00d47def45f7b87846f679cbbe
This commit is contained in:
Nikola Dipanov
2013-09-03 11:08:39 +02:00
parent 998ebee7dd
commit 167cdb576e

View File

@@ -70,7 +70,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
2.7 - Add select_destinations() 2.7 - Add select_destinations()
2.8 - Deprecate prep_resize() -- JUST KIDDING. It is still used 2.8 - Deprecate prep_resize() -- JUST KIDDING. It is still used
by the compute manager for retries. by the compute manager for retries.
2.9 - Added the leagacy_bdm_in_spec parameter to run_instances 2.9 - Added the leagacy_bdm_in_spec parameter to run_instance()
2.10 - Deprecated live_migration() call, moved to conductor 2.10 - Deprecated live_migration() call, moved to conductor
''' '''
@@ -103,13 +103,18 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
def run_instance(self, ctxt, request_spec, admin_password, def run_instance(self, ctxt, request_spec, admin_password,
injected_files, requested_networks, is_first_time, injected_files, requested_networks, is_first_time,
filter_properties, legacy_bdm_in_spec=True): filter_properties, legacy_bdm_in_spec=True):
return self.cast(ctxt, self.make_msg('run_instance', version = '2.0'
request_spec=request_spec, admin_password=admin_password, msg_kwargs = {'request_spec': request_spec,
injected_files=injected_files, 'admin_password': admin_password,
requested_networks=requested_networks, 'injected_files': injected_files,
is_first_time=is_first_time, 'requested_networks': requested_networks,
filter_properties=filter_properties, 'is_first_time': is_first_time,
legacy_bdm_in_spec=legacy_bdm_in_spec), version='2.9') 'filter_properties': filter_properties}
if self.can_send_version('2.9'):
version = '2.9'
msg_kwargs['legacy_bdm_in_spec'] = legacy_bdm_in_spec
return self.cast(ctxt, self.make_msg('run_instance', **msg_kwargs),
version=version)
def prep_resize(self, ctxt, instance, instance_type, image, def prep_resize(self, ctxt, instance, instance_type, image,
request_spec, filter_properties, reservations): request_spec, filter_properties, reservations):