Switch control interface for vrrp to guest network Fix rRouter that was deleting the gateway interface
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/689008c9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/689008c9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/689008c9 Branch: refs/heads/feature/systemvm-persistent-config Commit: 689008c93a98bfeb2191b4d58079a5661e9bb769 Parents: c770102 Author: Ian Southam <[email protected]> Authored: Tue Feb 3 17:21:11 2015 +0100 Committer: wilderrodrigues <[email protected]> Committed: Wed Feb 4 18:47:14 2015 +0100 ---------------------------------------------------------------------- .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py | 4 +++- .../debian/config/opt/cloud/bin/cs/CsRedundant.py | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/689008c9/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py ---------------------------------------------------------------------- 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 193c6f6..9e4e687 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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/689008c9/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py ---------------------------------------------------------------------- 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 aed19d1..8561e8d 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)
