You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2017/12/08 08:49:09 UTC

[cloudstack] 01/01: wait until 3*advert_int+skew time before checking router status

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 5319958d92ed3b47a6cc0e6caea91b651c42467b
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Fri Dec 8 12:32:02 2017 +0530

    wait until 3*advert_int+skew time before checking router status
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 systemvm/debian/opt/cloud/bin/cs/CsAddress.py   |  8 +++-----
 systemvm/debian/opt/cloud/bin/cs/CsRedundant.py |  3 ++-
 test/integration/smoke/test_vpc_redundant.py    | 12 +++++++++---
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py
index 376e8ea..6ad5045 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py
@@ -565,11 +565,9 @@ class CsIP:
                 app.setup()
 
         cmdline = self.config.cmdline()
-        # Start password server on non-redundant routers and on master rVR
-        if self.get_type() in ["guest"] and (not cmdline.is_redundant() or cmdline.is_master()):
-            CsPasswdSvc(self.address['public_ip']).start()
-        else:
-            CsPasswdSvc(self.address['public_ip']).stop()
+        # If redundant then this is dealt with by the master backup functions
+        if self.get_type() in ["guest"] and not cmdline.is_redundant():
+            pwdsvc = CsPasswdSvc(self.address['public_ip']).start()
 
         if self.get_type() == "public" and self.config.is_vpc() and method == "add":
             if self.address["source_nat"]:
diff --git a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
index 2575e0b..108f337 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
@@ -141,7 +141,7 @@ class CsRedundant(object):
 
         keepalived_conf.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
         keepalived_conf.section("authentication {", "}", [
-                                "        auth_type AH \n", "        auth_pass %s\n" % self.cl.get_router_password()])
+                                "        auth_type AH \n", "        auth_pass %s\n" % self.cl.get_router_password()[:8]])
         keepalived_conf.section(
             "virtual_ipaddress {", "}", self._collect_ips())
 
@@ -193,6 +193,7 @@ class CsRedundant(object):
         proc = CsProcess(['/usr/sbin/keepalived'])
         if not proc.find() or keepalived_conf.is_changed() or force_keepalived_restart:
             keepalived_conf.commit()
+            os.chmod(self.KEEPALIVED_CONF, 0o644)
             CsHelper.service("keepalived", "restart")
 
     def release_lock(self):
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index 2c7f4ae..4ac0c72 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -275,7 +275,7 @@ class TestVPCRedundancy(cloudstackTestCase):
         cls.logger.setLevel(logging.DEBUG)
         cls.logger.addHandler(cls.stream_handler)
 
-        return
+        cls.advert_int = int(Configurations.list(cls.api_client, name="router.redundant.vrrp.interval")[0].value)
 
     @classmethod
     def tearDownClass(cls):
@@ -283,7 +283,6 @@ class TestVPCRedundancy(cloudstackTestCase):
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
 
     def setUp(self):
         self.routers = []
@@ -344,10 +343,16 @@ class TestVPCRedundancy(cloudstackTestCase):
             len(self.routers), count,
             "Check that %s routers were indeed created" % count)
 
+    def wait_for_vrrp(self):
+        # Wait until 3*advert_int+skew time to get one of the routers as MASTER
+        time.sleep(3 * self.advert_int + 5)
+
     def check_routers_state(self,count=2, status_to_check="MASTER", expected_count=1, showall=False):
         vals = ["MASTER", "BACKUP", "UNKNOWN"]
         cnts = [0, 0, 0]
 
+        self.wait_for_vrrp()
+
         result = "UNKNOWN"
         self.query_routers(count, showall)
         for router in self.routers:
@@ -404,6 +409,7 @@ class TestVPCRedundancy(cloudstackTestCase):
         self.logger.debug('Stopping router %s' % router.id)
         cmd = stopRouter.stopRouterCmd()
         cmd.id = router.id
+        cmd.forced = True
         self.apiclient.stopRouter(cmd)
 
     def reboot_router(self, router):
@@ -657,7 +663,7 @@ class TestVPCRedundancy(cloudstackTestCase):
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_05_rvpc_multi_tiers(self):
         """ Create a redundant VPC with 1 Tier, 1 VM, 1 ACL, 1 PF and test Network GC Nics"""
-        self.logger.debug("Starting test_04_rvpc_network_garbage_collector_nics")
+        self.logger.debug("Starting test_05_rvpc_multi_tiers")
         self.query_routers()
 
         network = self.create_network(self.services["network_offering"], "10.1.1.1", nr_vms=1, mark_net_cleanup=False)

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.