You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/10/20 08:01:11 UTC
[06/13] git commit: updated refs/heads/master to 6fe5ae0
CLOUDSTACK-8952 - Do not restart conntrackd unless it's needed
- With the keepalived fixed they should not be needed anymore. So first reducing them drasticaly
- I am now making a backup of the template file, write to the template file and compare it with the existing configuration
- The template file is recovered afer the process
- I also check if the process is running
- I fixed a bug in the compare method
- I am now updating the configuration variable once the file content is flushed to disk
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b4920aa0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b4920aa0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b4920aa0
Branch: refs/heads/master
Commit: b4920aa028e75c64160988113ac268e5ea5ae69e
Parents: 5a21605
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Wed Oct 14 14:24:11 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Sat Oct 17 12:20:40 2015 +0200
----------------------------------------------------------------------
.../patches/debian/config/opt/cloud/bin/cs/CsFile.py | 7 ++++++-
.../debian/config/opt/cloud/bin/cs/CsLoadBalancer.py | 8 ++++----
.../debian/config/opt/cloud/bin/cs/CsRedundant.py | 13 +++++++------
test/integration/component/test_vpc_redundant.py | 7 +------
4 files changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b4920aa0/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
index 319b48e..7829c0a 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
@@ -64,6 +64,9 @@ class CsFile:
handle.write(line)
handle.close()
logging.info("Wrote edited file %s" % self.filename)
+ self.config = list(self.new_config)
+ logging.info("Updated file in-cache configuration")
+
def dump(self):
for line in self.new_config:
@@ -160,4 +163,6 @@ class CsFile:
def compare(self, o):
- return (isinstance(o, self.__class__) and set(self.config) == set(o.new_config))
+ result = (isinstance(o, self.__class__) and set(self.config) == set(o.config))
+ logging.debug("Comparison of CsFiles content is ==> %s" % result)
+ return result
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b4920aa0/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
index a288eac..76f1cca 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
@@ -17,7 +17,6 @@
import logging
import os.path
import re
-import shutil
from cs.CsDatabag import CsDataBag
from CsProcess import CsProcess
from CsFile import CsFile
@@ -37,13 +36,14 @@ class CsLoadBalancer(CsDataBag):
return
config = self.dbag['config'][0]['configuration']
file1 = CsFile(HAPROXY_CONF_T)
- file2 = CsFile(HAPROXY_CONF_P)
file1.empty()
for x in config:
[file1.append(w, -1) for w in x.split('\n')]
+
+ file1.commit()
+ file2 = CsFile(HAPROXY_CONF_P)
if not file2.compare(file1):
- file1.commit()
- shutil.copy2(HAPROXY_CONF_T, HAPROXY_CONF_P)
+ CsHelper.copy(HAPROXY_CONF_T, HAPROXY_CONF_P)
proc = CsProcess(['/var/run/haproxy.pid'])
if not proc.find():
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b4920aa0/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
index 5361c33..5dec749 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -131,9 +131,9 @@ class CsRedundant(object):
CsHelper.copy(conntrackd_template_conf, conntrackd_temp_bkp)
- connt = CsFile(conntrackd_template_conf)
+ conntrackd_tmpl = CsFile(conntrackd_template_conf)
if guest is not None:
- connt.section("Multicast {", "}", [
+ conntrackd_tmpl.section("Multicast {", "}", [
"IPv4_address 225.0.0.50\n",
"Group 3780\n",
"IPv4_interface %s\n" % guest.get_ip(),
@@ -141,14 +141,15 @@ class CsRedundant(object):
"SndSocketBuffer 1249280\n",
"RcvSocketBuffer 1249280\n",
"Checksum on\n"])
- connt.section("Address Ignore {", "}", self._collect_ignore_ips())
- connt.commit()
+ conntrackd_tmpl.section("Address Ignore {", "}", self._collect_ignore_ips())
+ conntrackd_tmpl.commit()
conntrackd_conf = CsFile(self.CONNTRACKD_CONF)
- if not connt.compare(conntrackd_conf):
+ is_equals = conntrackd_tmpl.compare(conntrackd_conf)
+ proc = CsProcess(['/etc/conntrackd/conntrackd.conf'])
+ if not proc.find() or not is_equals:
CsHelper.copy(conntrackd_template_conf, self.CONNTRACKD_CONF)
- proc = CsProcess(['/etc/conntrackd/conntrackd.conf'])
CsHelper.service("conntrackd", "restart")
# Restore the template file and remove the backup.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b4920aa0/test/integration/component/test_vpc_redundant.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_redundant.py b/test/integration/component/test_vpc_redundant.py
index 6f82aec..c158c20 100644
--- a/test/integration/component/test_vpc_redundant.py
+++ b/test/integration/component/test_vpc_redundant.py
@@ -458,26 +458,22 @@ class TestVPCRedundancy(cloudstackTestCase):
self.query_routers()
self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1"))
self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1"))
- time.sleep(30)
self.check_master_status(2)
self.add_nat_rules()
self.do_vpc_test(False)
- time.sleep(30)
self.stop_router_by_type("MASTER")
# wait for the backup router to transit to master state
- time.sleep(30)
+ time.sleep(10)
self.check_master_status(1)
self.do_vpc_test(False)
self.delete_nat_rules()
- time.sleep(45)
self.check_master_status(1)
self.do_vpc_test(True)
self.start_routers()
self.add_nat_rules()
- time.sleep(30)
self.check_master_status(2)
self.do_vpc_test(False)
@@ -488,7 +484,6 @@ class TestVPCRedundancy(cloudstackTestCase):
self.query_routers()
self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1"))
self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1"))
- time.sleep(30)
self.check_master_status(2)
self.add_nat_rules()
self.do_default_routes_test()