From 141560b4221b9b58fd34405a8f94e826f92f35ff Mon Sep 17 00:00:00 2001 From: nmagnezi Date: Mon, 13 Jul 2015 16:23:28 +0300 Subject: [PATCH] Adds garp_master_repeat and garp_master_refresh to keepalived.conf This patch aims to solve an issue when, in some cases, the L3 agent might start before the OVS agent during a node boot process. At such scenario, the L3 agent will configure the routers before the OVS agent done syncing with the server and starts processing ovsdb monitor updates. The result: 1. L3 agent finishes configuring an HA router 2. Keepalived spawned 3. In case of transition to master state, it (keepalived) sends gratuitous ARPs ^---The issue 4. The OVS agent has just finished plugging its ports Meaning, the gratuitous ARP will be lost, but the router acting as master. Closes-Bug: #1453855 Change-Id: I2cffa7c0ebad20bd50396265aef9fcfa64018744 --- neutron/agent/linux/keepalived.py | 13 ++++++++++--- neutron/tests/functional/agent/test_l3_agent.py | 2 ++ neutron/tests/unit/agent/linux/test_keepalived.py | 10 ++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/neutron/agent/linux/keepalived.py b/neutron/agent/linux/keepalived.py index f856def6d..9fed0e9f6 100644 --- a/neutron/agent/linux/keepalived.py +++ b/neutron/agent/linux/keepalived.py @@ -31,7 +31,8 @@ PRIMARY_VIP_RANGE_SIZE = 24 # TODO(amuller): Use L3 agent constant when new constants module is introduced. FIP_LL_SUBNET = '169.254.30.0/23' KEEPALIVED_SERVICE_NAME = 'keepalived' - +GARP_MASTER_REPEAT = 5 +GARP_MASTER_REFRESH = 10 LOG = logging.getLogger(__name__) @@ -138,7 +139,9 @@ class KeepalivedInstance(object): def __init__(self, state, interface, vrouter_id, ha_cidrs, priority=HA_DEFAULT_PRIORITY, advert_int=None, - mcast_src_ip=None, nopreempt=False): + mcast_src_ip=None, nopreempt=False, + garp_master_repeat=GARP_MASTER_REPEAT, + garp_master_refresh=GARP_MASTER_REFRESH): self.name = 'VR_%s' % vrouter_id if state not in VALID_STATES: @@ -151,6 +154,8 @@ class KeepalivedInstance(object): self.nopreempt = nopreempt self.advert_int = advert_int self.mcast_src_ip = mcast_src_ip + self.garp_master_repeat = garp_master_repeat + self.garp_master_refresh = garp_master_refresh self.track_interfaces = [] self.vips = [] self.virtual_routes = KeepalivedInstanceRoutes() @@ -244,7 +249,9 @@ class KeepalivedInstance(object): ' state %s' % self.state, ' interface %s' % self.interface, ' virtual_router_id %s' % self.vrouter_id, - ' priority %s' % self.priority] + ' priority %s' % self.priority, + ' garp_master_repeat %s' % self.garp_master_repeat, + ' garp_master_refresh %s' % self.garp_master_refresh] if self.nopreempt: config.append(' nopreempt') diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py index c27a94f1a..bad8f1b85 100644 --- a/neutron/tests/functional/agent/test_l3_agent.py +++ b/neutron/tests/functional/agent/test_l3_agent.py @@ -197,6 +197,8 @@ class L3AgentTestFramework(base.BaseSudoTestCase): interface %(ha_device_name)s virtual_router_id 1 priority 50 + garp_master_repeat 5 + garp_master_refresh 10 nopreempt advert_int 2 track_interface { diff --git a/neutron/tests/unit/agent/linux/test_keepalived.py b/neutron/tests/unit/agent/linux/test_keepalived.py index 7d6e9806f..0bff10210 100644 --- a/neutron/tests/unit/agent/linux/test_keepalived.py +++ b/neutron/tests/unit/agent/linux/test_keepalived.py @@ -115,6 +115,8 @@ class KeepalivedConfTestCase(base.BaseTestCase, interface eth0 virtual_router_id 1 priority 50 + garp_master_repeat 5 + garp_master_refresh 10 advert_int 5 authentication { auth_type AH @@ -141,6 +143,8 @@ vrrp_instance VR_2 { interface eth4 virtual_router_id 2 priority 50 + garp_master_repeat 5 + garp_master_refresh 10 mcast_src_ip 224.0.0.1 track_interface { eth4 @@ -244,6 +248,8 @@ class KeepalivedInstanceTestCase(base.BaseTestCase, interface eth0 virtual_router_id 1 priority 50 + garp_master_repeat 5 + garp_master_refresh 10 advert_int 5 authentication { auth_type AH @@ -267,6 +273,8 @@ vrrp_instance VR_2 { interface eth4 virtual_router_id 2 priority 50 + garp_master_repeat 5 + garp_master_refresh 10 mcast_src_ip 224.0.0.1 track_interface { eth4 @@ -289,6 +297,8 @@ vrrp_instance VR_2 { interface eth0 virtual_router_id 1 priority 50 + garp_master_repeat 5 + garp_master_refresh 10 virtual_ipaddress { 169.254.0.1/24 dev eth0 } -- 2.45.2