cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sw...@apache.org
Subject [1/3] git commit: updated refs/heads/4.8 to f8e71b0
Date Tue, 12 Apr 2016 14:10:37 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.8 ece5e7016 -> f8e71b023


speedup iptables by prefetching the variables


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

Branch: refs/heads/4.8
Commit: 0a01e82c231acc74df1633c60bf471b1e758b50a
Parents: 2d68893
Author: kollyma <kollyma@localhost.localdomain>
Authored: Mon Apr 11 20:58:03 2016 +0200
Committer: kollyma <kollyma@localhost.localdomain>
Committed: Mon Apr 11 20:58:03 2016 +0200

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/configure.py    | 37 +++++++++++---------
 1 file changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a01e82c/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 ab134fc..c37059b 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -775,41 +775,46 @@ class CsForwardingRules(CsDataBag):
             self.forward_vr(rule)
 
     def forward_vr(self, rule):
+        #prefetch iptables variables
+        public_fwinterface = self.getDeviceByIp(rule['public_ip'])
+        internal_fwinterface = self.getDeviceByIp(rule['internal_ip'])
+        public_fwports = self.portsToString(rule['public_ports'], ':')
+        internal_fwports = self.portsToString(rule['internal_ports'], '-')
         fw1 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -j DNAT --to-destination
%s:%s" % \
               (
                 rule['public_ip'],
-                self.getDeviceByIp(rule['public_ip']),
+                public_fwinterface,
                 rule['protocol'],
                 rule['protocol'],
-                self.portsToString(rule['public_ports'], ':'),
+                public_fwports,
                 rule['internal_ip'],
-                self.portsToString(rule['internal_ports'], '-')
+                internal_fwports
               )
         fw2 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -j DNAT --to-destination
%s:%s" % \
               (
                 rule['public_ip'],
-                self.getDeviceByIp(rule['internal_ip']),
+                internal_fwinterface,
                 rule['protocol'],
                 rule['protocol'],
-                self.portsToString(rule['public_ports'], ':'),
+                public_fwports,
                 rule['internal_ip'],
-                self.portsToString(rule['internal_ports'], '-')
+                internal_fwports
               )
         fw3 = "-A OUTPUT -d %s/32 -p %s -m %s --dport %s -j DNAT --to-destination %s:%s"
% \
               (
                 rule['public_ip'],
                 rule['protocol'],
                 rule['protocol'],
-                self.portsToString(rule['public_ports'], ':'),
+                public_fwports,
                 rule['internal_ip'],
-                self.portsToString(rule['internal_ports'], '-')
+                internal_fwports
               )
         fw4 = "-j SNAT --to-source %s -A POSTROUTING -s %s -d %s/32 -o %s -p %s -m %s --dport
%s" % \
               (
                 self.getGuestIp(),
                 self.getNetworkByIp(rule['internal_ip']),
                 rule['internal_ip'],
-                self.getDeviceByIp(rule['internal_ip']),
+                internal_fwinterface,
                 rule['protocol'],
                 rule['protocol'],
                 self.portsToString(rule['internal_ports'], ':')
@@ -817,24 +822,24 @@ class CsForwardingRules(CsDataBag):
         fw5 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -j MARK --set-xmark %s/0xffffffff"
% \
               (
                 rule['public_ip'],
-                self.getDeviceByIp(rule['public_ip']),
+                public_fwinterface,
                 rule['protocol'],
                 rule['protocol'],
-                self.portsToString(rule['public_ports'], ':'),
-                hex(int(self.getDeviceByIp(rule['public_ip'])[3:]))
+                public_fwports,
+                hex(int(public_fwinterface[3:]))
               )
         fw6 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -m state --state NEW -j
CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff" % \
               (
                 rule['public_ip'],
-                self.getDeviceByIp(rule['public_ip']),
+                public_fwinterface,
                 rule['protocol'],
                 rule['protocol'],
-                self.portsToString(rule['public_ports'], ':'),
+                public_fwports,
               )
         fw7 = "-A FORWARD -i %s -o %s -p %s -m %s --dport %s -m state --state NEW,ESTABLISHED
-j ACCEPT" % \
               (
-                self.getDeviceByIp(rule['public_ip']),
-                self.getDeviceByIp(rule['internal_ip']),
+                public_fwinterface,
+                internal_fwinterface,
                 rule['protocol'],
                 rule['protocol'],
                 self.portsToString(rule['internal_ports'], ':')


Mime
View raw message