Repository: cloudstack
Updated Branches:
  refs/heads/master 13357cff7 -> 1b14fa6ab


CLOUDSTACK-7387: Corrected code related to adding host tags

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


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

Branch: refs/heads/master
Commit: 1b14fa6abef5811079eeb7cbd26ab718f6f69405
Parents: 13357cf
Author: Gaurav Aradhye <gaurav.arad...@clogeny.com>
Authored: Mon Sep 15 14:03:49 2014 +0530
Committer: SrikanteswaraRao Talluri <tall...@apache.org>
Committed: Tue Sep 16 11:33:13 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/1b14fa6a/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..73adee7 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="hosttag1")
+            Host.update(cls.api_client, id=cls.hosts[1].id, 
hosttags="hosttag2")
             cls.account.delete(cls.api_client)
             wait_for_cleanup(cls.api_client, ["account.cleanup.interval"])
             #Cleanup resources used

Reply via email to