You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/08/20 14:02:03 UTC
git commit: updated refs/heads/master to ac77660
Updated Branches:
refs/heads/master 9ed5083f9 -> ac7766086
CLOUDSTACK-4356: Added code for checking empty host, skip the test if no empty host found
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ac776608
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ac776608
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ac776608
Branch: refs/heads/master
Commit: ac776608645a211328b7d5cb4865c798251aae87
Parents: 9ed5083
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Sun Aug 18 23:28:50 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue Aug 20 17:31:24 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/ac776608/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