OpenStack Networking (Neutron)
Go to file
Sławek Kapłoński 725df3e038 Fix race condition with enabling SG on many ports at once
When there are many calls to enable security groups on ports there
can be sometimes race condition between refresh recource_cache
with data get by "pull" call to neutron server and data received
with "push" rpc message from neutron server.
In such case when "push" message comes with information about
updated port (with enabled port_security), in local cache this port
is already updated so local AFTER_UPDATE call is not called for
such port and its rules in firewall are not updated.

It happend quite often in fullstack security groups test because
there are 4 ports created in this test and all 4 are updated to
apply SG to it one by one.
And here's what happen then in details:
1. port 1 was updated in neutron-server so it sends push notification
   to L2 agent to update security groups,
2. port 1 info was saved in resource cache on L2 agent's side and agent
   started to configure security groups for this port,
3. as one of steps L2 agent called
   SecurityGroupServerAPIShim._select_ips_for_remote_group() method;
   In that method RemoteResourceCache.get_resources() is called and this
   method asks neutron-server for details about ports from given
   security_group,
4. in the meantime neutron-server got port update call for second port
   (with same security group) so it sends to L2 agent informations about 2
   ports (as a reply to request sent from L2 agent in step 3),
5. resource cache updates informations about two ports in local cache,
   returns its data to
   SecurityGroupServerAPIShim._select_ips_for_remote_group() and all
   looks fine,
6. but now L2 agent receives push notification with info that port 2 is
   updated (changed security groups), so it checks info about this port
   in local cache,
7. in local cache info about port 2 is already WITH updated security
   group so RemoteResourceCache doesn't trigger local notification about
   port AFTER UPDATE and L2 agent doesn't know that security groups for this
   port should be changed

This patch fixes it by changing way how items are updated in
the resource_cache.
For now it is done with record_resource_update() method instead of
writing new values directly to resource_cache._type_cache dict.
Due to that if resource will be updated during "pull" call to neutron
server, local AFTER_UPDATE will still be triggered for such resource.

Change-Id: I5a62cc5731c5ba571506a3aa26303a1b0290d37b
Closes-Bug: #1742401
2018-01-23 12:19:43 +01:00
api-ref Fix some typos 2016-06-28 22:46:19 +02:00
bin Use os-xenapi for neutron when XenServer as hypervisor 2017-03-30 18:33:37 +00:00
devstack Add dns-integration setup to devstack plugin 2017-11-22 07:50:06 +00:00
doc Merge "Use same instance of iptables_manager in L2 agent and extensions" 2018-01-05 19:19:57 +00:00
etc Allow port create/update by shared nw owners 2017-12-12 04:12:54 +00:00
neutron Fix race condition with enabling SG on many ports at once 2018-01-23 12:19:43 +01:00
playbooks/legacy Moving legacy check and gate jobs 2017-12-30 18:04:03 -06:00
rally-jobs [rally] Port input task to the new format. 2017-11-02 12:28:29 +02:00
releasenotes Merge "Use same instance of iptables_manager in L2 agent and extensions" 2018-01-05 19:19:57 +00:00
tools Remove the bundled intree neutron tempest plugin 2017-11-22 12:54:33 -08:00
.coveragerc Cleanup coverage configuration 2016-10-17 17:06:19 +05:30
.gitignore Added zuulv3 jobs for testing neutron tempest plugin 2017-11-13 09:30:36 +05:30
.gitreview Fix .gitreview to not point at a branch 2015-08-17 13:51:51 -06:00
.mailmap Add mailmap entry 2014-05-16 13:40:04 -04:00
.pylintrc Update pylint disable list to pass pylint 1.7.1 checks 2017-06-08 09:49:46 +00:00
.stestr.conf Fix post gate hook to accommodate for new os-testr 2017-09-12 14:20:12 -06:00
.testr.conf Allow more time for DB migration tests 2016-09-21 20:54:41 -04:00
.zuul.yaml Moving legacy check and gate jobs 2017-12-30 18:04:03 -06:00
CONTRIBUTING.rst Update link for contribution 2017-08-31 16:44:51 +02:00
HACKING.rst Update the documentation link for doc migration 2017-07-22 18:46:13 +09:00
LICENSE Adding Apache Version 2.0 license file. This is the official license agreement under which Quantum code is available to 2011-08-08 12:31:04 -07:00
README.rst Correct tag link in README 2017-08-03 09:47:25 +08:00
TESTING.rst docs: clarify wording about how to use advanced glance image 2017-08-01 08:56:45 -07:00
babel.cfg Use babel to generate translation file 2013-01-24 00:20:32 +08:00
bindep.txt Add libffi-dev to bindep.txt 2017-06-13 19:26:49 +00:00
requirements.txt Updated from global requirements 2017-12-26 16:04:42 +00:00
setup.cfg [L3][QoS] L3 agent side Floating IP rate limit 2017-12-20 10:20:05 +08:00
setup.py Updated from global requirements 2017-03-04 11:19:58 +00:00
test-requirements.txt Remove the bundled intree neutron tempest plugin 2017-11-22 12:54:33 -08:00
tox.ini add doc link validation to release checklist and tox 2017-09-21 15:24:03 -06:00

README.rst

Team and repository tags

image

Welcome!

To learn more about neutron:

Get in touch via email. Use [Neutron] in your subject.

To learn how to contribute:

CONTRIBUTING.rst