cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject git commit: updated refs/heads/4.5 to f92fa42
Date Fri, 14 Nov 2014 11:19:19 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 2bfddc55b -> f92fa4257


CLOUDSTACK-7885 : Fixed the script '/maint/test_vpc_host_maintenance.py'

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f92fa425
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f92fa425
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f92fa425

Branch: refs/heads/4.5
Commit: f92fa4257a0261a72e36571c65d0c20fa17c0b9f
Parents: 2bfddc5
Author: Chandan Purushothama <Chandan.Purushothama@citrix.com>
Authored: Thu Nov 13 22:33:40 2014 -0800
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Fri Nov 14 16:46:37 2014 +0530

----------------------------------------------------------------------
 .../maint/test_vpc_host_maintenance.py          | 106 +++++++++++++++++--
 1 file changed, 96 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f92fa425/test/integration/component/maint/test_vpc_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_vpc_host_maintenance.py b/test/integration/component/maint/test_vpc_host_maintenance.py
index fbc1bb4..7027469 100644
--- a/test/integration/component/maint/test_vpc_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_host_maintenance.py
@@ -36,6 +36,7 @@ from marvin.lib.common import (get_domain,
                                get_zone,
                                get_template,
                                wait_for_cleanup)
+import time
 
 
 class Services:
@@ -190,7 +191,7 @@ class Services:
                          "ostype": 'CentOS 5.3 (64-bit)',
                          # Cent OS 5.3 (64 bit)
                          "sleep": 60,
-                         "timeout": 10,
+                         "timeout": 30,
                          "mode": 'advanced'
                     }
 
@@ -376,7 +377,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
 
         self.router = routers[0]
         if self.router.state == "Running":
-            Router.stop(self.apiclient, id=self.router.id)
+            self.debug("Verified that the Router is in Running State")
 
         self.cleanup = []
         return
@@ -448,6 +449,9 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
         # 2. VMs present on the above host should successfully migrate to the
         #    other host present in the cluster
 
+        Host.update(self.apiclient, id=self.hosts[0].id, hosttags="hosttag1,hosttag2")
+        Host.update(self.apiclient, id=self.hosts[1].id, hosttags="hosttag1,hosttag2")
+        
         self.validate_vm_deployment()
         self.debug("Stop the host on which the VPC virtual router is running")
         try:
@@ -468,12 +472,34 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
                          True,
                          "List routers shall return a valid VPCVR for account"
                          )
-        for router in routers:
-            self.assertEqual(
-                             router.state,
-                             "Running",
-                             "Router state should be running after migration"
-                             )
+        
+        router = routers[0]
+                    
+        try:
+            
+            timeout = self.services["timeout"]
+            self.debug("Timeout Value %d : " % timeout)
+            while True:
+                list_router_response = Router.list(
+                    self.apiclient,
+                    id = router.id,
+                    state = "Running"
+                )
+                
+                if list_router_response is not None:
+                    break
+                elif timeout == 0:
+                    raise Exception("Router state should be running after migration")
+
+                time.sleep(self.services["sleep"])
+                timeout = timeout - 1
+                self.debug("Waiting for %d seconds - %d tries left" % (self.services["sleep"],timeout))
+            
+            self.debug("Verified that the Router is in Running State")
+            
+        except Exception as e:
+            self.fail("Failed to find the Router in Running state %s " % e)
+                
         vms = VirtualMachine.list(
                                   self.apiclient,
                                   account=self.account.name,
@@ -488,7 +514,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
         for vm in vms:
             self.assertEqual(
                              vm.state,
-                             "Ruuning",
+                             "Running",
                              "Vm state should be running after migration"
                              )
         return
@@ -506,12 +532,51 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
         # 1. Successfully cancel the Maintenance mode on the host.
         # 2. Migrate the VMs back successfully onto the host.
         # 3. Check that the network connectivity exists with the migrated VMs.
+        
+        try:
+            timeout = self.services["timeout"]
+            while True:
+                list_host_response = Host.list(
+                    self.apiclient,
+                    id=self.vpcvr.hostid,
+                    resourcestate="Maintenance")
+                
+                if list_host_response is not None:
+                    break
+                elif timeout == 0:
+                    raise Exception("Failed to list the Host in Maintenance State")
+
+                time.sleep(self.services["sleep"])
+                timeout = timeout - 1
+            
+            self.debug("Verified that the Host is in Maintenance State")
+            
+        except:
+            self.fail("Failed to find the Host in maintenance state")
 
         self.debug("Cancel host maintenence on which the VPCVR is running")
         try:
             Host.cancelMaintenance(self.apiclient, id=self.vpcvr.hostid)
+
+            timeout = self.services["timeout"]
+            while True:
+                list_host_response = Host.list(
+                    self.apiclient,
+                    id=self.vpcvr.hostid,
+                    state="Up")
+                
+                if list_host_response is not None:
+                    break
+                elif timeout == 0:
+                    raise Exception("Failed to list the Host in Up State after Canceling
Maintenance Mode")
+
+                time.sleep(self.services["sleep"])
+                timeout = timeout - 1
+            
+            self.debug("Verified that the Host is in Up State after Canceling Maintenance
Mode")
+            
         except Exception as e:
-            self.fail("Failed to enable maintenance mode on host: %s" % e)
+            self.fail("Failed to cancel maintenance mode on host: %s" % e)
 
         self.debug(
             "Migrating the instances back to the host: %s" %
@@ -555,6 +620,27 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
         # 2. Network connectivity to all the VMs on the host should not be
         #    effected due to reconnection.
 
+        try:
+            timeout = self.services["timeout"]        
+            while True:
+                list_host_response = Host.list(
+                    self.apiclient,
+                    id=self.vpcvr.hostid,
+                    resourcestate="Enabled")
+                
+                if list_host_response is not None:
+                    break
+                elif timeout == 0:
+                    raise Exception("Failed to list the Host in Up State")
+
+                time.sleep(self.services["sleep"])
+                timeout = timeout - 1
+            
+            self.debug("Verified that the Host is in Up State")
+            
+        except:
+            self.fail("Failed to find the Host in Up State")
+
         self.debug("Reconnecting the host where VPC VR is running")
         try:
             Host.reconnect(self.apiclient, id=self.vpcvr.hostid)


Mime
View raw message