From 035f05eb531cb8dd805685272d46ecd8cb0ad2b3 Mon Sep 17 00:00:00 2001 From: Nikola Dipanov Date: Tue, 3 Sep 2013 11:08:39 +0200 Subject: [PATCH] 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 --- nova/scheduler/rpcapi.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/nova/scheduler/rpcapi.py b/nova/scheduler/rpcapi.py index 11f8984c03f6..28ba4001a33d 100644 --- a/nova/scheduler/rpcapi.py +++ b/nova/scheduler/rpcapi.py @@ -70,7 +70,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.7 - Add select_destinations() 2.8 - Deprecate prep_resize() -- JUST KIDDING. It is still used 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 ''' @@ -103,13 +103,18 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): def run_instance(self, ctxt, request_spec, admin_password, injected_files, requested_networks, is_first_time, filter_properties, legacy_bdm_in_spec=True): - return self.cast(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, - legacy_bdm_in_spec=legacy_bdm_in_spec), version='2.9') + version = '2.0' + msg_kwargs = {'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} + 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, request_spec, filter_properties, reservations):

AltStyle によって変換されたページ (->オリジナル) /