neutron/neutron
Ihar Hrachyshka a521bf0393 Make use of -w argument for iptables calls
Upstream iptables added support for -w ('wait') argument to
iptables-restore. It makes the command grab a 'xlock' that guarantees
that no two iptables calls will mess a table if called in parallel.
[This somewhat resembles what we try to achieve with a file lock we
grab in iptables manager's _apply_synchronized.]

If two processes call to iptables-restore or iptables in parallel, the
second call risks failing, returning error code = 4, and also printing
the following error:

    Another app is currently holding the xtables lock. Perhaps you want
    to use the -w option?

If we call to iptables / iptables-restore with -w though, it will wait
for the xlock release before proceeding, and won't fail.

Though the feature was added in iptables/master only and is not part of
an official iptables release, it was already backported to RHEL 7.x
iptables package, and so we need to adopt to it. At the same time, we
can't expect any underlying platform to support the argument.

A solution here is to call iptables-restore with -w when a regular call
failed. Also, the patch adds -w to all iptables calls, in the iptables
manager as well as in ipset-cleanup.

Since we don't want to lock agent in case current xlock owner doesn't
release it in reasonable time, we limit the time we wait to ~1/3 of
report_interval, to give the agent some time to recover without
triggering expensive fullsync.

In the future, we may be able to get rid of our custom synchronization
lock that we use in iptables manager. But this will require all
supported platforms to get the feature in and will take some time.

Closes-Bug: #1712185
Change-Id: I94e54935df7c6caa2480eca19e851cb4882c0f8b
2017-08-31 20:28:53 +00:00
..
agent Make use of -w argument for iptables calls 2017-08-31 20:28:53 +00:00
api Merge "Stop logging full object in RPC push code" 2017-08-15 15:18:03 +00:00
callbacks Merge "service: add callback AFTER_SPAWN" 2017-05-20 09:09:12 +00:00
cmd Make use of -w argument for iptables calls 2017-08-31 20:28:53 +00:00
common Merge "Hook bandit security linter to pep8 target" 2017-08-24 06:10:40 +00:00
conf Merge "DVR: Provide options for DVR North/South routing centralized" 2017-08-12 13:08:29 +00:00
core_extensions Fix default qos policy when creating network 2017-08-23 13:03:18 +00:00
db Open Queens DB branch 2017-08-24 14:46:01 +00:00
debug Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
extensions Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
hacking hacking: Remove dead code 2017-07-19 13:43:44 +02:00
ipam Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
locale Imported Translations from Zanata 2017-07-18 08:36:04 +00:00
notifiers Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
objects Allow to set/modify network mtu 2017-08-11 00:57:34 +00:00
pecan_wsgi Merge "Log policy filters in one line" 2017-08-23 11:09:37 +00:00
plugins Merge "Add a target to Sinkhole so it's compatible" 2017-08-15 21:15:42 +00:00
privileged Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
quota Merge "Make code follow log translation guideline" 2017-08-14 17:42:09 +00:00
scheduler Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
server Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
services Treat Filter as Dict in get_policies 2017-08-18 05:45:47 +00:00
tests Make use of -w argument for iptables calls 2017-08-31 20:28:53 +00:00
__init__.py Hacking rule to check i18n usage 2016-03-30 21:28:37 -04:00
_i18n.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
auth.py Use oslo.context class method to construct context object 2017-03-23 09:02:46 +00:00
manager.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
neutron_plugin_base_v2.py replace WorkerSupportServiceMixin with neutron-lib's WorkerBase 2017-06-14 06:56:48 -06:00
opts.py Remove deprecated support for QoS notification_drivers 2017-04-17 06:32:01 -07:00
policy.py Merge "Log policy filters in one line" 2017-08-23 11:09:37 +00:00
service.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
version.py
worker.py replace WorkerSupportServiceMixin with neutron-lib's WorkerBase 2017-06-14 06:56:48 -06:00
wsgi.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00