]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Make security_groups_provider_updated work with Kilo agents
authorIhar Hrachyshka <ihrachys@redhat.com>
Wed, 13 Jan 2016 11:37:21 +0000 (12:37 +0100)
committerIhar Hrachyshka <ihrachys@redhat.com>
Fri, 15 Jan 2016 12:40:06 +0000 (13:40 +0100)
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:

https://github.com/openstack/neutron/blob/608b54137fb67512c07099089ea7e074176e12df/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

neutron/api/rpc/handlers/securitygroups_rpc.py

index d621b24f95d209a676a505340de250c7e7510b38..c6f28e57da408a475bb41f256a1a4ff0f05a5022 100644 (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',