Make security_groups_provider_updated work with Kilo agents

Initially, we bumped the required version for the agent endpoint from
1.1 (the initial version that implemented security groups) to 1.3
without considering that the code should work with old agents that do
not yet know about the new devices_to_update argument.

Actually, there was no need to bump the version: old agent side code
already captures all unknown arguments that could be passed from the
server, ignoring them:

608b54137f/neutron/agent/securitygroups_rpc.py (L155)

(^ the link shows the latest Kilo code as of writing)

Note: some people may argue that the approach that is taken in Neutron
to support backwards compatibility for server notifications is wrong,
and we instead should adopt some stricter mechanism like nova version
pinning. While that is a noble thing to do, it's out of scope for the
patch that is designed to be easily backportable to stable/liberty.

Note: some people may also argue that the patch should go straight into
stable/liberty because we don't claim support for rolling upgrade
scenarios that span multiple releases. That's indeed true, though my
take on it is that if we have a way to handle more unofficial scenarios
without more coding effort, it's worth doing it.

Change-Id: I741e6e5c460658ac17095551040e67e8d1990812
Closes-Bug: #1531772
This commit is contained in:
Ihar Hrachyshka 2016-01-13 12:37:21 +01:00
parent feced76488
commit f8f3660240

View File

@ -157,7 +157,16 @@ class SecurityGroupAgentRpcApiMixin(object):
def security_groups_provider_updated(self, context,
devices_to_update=None):
"""Notify provider updated security groups."""
cctxt = self.client.prepare(version='1.3',
# NOTE(ihrachys) the version here should really be 1.3, but since we
# don't support proper version pinning yet, we leave it intact to allow
# to work with older agents. The reason why we should not require the
# version here is that in rolling upgrade scenarios we always upgrade
# server first, and since the notification is directed from the newer
# server to older agents, and those agents don't have their RPC entry
# point bumped to 1.3 yet, we cannot safely enforce the minimal
# version. Newer payload works for older agents because agent handlers
# are written so that we silently ignore unknown parameters.
cctxt = self.client.prepare(version=self.SG_RPC_VERSION,
topic=self._get_security_group_topic(),
fanout=True)
cctxt.cast(context, 'security_groups_provider_updated',