Vrrp will fail if your own code keeps killing it off

This commit is contained in:
Ian Southam 2015-01-27 16:58:16 +01:00 committed by wilderrodrigues
parent ae53d5ede1
commit f5ef75ee7e
3 changed files with 18 additions and 3 deletions

View File

@ -556,8 +556,8 @@ def main(argv):
fwd = CsForwardingRules("forwardingrules", config)
fwd.process()
vpns = CsSite2SiteVpn("site2sitevpn", config)
vpns.process()
nf = CsNetfilters()
nf.compare(config.get_fw())
red = CsRedundant(config)
red.set()
@ -565,6 +565,9 @@ def main(argv):
nf = CsNetfilters()
nf.compare(config.get_fw())
vpns = CsSite2SiteVpn("site2sitevpn", config)
vpns.process()
dhcp = CsDhcp("dhcpentry", config)
dhcp.process()

View File

@ -491,9 +491,20 @@ class CsIP:
self.setAddress(address)
if self.hasIP(ip):
found = True
if self.is_guest_gateway(address, ip):
found = True
if not found:
self.delete(ip)
def is_guest_gateway(self, bag, ip):
""" Exclude the vrrp maintained addresses on a redundant router """
if not self.config.cl.is_redundant():
return False
rip = ip.split('/')[0]
if bag['nw_type'] == "guest" and rip == bag['gateway']:
return True
return False
def delete(self, ip):
remove = []
if ip == "all":

View File

@ -105,6 +105,8 @@ class CsRedundant(object):
file.search(" virtual_router_id ", " virtual_router_id %s" % self.cl.get_router_id())
file.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
file.section("virtual_ipaddress {", "}", self._collect_ips())
if self.cl.get_state() == 'MASTER':
file.search(" priority ", " priority %s" % 120)
file.commit()
# conntrackd configuration
@ -209,7 +211,6 @@ class CsRedundant(object):
CsHelper.service("cloud-passwd-srvr", "restart")
CsHelper.service("dnsmasq", "restart")
self.cl.dbag['config']['redundant_master'] = "true"
self._set_priority(self.CS_PRIO_UP)
self.cl.save()
#CsHelper.service("keepalived", "restart")
logging.info("Router switched to master mode")