cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [18/21] git commit: updated refs/heads/master to 3ded3e9
Date Sun, 27 Sep 2015 12:11:37 GMT
Fixing the defaut route for VPC routers


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

Branch: refs/heads/master
Commit: a8fa3374dae1a935c336cbc01d21a3f237d6b0f4
Parents: 595fa50
Author: Wilder Rodrigues <wrodrigues@schubergphilis.com>
Authored: Sat Sep 26 20:29:04 2015 +0200
Committer: Remi Bergsma <github@remi.nl>
Committed: Sat Sep 26 20:30:49 2015 +0200

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8fa3374/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 26836bc..f0b85f9 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -114,6 +114,7 @@ class CsAddress(CsDataBag):
 
     def process(self):
         route = CsRoute()
+        found_defaultroute = False
 
         for dev in self.dbag:
             if dev == "id":
@@ -121,17 +122,12 @@ class CsAddress(CsDataBag):
             ip = CsIP(dev, self.config)
 
             for address in self.dbag[dev]:
-               # if(address["nw_type"]!="public"):
-               #     continue
-
                 #check if link is up
-                if (not self.check_if_link_exists(dev)):
-                    logging.info("link %s does not exist, so not processing"%dev)
-                    continue
                 if not self.check_if_link_up(dev):
                    cmd="ip link set %s up"%dev
                    CsHelper.execute(cmd)
 
+                gateway = str(address["gateway"])
                 network = str(address["network"])
 
                 ip.setAddress(address)
@@ -147,17 +143,25 @@ class CsAddress(CsDataBag):
                         "Address %s on device %s not configured", ip.ip(), dev)
                     if CsDevice(dev, self.config).waitfordevice():
                         ip.configure()
+
                 route.add_route(dev, network)
 
+                # The code looks redundant here, but we actually have to cater for routers
and
+                # VPC routers in a different manner. Please do not remove this block otherwise
+                # The VPC default route will be broken.
+                if address["nw_type"] == "public" and not found_defaultroute:
+                    if not route.defaultroute_exists():
+                        if route.add_defaultroute(gateway):
+                            found_defaultroute = True
+
         # once we start processing public ip's we need to verify there
         # is a default route and add if needed
         if not route.defaultroute_exists():
-            cmdline=self.config.get_cmdline_instance()
+            cmdline = self.config.cmdline()
             if(cmdline.get_gateway()):
                 route.add_defaultroute(cmdline.get_gateway())
 
 
-
 class CsInterface:
 
     """ Hold one single ip """
@@ -516,9 +520,10 @@ class CsIP:
         self.fw.append(["", "", "-A NETWORK_STATS -i eth2 -o eth0 -p tcp"])
         self.fw.append(["", "", "-A NETWORK_STATS ! -i eth0 -o eth2 -p tcp"])
         self.fw.append(["", "", "-A NETWORK_STATS -i eth2 ! -o eth0 -p tcp"])
-        
+
+        self.fw.append(["filter", "", "-A INPUT -p icmp -j ACCEPT"])
         self.fw.append(["filter", "", "-A INPUT -i eth0 -p tcp -m tcp --dport 3922 -m state
--state NEW,ESTABLISHED -j ACCEPT"])
-        
+
         self.fw.append(["filter", "", "-P INPUT DROP"])
         self.fw.append(["filter", "", "-P FORWARD DROP"])
 


Mime
View raw message