You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2014/09/17 11:05:16 UTC

[2/2] git commit: updated refs/heads/master to 20f9d3d

CLOUDSTACK-7387: Corrected code related to adding host tags

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


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

Branch: refs/heads/master
Commit: 20f9d3dcd8a980e03b651629b510b6e98e411271
Parents: 374d6ad
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon Sep 15 14:03:49 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Sep 17 14:34:32 2014 +0530

----------------------------------------------------------------------
 .../maint/test_vpc_host_maintenance.py          | 43 ++++++++++++++++----
 1 file changed, 35 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/20f9d3dc/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 83ba271..fbc1bb4 100644
--- a/test/integration/component/maint/test_vpc_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_host_maintenance.py
@@ -18,13 +18,24 @@
 """ Component tests VM life cycle in VPC network functionality
 """
 #Import Local Modules
-import marvin
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackAPI import migrateSystemVm
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Host,
+                             VirtualMachine,
+                             ServiceOffering,
+                             VPC,
+                             VpcOffering,
+                             Router,
+                             Network,
+                             NetworkOffering,
+                             Cluster,
+                             Account)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               wait_for_cleanup)
 
 
 class Services:
@@ -55,7 +66,7 @@ class Services:
                                     "cpunumber": 1,
                                     "cpuspeed": 100,
                                     "memory": 64,
-                                    "tags": "HOST_TAGS_HERE"
+                                    "hosttags": "hosttag1"
                                     },
                          "service_offering_2": {
                                     "name": "Tiny Instance- tagged host 2",
@@ -63,7 +74,7 @@ class Services:
                                     "cpunumber": 1,
                                     "cpuspeed": 100,
                                     "memory": 64,
-                                    "tags": "HOST_TAGS_HERE"
+                                    "hosttags": "hosttag2"
                                     },
                          "network_offering": {
                                     "name": 'VPC Network offering',
@@ -203,6 +214,19 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
 
+        clusterWithSufficientHosts = None
+        clusters = Cluster.list(cls.api_client, zoneid=cls.zone.id)
+        for cluster in clusters:
+            cls.hosts = Host.list(cls.api_client, clusterid=cluster.id)
+            if len(cls.hosts) >= 2:
+                clusterWithSufficientHosts = cluster
+
+        if clusterWithSufficientHosts is None:
+            raise unittest.SkipTest("No Cluster with 2 hosts found")
+
+        Host.update(cls.api_client, id=cls.hosts[0].id, hosttags="hosttag1")
+        Host.update(cls.api_client, id=cls.hosts[1].id, hosttags="hosttag2")
+
         cls.service_offering_1 = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering_1"]
@@ -325,6 +349,9 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
+            #Delete the host tags
+            Host.update(cls.api_client, id=cls.hosts[0].id, hosttags="")
+            Host.update(cls.api_client, id=cls.hosts[1].id, hosttags="")
             cls.account.delete(cls.api_client)
             wait_for_cleanup(cls.api_client, ["account.cleanup.interval"])
             #Cleanup resources used