cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sw...@apache.org
Subject [02/11] git commit: updated refs/heads/4.7 to 309a60e
Date Thu, 12 May 2016 15:01:19 GMT
CLOUDSTACK-9287 - Put private gateway interface down on backup router


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

Branch: refs/heads/4.7
Commit: d93b008deb2ced326b314fefbe11511d798be5e8
Parents: f921ec6
Author: Wilder Rodrigues <wrodrigues@schubergphilis.com>
Authored: Sat Feb 13 15:48:30 2016 +0100
Committer: Remi Bergsma <github@remi.nl>
Committed: Sat Apr 9 21:13:35 2016 +0200

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py  | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d93b008d/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 1b39b38..41b5e9a 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -117,6 +117,7 @@ class CsAddress(CsDataBag):
                 else:
                     logging.info(
                         "Address %s on device %s not configured", ip.ip(), dev)
+                    
                     if CsDevice(dev, self.config).waitfordevice():
                         ip.configure(address)
 
@@ -276,7 +277,7 @@ class CsIP:
             try:
                 logging.info("Configuring address %s on device %s", self.ip(), self.dev)
                 cmd = "ip addr add dev %s %s brd +" % (self.dev, self.ip())
-                subprocess.call(cmd, shell=True)
+                CsHelper.execute(cmd)
             except Exception as e:
                 logging.info("Exception occurred ==> %s" % e)
 
@@ -317,6 +318,9 @@ class CsIP:
 
     def check_is_up(self):
         """ Ensure device is up """
+        state_commands = {"router" : "ip addr | grep eth0 | grep inet | wc -l | xargs bash
-c  'if [ $0 == 2 ]; then echo \"MASTER\"; else echo \"BACKUP\"; fi'",
+                         "vpcrouter" : "ip addr | grep eth1 | grep state | awk '{print $9;}'
| xargs bash -c 'if [ $0 == \"UP\" ]; then echo \"MASTER\"; else echo \"BACKUP\"; fi'"}
+        
         cmd = "ip link show %s | grep 'state DOWN'" % self.getDevice()
         for i in CsHelper.execute(cmd):
             if " DOWN " in i:
@@ -324,10 +328,15 @@ class CsIP:
                 # If redundant only bring up public interfaces that are not eth1.
                 # Reason: private gateways are public interfaces.
                 # master.py and keepalived will deal with eth1 public interface.
-                if self.cl.is_redundant() and (not self.is_public() or self.getDevice() not
in PUBLIC_INTERFACE):
-                    CsHelper.execute(cmd2)
-                # if not redundant bring everything up
-                if not self.cl.is_redundant():
+                
+                if self.cl.is_redundant() and self.is_public():
+                    state_cmd = state_commands[self.cl.get_type()]
+                    logging.info("Check state command => %s" % state_cmd)
+                    state = CsHelper.execute(state_cmd)[0]
+                    logging.info("Route state => %s" % state)
+                    if self.getDevice() not in PUBLIC_INTERFACE and state == "MASTER":
+                        CsHelper.execute(cmd2)
+                else:
                     CsHelper.execute(cmd2)
 
     def set_mark(self):


Mime
View raw message