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/compute/rpcapi.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 98e90cf24..30db6010f 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -36,6 +36,11 @@ rpcapi_opts = [ CONF = cfg.CONF CONF.register_opts(rpcapi_opts) +rpcapi_cap_opt = cfg.StrOpt('compute', + default=None, + help='Set a version cap for messages sent to compute services') +CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels') + def _compute_topic(topic, ctxt, host, instance): '''Get the topic to use for a message. @@ -167,6 +172,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): vnc on the correct port 2.27 - Adds 'reservations' to terminate_instance() and soft_delete_instance() + + ... Grizzly supports message version 2.27. So, any changes to existing + methods in 2.x after that point should be done such that they can + handle the version_cap being set to 2.27. + 2.28 - Adds check_instance_shared_storage() 2.29 - Made start_instance() and stop_instance() take new-world instance objects @@ -182,11 +192,18 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): # BASE_RPC_API_VERSION = '2.0' + VERSION_ALIASES = { + 'grizzly': '2.27', + } + def __init__(self): + version_cap = self.VERSION_ALIASES.get(CONF.upgrade_levels.compute, + CONF.upgrade_levels.compute) super(ComputeAPI, self).__init__( topic=CONF.compute_topic, default_version=self.BASE_RPC_API_VERSION, - serializer=objects_base.NovaObjectSerializer()) + serializer=objects_base.NovaObjectSerializer(), + version_cap=version_cap) def add_aggregate_host(self, ctxt, aggregate, host_param, host, slave_info=None): -- cgit