cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/master to 2fad87d
Date Tue, 14 Apr 2015 14:53:55 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master e81161def -> 2fad87d3f


Make the routers persistent

  - After configuration save the ipdated in files
    * /etc/iptables/router_rules.v4 and /etc/iptables/router_rules.v6
    * Reload the configuration on reboot via the /etc/rc.local using iptables-restore


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

Branch: refs/heads/master
Commit: 2fad87d3f3fec380ba5d595ee95f5caa88b37ee8
Parents: e81161d
Author: wilderrodrigues <wrodrigues@schubergphilis.com>
Authored: Tue Apr 14 15:03:35 2015 +0200
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Tue Apr 14 15:09:47 2015 +0200

----------------------------------------------------------------------
 systemvm/patches/debian/config/etc/rc.local         | 13 +++++++++++++
 .../debian/config/opt/cloud/bin/configure.py        |  6 +++++-
 .../debian/config/opt/cloud/bin/cs/CsHelper.py      | 16 ++++++++++++++--
 3 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fad87d3/systemvm/patches/debian/config/etc/rc.local
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/rc.local b/systemvm/patches/debian/config/etc/rc.local
index 23e913e..18e7cd1 100755
--- a/systemvm/patches/debian/config/etc/rc.local
+++ b/systemvm/patches/debian/config/etc/rc.local
@@ -46,3 +46,16 @@ python /opt/cloud/bin/baremetal-vr.py &
 
 date > /var/cache/cloud/boot_up_done
 logger -t cloud "Boot up process done"
+
+#Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
+ipv4="/etc/iptables/router_rules.v4"
+if [ -e $ipv4 ]
+then
+   iptables-restore < $ipv4
+fi
+
+ipv6="/etc/iptables/router_rules.v6"
+if [ -e $ipv6 ]
+then
+   iptables-restore < $ipv6
+fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fad87d3/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index b03928b..799e279 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -676,6 +676,10 @@ def main(argv):
 
     mon = CsMonitor("monitorservice", config)
     mon.process()
-
+    
+    #Save iptables configuration - will be loaded on reboot by the iptables-restore that
is configured on /etc/rc.local
+    CsHelper.save_iptables("iptables-save", "/etc/iptables/router_rules.v4")
+    CsHelper.save_iptables("ip6tables-save", "/etc/iptables/router_rules.v6")
+    
 if __name__ == "__main__":
     main(sys.argv)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fad87d3/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
index f01bb8c..708422c 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 """ General helper functions
-for use in the configuation process
+for use in the configuration process
 
 """
 import subprocess
@@ -27,7 +27,6 @@ import shutil
 from netaddr import *
 from pprint import pprint
 
-
 def is_mounted(name):
     for i in execute("mount"):
         vals = i.lstrip().split()
@@ -163,6 +162,19 @@ def execute(command):
     return result.splitlines()
 
 
+def save_iptables(command, iptables_file):
+    """ Execute command """
+    logging.debug("Saving iptables for %s" % command)
+    
+    result = execute(command)
+    fIptables = open(iptables_file, "w+")
+    
+    for line in result:
+        fIptables.write(line)
+        fIptables.write("\n")
+    fIptables.close()
+
+
 def execute2(command):
     """ Execute command """
     logging.debug("Executing %s" % command)


Mime
View raw message