You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2016/01/17 19:14:14 UTC

[2/9] git commit: updated refs/heads/4.7 to ff89587

CLOUDSTACK-9154 - Returns the guest iterface that is marked as added

   - Force a restart of keepalived if conntrackd is not running or configuration has changed


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7988f51a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7988f51a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7988f51a

Branch: refs/heads/4.7
Commit: 7988f51ac07782ad9b9873c32438fd7cdb24edba
Parents: 9be76b3
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Thu Dec 17 14:20:59 2015 +0100
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Dec 22 14:52:05 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py  |  5 ++++-
 .../debian/config/opt/cloud/bin/cs/CsRedundant.py        | 11 +++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7988f51a/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 24d75e5..d320d0a 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -52,7 +52,7 @@ class CsAddress(CsDataBag):
         """
         ipr = []
         for ip in self.get_ips():
-            if ip.is_guest():
+            if ip.is_guest() and ip.is_added():
                 ipr.append(ip)
         if len(ipr) > 0:
             return sorted(ipr)[-1]
@@ -189,6 +189,9 @@ class CsInterface:
         if "nw_type" in self.address and self.address['nw_type'] in ['public']:
             return True
         return False
+    
+    def is_added(self):
+        return self.get_attr("add")
 
     def to_str(self):
         pprint(self.address)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7988f51a/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 d853eb9..f975871 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -108,7 +108,6 @@ class CsRedundant(object):
             CsHelper.service("keepalived", "stop")
             return
 
-
         CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False)
         CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR)
         CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False)
@@ -148,7 +147,7 @@ class CsRedundant(object):
         conntrackd_temp_bkp = "%s/%s" % (self.CS_TEMPLATES_DIR, "conntrackd.conf.templ.bkp")
         
         CsHelper.copy(conntrackd_template_conf, conntrackd_temp_bkp)
-        
+
         conntrackd_tmpl = CsFile(conntrackd_template_conf)
         conntrackd_tmpl.section("Multicast {", "}", [
                       "IPv4_address 225.0.0.50\n",
@@ -164,10 +163,14 @@ class CsRedundant(object):
         conntrackd_conf = CsFile(self.CONNTRACKD_CONF)
 
         is_equals = conntrackd_tmpl.compare(conntrackd_conf)
+
+        force_keepalived_restart = False
         proc = CsProcess(['/etc/conntrackd/conntrackd.conf'])
-        if not proc.find() or not is_equals:
+
+        if not proc.find() and not is_equals:
             CsHelper.copy(conntrackd_template_conf, self.CONNTRACKD_CONF)
             CsHelper.service("conntrackd", "restart")
+            force_keepalived_restart = True
 
         # Restore the template file and remove the backup.
         CsHelper.copy(conntrackd_temp_bkp, conntrackd_template_conf)
@@ -185,7 +188,7 @@ class CsRedundant(object):
         heartbeat_cron.commit()
 
         proc = CsProcess(['/usr/sbin/keepalived'])
-        if not proc.find() or keepalived_conf.is_changed():
+        if not proc.find() or keepalived_conf.is_changed() or force_keepalived_restart:
             keepalived_conf.commit()
             CsHelper.service("keepalived", "restart")