diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py index 193c6f6a46b..9e4e6878a34 100644 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py @@ -502,10 +502,12 @@ class CsIP: def is_guest_gateway(self, bag, ip): """ Exclude the vrrp maintained addresses on a redundant router """ + interface = CsInterface(bag, self.config) if not self.config.cl.is_redundant(): return False rip = ip.split('/')[0] - if bag['nw_type'] == "guest" and rip == bag['gateway']: + gw = interface.get_gateway() + if bag['nw_type'] == "guest" and rip == gw: return True return False diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py index aed19d128a4..8561e8de302 100644 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py @@ -78,6 +78,11 @@ class CsRedundant(object): CsHelper.rm(self.KEEPALIVED_CONF) def _redundant_on(self): + guest = self.address.get_guest_if() + # No redundancy if there is no guest network + if guest is None: + self._redundant_off() + return CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False) CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR) CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False) @@ -107,7 +112,8 @@ class CsRedundant(object): i = i + 1 file.search(" router_id ", " router_id %s" % self.cl.get_name()) file.search(" priority ", " priority %s" % self.cl.get_priority()) - file.search(" weight ", " weight %s" % 2) + file.search(" interface ", " interface %s" % guest.get_device()) + #file.search(" weight ", " weight %s" % 2) # file.search(" state ", " state %s" % self.cl.get_state()) file.search(" state ", " state %s" % "EQUAL") # file.search(" virtual_router_id ", " virtual_router_id %s" % self.cl.get_router_id()) @@ -116,7 +122,6 @@ class CsRedundant(object): file.commit() # conntrackd configuration - guest = self.address.get_guest_if() connt = CsFile(self.CONNTRACKD_CONF) if guest is not None: connt.section("Multicast {", "}", [ @@ -136,9 +141,6 @@ class CsRedundant(object): if file.is_changed(): CsHelper.service("keepalived", "restart") - # FIXME - # enable/disable_pubip/master/slave etc. will need rewriting to use the new python config - # Configure heartbeat cron job cron = CsFile("/etc/cron.d/heartbeat") cron.add("SHELL=/bin/bash", 0)