cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [23/50] git commit: updated refs/heads/feature/systemvm-persistent-config to 921f6e2
Date Mon, 16 Feb 2015 16:40:14 GMT
Fixed CsAddress destroying the VIP address on a redundant router
Taken quite a bit of code out of CsRedundant
Fixed public IP in keepalived when there is no guest network


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

Branch: refs/heads/feature/systemvm-persistent-config
Commit: 4acf62d8b071a7a7aeb15780142af199341a273e
Parents: f694a6e
Author: Ian Southam <isoutham@schubergphilis.com>
Authored: Wed Jan 28 15:20:45 2015 +0100
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Wed Feb 4 18:47:12 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py |  5 +-
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  6 +-
 .../config/opt/cloud/bin/cs/CsRedundant.py      | 58 +++++++++++---------
 3 files changed, 37 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4acf62d8/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 a3ca801..0b5cca9 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -28,6 +28,7 @@ from CsRule import CsRule
 
 VRRP_TYPES = ['guest']
 
+
 class CsAddress(CsDataBag):
 
     def compare(self):
@@ -499,10 +500,10 @@ class CsIP:
     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
+            return False
         rip = ip.split('/')[0]
         if bag['nw_type'] == "guest" and rip == bag['gateway']:
-           return True
+            return True
         return False
 
     def delete(self, ip):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4acf62d8/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
index 187a0cb..936f993 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -125,13 +125,13 @@ class CsCmdLine(CsDataBag):
         if "redundant_master" in self.idata():
             return self.idata()['redundant_master'] == "true"
         return False
-    
+
     def get_state(self):
         if "redundant_state" in self.idata():
             return self.idata()['redundant_state']
         return "MASTER"
-    
+
     def get_router_id(self):
         if "router_id" in self.idata():
             return self.idata()['router_id']
-        return 1
\ No newline at end of file
+        return 1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4acf62d8/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 a1bef3a..1db27ad 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -38,6 +38,7 @@ import logging
 import CsHelper
 from CsFile import CsFile
 from CsConfig import CsConfig
+from CsProcess import CsProcess
 
 
 class CsRedundant(object):
@@ -63,8 +64,7 @@ class CsRedundant(object):
 
     def set(self):
         logging.debug("Router redundancy status is %s", self.cl.is_redundant())
-        guest = self.address.get_guest_if()
-        if self.cl.is_redundant() and guest:
+        if self.cl.is_redundant():
             self._redundant_on()
         else:
             self._redundant_off()
@@ -99,29 +99,35 @@ class CsRedundant(object):
         # keepalived configuration
         file = CsFile(self.KEEPALIVED_CONF)
         file.search(" router_id ", "    router_id %s" % self.cl.get_name())
-        file.search(" priority ", "    priority %s" % self.cl.get_priority())
+        # file.search(" priority ", "    priority %s" % self.cl.get_priority())
         file.search(" weight ", "    weight %s" % 2)
-        file.search(" state ", "    state %s" % self.cl.get_state())
-        #file.search(" virtual_router_id ", "    virtual_router_id %s" % self.cl.get_router_id())
+        # 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())
         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)
+# If there is no guest network still bring up the public interface
+# Maybe necessary for things like VPNs and private gateways
+        if self.address.get_guest_if():
+            file.section("virtual_ipaddress {", "}", self._collect_ips())
+        # if self.cl.get_state() == 'MASTER':
+            # file.search(" priority ", "    priority %s" % 100)
         file.commit()
 
         # conntrackd configuration
         guest = self.address.get_guest_if()
         connt = CsFile(self.CONNTRACKD_CONF)
-        connt.section("Multicast {", "}", [
-                      "IPv4_address 225.0.0.50\n",
-                      "Group 3780\n",
-                      "IPv4_interface %s\n" % guest.get_ip(),
-                      "Interface %s\n" % guest.get_device(),
-                      "SndSocketBuffer 1249280\n",
-                      "RcvSocketBuffer 1249280\n",
-                      "Checksum on\n"])
-        connt.section("Address Ignore {", "}", self._collect_ignore_ips())
-        connt.commit()
+        if guest is not None:
+            connt.section("Multicast {", "}", [
+                          "IPv4_address 225.0.0.50\n",
+                          "Group 3780\n",
+                          "IPv4_interface %s\n" % guest.get_ip(),
+                          "Interface %s\n" % guest.get_device(),
+                          "SndSocketBuffer 1249280\n",
+                          "RcvSocketBuffer 1249280\n",
+                          "Checksum on\n"])
+            connt.section("Address Ignore {", "}", self._collect_ignore_ips())
+            connt.commit()
+
         if connt.is_changed():
             CsHelper.service("conntrackd", "restart")
 
@@ -138,6 +144,10 @@ class CsRedundant(object):
         cron.add("*/1 * * * * root $SHELL %s/check_heartbeat.sh 2>&1 > /dev/null"
% self.CS_ROUTER_DIR, -1)
         cron.commit()
 
+        proc = CsProcess(['/usr/sbin/keepalived', '--vrrp'])
+        if not proc.find():
+            CsHelper.service("keepalived", "restart")
+
     def set_fault(self):
         """ Set fault mode on this router """
         if not self.cl.is_redundant():
@@ -177,9 +187,9 @@ class CsRedundant(object):
         CsHelper.service("xl2tpd", "stop")
         CsHelper.service("cloud-passwd-srvr", "stop")
         CsHelper.service("dnsmasq", "stop")
-        self._set_priority(self.CS_PRIO_DOWN)
+        # self._set_priority(self.CS_PRIO_DOWN)
         self.cl.dbag['config']['redundant_master'] = "false"
-        #CsHelper.service("keepalived", "restart")
+        # CsHelper.service("keepalived", "restart")
         self.cl.save()
         logging.info("Router switched to backup mode")
 
@@ -212,15 +222,9 @@ class CsRedundant(object):
         CsHelper.service("dnsmasq", "restart")
         self.cl.dbag['config']['redundant_master'] = "true"
         self.cl.save()
-        #CsHelper.service("keepalived", "restart")
+        # CsHelper.service("keepalived", "restart")
         logging.info("Router switched to master mode")
 
-    def _set_priority(self, dir):
-        self.cl.set_priority(int(self.cl.get_priority()) + dir)
-        file = CsFile(self.KEEPALIVED_CONF)
-        file.search(" priority ", "    priority %s" % self.cl.get_priority())
-        file.commit()
-
     def _collect_ignore_ips(self):
         """
         This returns a list of ip objects that should be ignored


Mime
View raw message