diff options
author | Russell Bryant <rbryant@redhat.com> | 2013-04-10 00:59:03 +0200 |
---|---|---|
committer | Russell Bryant <rbryant@redhat.com> | 2013-04-24 15:02:56 -0400 |
commit | ddb3199318bf91e76b4c4e7330956ee581c91ccc (patch) | |
tree | 5e9789b714483481d6d1b68d94debb92ed42ab0c /nova/baserpc.py | |
parent | a025d7eee28026cb21cb0e732e6510d5d9b7d96f (diff) | |
download | nova-ddb3199318bf91e76b4c4e7330956ee581c91ccc.tar.gz nova-ddb3199318bf91e76b4c4e7330956ee581c91ccc.tar.xz nova-ddb3199318bf91e76b4c4e7330956ee581c91ccc.zip |
Move get_backdoor_port to base rpc API.
Each service implemented the get_backdoor_port method individually. This
patch moves the implementation of this method to the base rpc API
instead, and removes the now unnecessary code from each of the services.
The server side method was left on all of the managers for rpc backwards
copmatibility. They can be removed on the next major rpc version bump
of those APIs.
Part of blueprint base-rpc-api.
Change-Id: Ia8838fafd80eb86a1c2d66f5e97370042d8d8c53
Diffstat (limited to 'nova/baserpc.py')
-rw-r--r-- | nova/baserpc.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/nova/baserpc.py b/nova/baserpc.py index 803a1b614..1cb474209 100644 --- a/nova/baserpc.py +++ b/nova/baserpc.py @@ -19,6 +19,7 @@ Base RPC client and server common to all services. """ from nova.openstack.common import jsonutils +from nova.openstack.common import rpc import nova.openstack.common.rpc.proxy as rpc_proxy @@ -31,6 +32,7 @@ class BaseAPI(rpc_proxy.RpcProxy): API version history: 1.0 - Initial version. + 1.1 - Add get_backdoor_port """ # @@ -53,16 +55,26 @@ class BaseAPI(rpc_proxy.RpcProxy): msg = self.make_namespaced_msg('ping', self.namespace, arg=arg_p) return self.call(context, msg, timeout=timeout) + def get_backdoor_port(self, context, host): + msg = self.make_namespaced_msg('get_backdoor_port', self.namespace) + return self.call(context, msg, + topic=rpc.queue_get_for(context, self.topic, host), + version='1.1') + class BaseRPCAPI(object): """Server side of the base RPC API.""" RPC_API_NAMESPACE = _NAMESPACE - RPC_API_VERSION = '1.0' + RPC_API_VERSION = '1.1' - def __init__(self, service_name): + def __init__(self, service_name, backdoor_port): self.service_name = service_name + self.backdoor_port = backdoor_port def ping(self, context, arg): resp = {'service': self.service_name, 'arg': arg} return jsonutils.to_primitive(resp) + + def get_backdoor_port(self, context): + return self.backdoor_port |