From 5465d13b13569db1e0dbd4255a2d68e525a43481 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 11 Sep 2012 13:17:04 -0400 Subject: fix rpcapi version. In commit ce4dbbd7, the BASE_RPC_API_VERSION was changed to '2.1' in nova.compute.rpcapi. This should remain '2.0' until the API goes to 3.X. Only specify version '2.1' for the method that requires it (rebuild_instance). Add a NOTE above each instance of BASE_RPC_API_VERSION to try to help clarify this for the future. Change-Id: I06cef44c905e8966505d5fb5b1046d6a0c75d533 --- nova/cert/rpcapi.py | 8 ++++++++ nova/compute/rpcapi.py | 23 ++++++++++++++++++++--- nova/console/rpcapi.py | 8 ++++++++ nova/consoleauth/rpcapi.py | 8 ++++++++ nova/scheduler/rpcapi.py | 8 ++++++++ nova/tests/compute/test_rpcapi.py | 2 +- 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/nova/cert/rpcapi.py b/nova/cert/rpcapi.py index 7922c9c33..8051f2a93 100644 --- a/nova/cert/rpcapi.py +++ b/nova/cert/rpcapi.py @@ -33,6 +33,14 @@ class CertAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.0 - Initial version. ''' + # + # NOTE(russellb): This is the default minimum version that the server + # (manager) side must implement unless otherwise specified using a version + # argument to self.call()/cast()/etc. here. It should be left as X.0 where + # X is the current major API version (1.0, 2.0, ...). For more information + # about rpc API versioning, see the docs in + # openstack/common/rpc/dispatcher.py. + # BASE_RPC_API_VERSION = '1.0' def __init__(self): diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 24576881f..b53cc1e7a 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -127,10 +127,18 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.44 - Adds reserve_block_device_name() 2.0 - Remove 1.x backwards compat - 2.1 - Adds orig_sys_metadata to rebuild() + 2.1 - Adds orig_sys_metadata to rebuild_instance() ''' - BASE_RPC_API_VERSION = '2.1' + # + # NOTE(russellb): This is the default minimum version that the server + # (manager) side must implement unless otherwise specified using a version + # argument to self.call()/cast()/etc. here. It should be left as X.0 where + # X is the current major API version (1.0, 2.0, ...). For more information + # about rpc API versioning, see the docs in + # openstack/common/rpc/dispatcher.py. + # + BASE_RPC_API_VERSION = '2.0' def __init__(self): super(ComputeAPI, self).__init__( @@ -340,7 +348,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): injected_files=injected_files, image_ref=image_ref, orig_image_ref=orig_image_ref, orig_sys_metadata=orig_sys_metadata), - topic=_compute_topic(self.topic, ctxt, None, instance)) + topic=_compute_topic(self.topic, ctxt, None, instance), + version='2.1') def refresh_provider_fw_rules(self, ctxt, host): self.cast(ctxt, self.make_msg('refresh_provider_fw_rules'), @@ -503,6 +512,14 @@ class SecurityGroupAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.0 - Remove 1.x backwards compat ''' + # + # NOTE(russellb): This is the default minimum version that the server + # (manager) side must implement unless otherwise specified using a version + # argument to self.call()/cast()/etc. here. It should be left as X.0 where + # X is the current major API version (1.0, 2.0, ...). For more information + # about rpc API versioning, see the docs in + # openstack/common/rpc/dispatcher.py. + # BASE_RPC_API_VERSION = '2.0' def __init__(self): diff --git a/nova/console/rpcapi.py b/nova/console/rpcapi.py index 6a5e2149b..a1f289bb0 100644 --- a/nova/console/rpcapi.py +++ b/nova/console/rpcapi.py @@ -33,6 +33,14 @@ class ConsoleAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.0 - Initial version. ''' + # + # NOTE(russellb): This is the default minimum version that the server + # (manager) side must implement unless otherwise specified using a version + # argument to self.call()/cast()/etc. here. It should be left as X.0 where + # X is the current major API version (1.0, 2.0, ...). For more information + # about rpc API versioning, see the docs in + # openstack/common/rpc/dispatcher.py. + # BASE_RPC_API_VERSION = '1.0' def __init__(self, topic=None): diff --git a/nova/consoleauth/rpcapi.py b/nova/consoleauth/rpcapi.py index 573387f48..2fafe3fd0 100644 --- a/nova/consoleauth/rpcapi.py +++ b/nova/consoleauth/rpcapi.py @@ -33,6 +33,14 @@ class ConsoleAuthAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.0 - Initial version. ''' + # + # NOTE(russellb): This is the default minimum version that the server + # (manager) side must implement unless otherwise specified using a version + # argument to self.call()/cast()/etc. here. It should be left as X.0 where + # X is the current major API version (1.0, 2.0, ...). For more information + # about rpc API versioning, see the docs in + # openstack/common/rpc/dispatcher.py. + # BASE_RPC_API_VERSION = '1.0' def __init__(self): diff --git a/nova/scheduler/rpcapi.py b/nova/scheduler/rpcapi.py index b7f6b3113..940fe315e 100644 --- a/nova/scheduler/rpcapi.py +++ b/nova/scheduler/rpcapi.py @@ -46,6 +46,14 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.0 - Remove 1.x backwards compat ''' + # + # NOTE(russellb): This is the default minimum version that the server + # (manager) side must implement unless otherwise specified using a version + # argument to self.call()/cast()/etc. here. It should be left as X.0 where + # X is the current major API version (1.0, 2.0, ...). For more information + # about rpc API versioning, see the docs in + # openstack/common/rpc/dispatcher.py. + # BASE_RPC_API_VERSION = '2.0' def __init__(self): diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index eb78a53e7..5728bdf91 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -227,7 +227,7 @@ class ComputeRpcAPITestCase(test.TestCase): instance=self.fake_instance, new_pass='pass', injected_files='files', image_ref='ref', orig_image_ref='orig_ref', - orig_sys_metadata='orig_sys_metadata') + orig_sys_metadata='orig_sys_metadata', version='2.1') def test_reserve_block_device_name(self): self._test_compute_api('reserve_block_device_name', 'call', -- cgit