diff options
| author | Russell Bryant <rbryant@redhat.com> | 2013-06-10 21:18:37 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2013-06-14 11:38:22 -0400 |
| commit | 2bcdb2057188a1a1bd1731ff713631e8a30e4f20 (patch) | |
| tree | 774f85092371effcef463ff92fd17b3f1bf5a411 /nova/cells | |
| parent | 77595f8e08a61507ad5c7c990651fd4f8131c150 (diff) | |
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
Diffstat (limited to 'nova/cells')
| -rw-r--r-- | nova/cells/rpc_driver.py | 19 | ||||
| -rw-r--r-- | nova/cells/rpcapi.py | 19 |
2 files changed, 36 insertions, 2 deletions
diff --git a/nova/cells/rpc_driver.py b/nova/cells/rpc_driver.py index 0dcf1184c..6b11e0f05 100644 --- a/nova/cells/rpc_driver.py +++ b/nova/cells/rpc_driver.py @@ -34,6 +34,11 @@ CONF = cfg.CONF CONF.register_opts(cell_rpc_driver_opts, group='cells') CONF.import_opt('call_timeout', 'nova.cells.opts', group='cells') +rpcapi_cap_opt = cfg.StrOpt('intercell', + default=None, + help='Set a version cap for messages sent between cells services') +CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels') + _CELL_TO_CELL_RPC_API_VERSION = '1.0' @@ -103,9 +108,21 @@ class InterCellRPCAPI(rpc_proxy.RpcProxy): API version history: 1.0 - Initial version. + + ... Grizzly supports message version 1.0. 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 1.0. """ + + VERSION_ALIASES = { + 'grizzly': '1.0', + } + def __init__(self, default_version): - super(InterCellRPCAPI, self).__init__(None, default_version) + version_cap = self.VERSION_ALIASES.get(CONF.upgrade_levels.intercell, + CONF.upgrade_levels.intercell) + super(InterCellRPCAPI, self).__init__(None, default_version, + version_cap=version_cap) @staticmethod def _get_server_params_for_cell(next_hop): diff --git a/nova/cells/rpcapi.py b/nova/cells/rpcapi.py index 767498291..e65d8f490 100644 --- a/nova/cells/rpcapi.py +++ b/nova/cells/rpcapi.py @@ -33,6 +33,11 @@ CONF = cfg.CONF CONF.import_opt('enable', 'nova.cells.opts', group='cells') CONF.import_opt('topic', 'nova.cells.opts', group='cells') +rpcapi_cap_opt = cfg.StrOpt('cells', + default=None, + help='Set a version cap for messages sent to local cells services') +CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels') + class CellsAPI(rpc_proxy.RpcProxy): '''Cells client-side RPC API @@ -49,15 +54,27 @@ class CellsAPI(rpc_proxy.RpcProxy): 1.5 - Adds actions_get(), action_get_by_request_id(), and action_events_get() 1.6 - Adds consoleauth_delete_tokens() and validate_console_port() + + ... Grizzly supports message version 1.6. 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 1.6. + 1.7 - Adds service_update() 1.8 - Adds build_instances(), deprecates schedule_run_instance() 1.9 - Adds get_capacities() ''' BASE_RPC_API_VERSION = '1.0' + VERSION_ALIASES = { + 'grizzly': '1.6' + } + def __init__(self): + version_cap = self.VERSION_ALIASES.get(CONF.upgrade_levels.cells, + CONF.upgrade_levels.cells) super(CellsAPI, self).__init__(topic=CONF.cells.topic, - default_version=self.BASE_RPC_API_VERSION) + default_version=self.BASE_RPC_API_VERSION, + version_cap=version_cap) def cast_compute_api_method(self, ctxt, cell_name, method, *args, **kwargs): |
