From 2bcdb2057188a1a1bd1731ff713631e8a30e4f20 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Mon, 10 Jun 2013 21:18:37 -0400 Subject: Add rpc client side version control. This is a first pass at client side version control for rpc. It allows you to configure a max version of messages that clients are allowed to send. You can find one example of how clients need to adapt in the conductor rpcapi. All other changes in rpc apis since the grizzly release are not applicable to this. Some future improvements to this could be reporting the versions supported by running services and having that be discoverable via the API. We could also consider allow setting these client side version caps via the API. For now, recommended values for these config options while attempting a rolling upgrade will just have to be documented. The config options allow specifying specific rpc api version numbers if desired, but an alias of 'grizzly' is also supported. So typically at the start of a rolling upgrade you'd have: [upgrade_levels] compute=grizzly conductor=grizzly scheduler=grizzly ... etc ... And as you update all instances of a service, you would remove that bit from your configuration across the deployment using your config management system of choice. DocImpact Implements blueprint rpc-version-control. Change-Id: I2c0fd6dd7484c87823846d7c31d6525d93cd1b43 --- nova/baserpc.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'nova/baserpc.py') diff --git a/nova/baserpc.py b/nova/baserpc.py index 1cb474209..b166cb400 100644 --- a/nova/baserpc.py +++ b/nova/baserpc.py @@ -18,11 +18,20 @@ Base RPC client and server common to all services. """ +from oslo.config import cfg + from nova.openstack.common import jsonutils from nova.openstack.common import rpc import nova.openstack.common.rpc.proxy as rpc_proxy +CONF = cfg.CONF +rpcapi_cap_opt = cfg.StrOpt('baseapi', + default=None, + help='Set a version cap for messages sent to the base api in any ' + 'service') +CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels') + _NAMESPACE = 'baseapi' @@ -45,9 +54,16 @@ class BaseAPI(rpc_proxy.RpcProxy): # BASE_RPC_API_VERSION = '1.0' + VERSION_ALIASES = { + # baseapi was added in havana + } + def __init__(self, topic): + version_cap = self.VERSION_ALIASES.get(CONF.upgrade_levels.baseapi, + CONF.upgrade_levels.baseapi) super(BaseAPI, self).__init__(topic=topic, - default_version=self.BASE_RPC_API_VERSION) + default_version=self.BASE_RPC_API_VERSION, + version_cap=version_cap) self.namespace = _NAMESPACE def ping(self, context, arg, timeout=None): -- cgit