cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: updated refs/heads/4.2 to 836f093
Date Tue, 20 Aug 2013 12:02:14 GMT
Updated Branches:
  refs/heads/4.2 a82f66e0f -> 836f09361


CLOUDSTACK-4356: Added code for checking empty host, skip the test if no empty host found

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit ac776608645a211328b7d5cb4865c798251aae87)


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

Branch: refs/heads/4.2
Commit: 836f093610a97e484ee820878dfa53af18902ea5
Parents: a82f66e
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Sun Aug 18 23:28:50 2013 -0400
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Tue Aug 20 17:31:53 2013 +0530

----------------------------------------------------------------------
 .../component/test_implicit_planner.py          | 44 ++++++++++++++++++--
 1 file changed, 41 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/836f0936/test/integration/component/test_implicit_planner.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_implicit_planner.py b/test/integration/component/test_implicit_planner.py
index 854b481..f233ba9 100644
--- a/test/integration/component/test_implicit_planner.py
+++ b/test/integration/component/test_implicit_planner.py
@@ -104,8 +104,7 @@ class TestImplicitPlanner(cloudstackTestCase):
                             cls.zone.id,
                             cls.services["ostype"]
                             )
-        # Set Zones and disk offerings
-        cls.services["small"]["zoneid"] = cls.zone.id
+        # Set template id
         cls.services["small"]["template"] = template.id
 
         # Create VMs, NAT Rules etc
@@ -154,6 +153,45 @@ class TestImplicitPlanner(cloudstackTestCase):
         #    host that is empty (not running vms of any other account)
         # 2. Deploy another vm it should get deployed on the same host.
 
+        # list and find an empty host
+        all_hosts = list_hosts(
+                           self.apiclient,
+                           type='Routing',
+                           )
+
+        empty_host = None
+        for host in all_hosts:
+            vms_on_host = list_virtual_machines(
+                                                self.api_client,
+                                                hostid=host.id,
+                                                listall=True)
+
+            # If no user vms on host, then further check for any System vms running
+            if vms_on_host is None:
+                ssvms_on_host = list_ssvms(
+                                           self.api_client,
+                                           hostid=host.id,
+                                           listall=True)
+
+                # If no ssvms running on host, then further check for routers
+                if ssvms_on_host is None:
+                    routers_on_host = list_routers(
+                                                   self.api_client,
+                                                   hostid=host.id,
+                                                   listall=True)
+
+                    # If no routers are running on host, then this host can be considered
+                    # as empty for implicit dedication
+
+                    if routers_on_host is None:
+                        empty_host = host
+                        self.services["small"]["zoneid"] = host.zoneid
+                        break
+
+        #If no empty host is found, return
+        if empty_host is None:
+           self.skipTest("Did not find any empty hosts, Skipping")
+
         #create a virtual machine
         virtual_machine_1 = VirtualMachine.create(
                                         self.api_client,
@@ -226,4 +264,4 @@ class TestImplicitPlanner(cloudstackTestCase):
                 vm_response_2.hostid,
                 "Check both vms have the same host id"
                 )
-        return
\ No newline at end of file
+        return


Mime
View raw message