]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Replace keepalived notifier bash script with Python ip monitor
authorAssaf Muller <amuller@redhat.com>
Thu, 12 Mar 2015 23:50:43 +0000 (19:50 -0400)
committerAssaf Muller <amuller@redhat.com>
Wed, 18 Mar 2015 22:59:33 +0000 (18:59 -0400)
commit9bae3b1832798a274bef4a77e5acda1abaa51f2a
tree6594140065391e447d6c030812f073db29b27c1b
parent89eef8904723bc2b1306733d4e56219727ad6d07
Replace keepalived notifier bash script with Python ip monitor

Previously L3 HA generated a bash script and copied it to a per-router
configuration directory that was visible to that router's keepalived
instance. This patch changes the in-line generated Bash script to a
Python script that can be maintained in the repository.
The bash script was used as a keepalived notifier script, that was invoked
by keepalived whenever a state transition occured. These notifier scripts
may be invoked by keepalived out of order in case it transitions quickly
twice. For example, if the master failed and two slaves fight for the new
master role. One will transition to master, and the other will often
transition to master and then immidiately back to standby. In this case,
the transition scripts were often fired out of order, resulting in the
wrong state being reported.

The proposed approach is to get rid of the keepalived notifier scripts
entirely. Instead, monitor IP changes on the HA device. If the omnipresent
IP address was configured on the HA device, it means that we're looking
at a master instance. If it was deleted, the router transition to standby
or fault.

In order to keep the L3 agent CPU usage down, it will spawn a process
per HA router. That process will start the ip address monitor.
Whenever it gets an IP address change event, it will notify the L3 agent
via a unix domain socket.

Partially-Implements: blueprint report-ha-router-master
Change-Id: I2022bced330d5f108fbedd40548a901225d7ea1c
Closes-Bug: #1402010
Closes-Bug: #1367705
14 files changed:
etc/neutron/rootwrap.d/l3.filters
neutron/agent/l3/ha.py
neutron/agent/l3/ha_router.py
neutron/agent/l3/keepalived_state_change.py [new file with mode: 0644]
neutron/agent/linux/ip_monitor.py
neutron/agent/linux/keepalived.py
neutron/cmd/keepalived_state_change.py [new file with mode: 0644]
neutron/tests/functional/agent/l3/__init__.py [new file with mode: 0644]
neutron/tests/functional/agent/l3/test_keepalived_state_change.py [new file with mode: 0644]
neutron/tests/functional/agent/test_l3_agent.py
neutron/tests/unit/agent/linux/test_keepalived.py
neutron/tests/unit/agent/metadata/test_driver.py
neutron/tests/unit/test_l3_agent.py
setup.cfg