]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Adds garp_master_repeat and garp_master_refresh to keepalived.conf
authornmagnezi <nmagnezi@redhat.com>
Mon, 13 Jul 2015 13:23:28 +0000 (16:23 +0300)
committerNir Magnezi <nmagnezi@redhat.com>
Sun, 19 Jul 2015 22:38:53 +0000 (18:38 -0400)
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
neutron/tests/functional/agent/test_l3_agent.py
neutron/tests/unit/agent/linux/test_keepalived.py

index f856def6d46304f11a63d909fda34624c4db91fb..9fed0e9f6c7255eb2fb6a83eb0afa97e7e0ed2fb 100644 (file)
@@ -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')
index c27a94f1a44e8d65d458a9aa86a516909b3c13dc..bad8f1b85b69364d4656bae0043e1f1b058e07db 100644 (file)
@@ -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 {
index 7d6e9806f9ec422b8ccd8eceba11951cb267e8b9..0bff102103317622389b890d48fc7e000719ea0c 100644 (file)
@@ -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
     }