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:09 UTC
[04/13] git commit: updated refs/heads/master to 6fe5ae0
CLOUDSTACK-8952 - Make sure we restart dnsmasq if the configuration file changes
- It was working before because the Routers were restarting about 10 times for each operation
e.g. adding a VM to a network ot acquiring a new IP.
- Adding stat_rules of internal LB to iptables
We needed one extra rule in the INPUT chain
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1886c4a1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1886c4a1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1886c4a1
Branch: refs/heads/master
Commit: 1886c4a1b33c2cd75bd5e49626943b5526894bc6
Parents: d762dc8
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Thu Oct 15 12:44:54 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Sat Oct 17 12:20:40 2015 +0200
----------------------------------------------------------------------
.../patches/debian/config/opt/cloud/bin/cs/CsDhcp.py | 14 +++++++++-----
.../debian/config/opt/cloud/bin/cs/CsLoadBalancer.py | 12 ++++++++++--
test/integration/component/test_vpc_redundant.py | 2 ++
3 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1886c4a1/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
index 234ed4c..75bc0e3 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
@@ -36,22 +36,26 @@ class CsDhcp(CsDataBag):
self.preseed()
self.cloud = CsFile(DHCP_HOSTS)
self.conf = CsFile(CLOUD_CONF)
- length = len(self.conf)
+
for item in self.dbag:
if item == "id":
continue
self.add(self.dbag[item])
self.write_hosts()
+
if self.cloud.is_changed():
self.delete_leases()
+
self.configure_server()
- self.conf.commit()
- self.cloud.commit()
- if self.conf.is_changed():
+
+ if self.conf.is_changed() or self.cloud.is_changed():
CsHelper.service("dnsmasq", "restart")
elif self.cloud.is_changed():
CsHelper.hup_dnsmasq("dnsmasq", "dnsmasq")
+ self.conf.commit()
+ self.cloud.commit()
+
def configure_server(self):
# self.conf.addeq("dhcp-hostsfile=%s" % DHCP_HOSTS)
for i in self.devinfo:
@@ -131,8 +135,8 @@ class CsDhcp(CsDataBag):
file.repopulate()
for ip in self.hosts:
file.add("%s\t%s" % (ip, self.hosts[ip]))
- file.commit()
if file.is_changed():
+ file.commit()
logging.info("Updated hosts file")
else:
logging.debug("Hosts file unchanged")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1886c4a1/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 76f1cca..d8f39dc 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
@@ -55,13 +55,15 @@ class CsLoadBalancer(CsDataBag):
add_rules = self.dbag['config'][0]['add_rules']
remove_rules = self.dbag['config'][0]['remove_rules']
- self._configure_firewall(add_rules, remove_rules)
+ stat_rules = self.dbag['config'][0]['stat_rules']
+ self._configure_firewall(add_rules, remove_rules, stat_rules)
- def _configure_firewall(self, add_rules, remove_rules):
+ def _configure_firewall(self, add_rules, remove_rules, stat_rules):
firewall = self.config.get_fw()
logging.debug("CsLoadBalancer:: configuring firewall. Add rules ==> %s" % add_rules)
logging.debug("CsLoadBalancer:: configuring firewall. Remove rules ==> %s" % remove_rules)
+ logging.debug("CsLoadBalancer:: configuring firewall. Stat rules ==> %s" % stat_rules)
for rules in add_rules:
path = rules.split(':')
@@ -74,3 +76,9 @@ class CsLoadBalancer(CsDataBag):
ip = path[0]
port = path[1]
firewall.append(["filter", "", "-D INPUT -p tcp -m tcp -d %s --dport %s -m state --state NEW -j ACCEPT" % (ip, port)])
+
+ for rules in stat_rules:
+ path = rules.split(':')
+ ip = path[0]
+ port = path[1]
+ firewall.append(["filter", "", "-A INPUT -p tcp -m tcp -d %s --dport %s -m state --state NEW -j ACCEPT" % (ip, port)])
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1886c4a1/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 c158c20..68ce157 100644
--- a/test/integration/component/test_vpc_redundant.py
+++ b/test/integration/component/test_vpc_redundant.py
@@ -458,6 +458,7 @@ 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(10)
self.check_master_status(2)
self.add_nat_rules()
self.do_vpc_test(False)
@@ -484,6 +485,7 @@ 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(10)
self.check_master_status(2)
self.add_nat_rules()
self.do_default_routes_test()