CLOUDSTACK-9154 - Sets the pub interface down when all guest nets are gone - Refactors the set_backup, set_master and set_fault methods to have better names for the variable - Increase the sleep on the test in order to wait for the routers to be ready. It's now 3 times the GC settings
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5ef3144f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5ef3144f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5ef3144f Branch: refs/heads/4.7 Commit: 5ef3144fdf65922a3da99357c6f90f3811b231d8 Parents: f5a6dee Author: Wilder Rodrigues <wrodrig...@schubergphilis.com> Authored: Sat Dec 19 11:21:18 2015 +0100 Committer: Wilder Rodrigues <wrodrig...@schubergphilis.com> Committed: Tue Dec 22 14:52:08 2015 +0100 ---------------------------------------------------------------------- .../config/opt/cloud/bin/cs/CsRedundant.py | 48 ++++++++++++-------- test/integration/smoke/test_vpc_redundant.py | 3 +- 2 files changed, 29 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5ef3144f/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 84771ce..77d0a6b 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py @@ -84,6 +84,7 @@ class CsRedundant(object): # No redundancy if there is no guest network if guest is None: + self.set_backup() self._redundant_off() return @@ -226,17 +227,21 @@ class CsRedundant(object): self.set_lock() logging.info("Router switched to fault mode") - ads = [o for o in self.address.get_ips() if o.is_public()] - for o in ads: - CsHelper.execute("ifconfig %s down" % o.get_device()) + + ips = [ip for ip in self.address.get_ips() if ip.is_public()] + for ip in ips: + CsHelper.execute("ifconfig %s down" % ip.get_device()) + cmd = "%s -C %s" % (self.CONNTRACKD_BIN, self.CONNTRACKD_CONF) CsHelper.execute("%s -s" % cmd) CsHelper.service("ipsec", "stop") CsHelper.service("xl2tpd", "stop") CsHelper.service("dnsmasq", "stop") - ads = [o for o in self.address.get_ips() if o.needs_vrrp()] - for o in ads: - CsPasswdSvc(o.get_gateway()).stop() + + ips = [ip for ip in self.address.get_ips() if ip.needs_vrrp()] + for ip in ips: + CsPasswdSvc(ip.get_gateway()).stop() + self.cl.set_fault_state() self.cl.save() self.release_lock() @@ -250,22 +255,25 @@ class CsRedundant(object): self.set_lock() logging.debug("Setting router to backup") - ads = [o for o in self.address.get_ips() if o.is_public()] + dev = '' - for o in ads: - if dev == o.get_device(): + ips = [ip for ip in self.address.get_ips() if ip.is_public()] + for ip in ips: + if dev == ip.get_device(): continue - logging.info("Bringing public interface %s down" % o.get_device()) - cmd2 = "ip link set %s down" % o.get_device() + logging.info("Bringing public interface %s down" % ip.get_device()) + cmd2 = "ip link set %s down" % ip.get_device() CsHelper.execute(cmd2) - dev = o.get_device() + dev = ip.get_device() + cmd = "%s -C %s" % (self.CONNTRACKD_BIN, self.CONNTRACKD_CONF) CsHelper.execute("%s -d" % cmd) CsHelper.service("ipsec", "stop") CsHelper.service("xl2tpd", "stop") - ads = [o for o in self.address.get_ips() if o.needs_vrrp()] - for o in ads: - CsPasswdSvc(o.get_gateway()).stop() + + ips = [ip for ip in self.address.get_ips() if ip.needs_vrrp()] + for ip in ips: + CsPasswdSvc(ip.get_gateway()).stop() CsHelper.service("dnsmasq", "stop") self.cl.set_master_state(False) @@ -282,13 +290,13 @@ class CsRedundant(object): self.set_lock() logging.debug("Setting router to master") - ads = [o for o in self.address.get_ips() if o.is_public()] dev = '' + ips = [ip for ip in self.address.get_ips() if ip.is_public()] route = CsRoute() - for o in ads: - if dev == o.get_device(): + for ip in ips: + if dev == ip.get_device(): continue - dev = o.get_device() + dev = ip.get_device() logging.info("Will proceed configuring device ==> %s" % dev) cmd2 = "ip link set %s up" % dev if CsDevice(dev, self.config).waitfordevice(): @@ -296,7 +304,7 @@ class CsRedundant(object): logging.info("Bringing public interface %s up" % dev) try: - gateway = o.get_gateway() + gateway = ip.get_gateway() logging.info("Adding gateway ==> %s to device ==> %s" % (gateway, dev)) route.add_defaultroute(gateway) except: http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5ef3144f/test/integration/smoke/test_vpc_redundant.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index 65797e8..fbaa5b9 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -600,12 +600,11 @@ class TestVPCRedundancy(cloudstackTestCase): else: self.logger.debug("Could not retrieve the keys 'network.gc.interval' and 'network.gc.wait'. Sleeping for 2 minutes.") - time.sleep(total_sleep) + time.sleep(total_sleep * 3) self.check_routers_state(status_to_check="BACKUP", expected_count=2) self.start_vm() self.check_routers_state(status_to_check="MASTER") - self.do_vpc_test(False) @attr(tags=["advanced", "intervlan"], required_hardware="true") def test_05_rvpc_multi_tiers(self):