neutron/neutron/agent/linux
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
..
openvswitch_firewall Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
async_process.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
bridge_lib.py LinuxBridge: Use ifindex for logical 'timestamp' 2016-09-14 17:02:46 +00:00
daemon.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
dhcp.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
dibbler.py Add PD support in HA router 2017-03-15 04:31:09 +00:00
external_process.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
interface.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
ip_conntrack.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
ip_lib.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
ip_link_support.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
ip_monitor.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
ipset_manager.py Delete conntrack when remote ipset member removed 2016-11-29 16:19:03 +00:00
iptables_comments.py Neutron to Drop Router Advts from VM ports 2015-04-24 03:42:07 +00:00
iptables_firewall.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
iptables_manager.py Make use of -w argument for iptables calls 2017-08-31 20:28:53 +00:00
keepalived.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
ovsdb_monitor.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
pd.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
pd_driver.py Fix module's import order 2016-01-22 06:38:42 -08:00
polling.py Support ovsdb-client monitor with remote connection 2017-01-17 06:00:58 -08:00
ra.py Remove advertise_mtu config option 2017-01-09 22:17:09 +00:00
tc_lib.py TC doesn't rise exception if device doesn't exist 2017-06-14 15:58:33 +01:00
utils.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
xenapi_root_helper.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00