Restart keepalived if a pub interface gets added or removed
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/460378a4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/460378a4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/460378a4 Branch: refs/heads/feature/systemvm-persistent-config Commit: 460378a4f273987a9c5dd1bb5e905d50fa3827de Parents: 7500962 Author: Ian Southam <[email protected]> Authored: Thu Jan 29 15:50:36 2015 +0100 Committer: wilderrodrigues <[email protected]> Committed: Wed Feb 4 18:47:13 2015 +0100 ---------------------------------------------------------------------- .../debian/config/opt/cloud/bin/cs/CsRedundant.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/460378a4/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 2fa4160..aed19d1 100644 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py @@ -98,6 +98,13 @@ class CsRedundant(object): # keepalived configuration file = CsFile(self.KEEPALIVED_CONF) + ads = [o for o in self.address.get_ips() if o.is_public()] + # Add a comment for each public IP. If any change this will cause keepalived to restart + # As things stand keepalived will be configured before the IP is added or deleted + i = 0 + for o in ads: + file.addeq("! %s=%s" % (i, o.get_cidr())) + 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) @@ -105,11 +112,7 @@ class CsRedundant(object): file.search(" state ", " state %s" % "EQUAL") # file.search(" virtual_router_id ", " virtual_router_id %s" % self.cl.get_router_id()) file.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR) -# If there is no guest network still bring up the public interface -# Maybe necessary for things like VPNs and private gateways file.section("virtual_ipaddress {", "}", self._collect_ips()) - # if self.cl.get_state() == 'MASTER': - # file.search(" priority ", " priority %s" % 100) file.commit() # conntrackd configuration
