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 234ed4cb1dd..75bc0e3a6c2 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") 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 76f1ccad0b3..d8f39dcd24a 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)]) diff --git a/test/integration/component/test_vpc_redundant.py b/test/integration/component/test_vpc_redundant.py index c158c208b1a..68ce157f963 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()