cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/4] git commit: updated refs/heads/master to 1f6781b
Date Wed, 28 Oct 2015 21:25:25 GMT
CLOUDSTACK-8991 - Remove public IP form interface in case add = false


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

Branch: refs/heads/master
Commit: 7197cf2e24a02dbc5cd4c1964e7c8baadc112340
Parents: 99318ca
Author: Wilder Rodrigues <wrodrigues@schubergphilis.com>
Authored: Tue Oct 27 19:46:13 2015 +0100
Committer: Wilder Rodrigues <wrodrigues@schubergphilis.com>
Committed: Tue Oct 27 19:46:13 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py | 23 +++++++++++++-------
 1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7197cf2e/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 b80187a..6d26de6 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -103,6 +103,7 @@ class CsAddress(CsDataBag):
 
             for address in self.dbag[dev]:
                 ip.setAddress(address)
+                logging.info("Address found in DataBag ==> %s" % address)
 
                 if ip.configured():
                     logging.info(
@@ -263,10 +264,17 @@ class CsIP:
         return self.address
 
     def configure(self, address):
-        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)
+        # When "add" is false, it means that the IP has to be removed.
+        if address["add"]:
+            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)
+            except Exception as e:
+                logging.info("Exception occurred ==> %s" % e)
+
+        else:
+            self.delete(self.ip())
         self.post_configure(address)
 
     def post_configure(self, address):
@@ -602,9 +610,8 @@ class CsIP:
             if self.dev in bag.keys():
                 for address in bag[self.dev]:
                     self.setAddress(address)
-                    if self.hasIP(ip):
-                        found = True
-                    if self.is_guest_gateway(address, ip):
+                    if (self.hasIP(ip) or self.is_guest_gateway(address, ip)) and addess["add"]:
+                        logging.debig("The IP address in '%s' will be configured" % address)
                         found = True
             if not found:
                 self.delete(ip)
@@ -620,7 +627,7 @@ class CsIP:
 
         gw = interface.get_gateway()
         logging.info("Interface has the following gateway ==> %s", gw)
-        
+
         if bag['nw_type'] == "guest" and rip == gw:
             return True
         return False


Mime
View raw message