cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [07/40] git commit: updated refs/heads/master to f4133a7
Date Thu, 18 Dec 2014 11:56:27 GMT
CLOUDSTACK-8059: test_host_high_availability.py - Adding necessary code to check the hosts
in cluster and update the host with appropriate tags to make it HA enabled

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/40f26142
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/40f26142
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/40f26142

Branch: refs/heads/master
Commit: 40f26142b38bda5b10b01b2a2aad77d1b0b5f36e
Parents: 75f9201
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Wed Dec 10 16:14:49 2014 +0530
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Wed Dec 10 18:45:43 2014 +0530

----------------------------------------------------------------------
 .../maint/test_host_high_availability.py        | 36 ++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/40f26142/test/integration/component/maint/test_host_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_host_high_availability.py b/test/integration/component/maint/test_host_high_availability.py
index 0d76f81..1824e75 100644
--- a/test/integration/component/maint/test_host_high_availability.py
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -19,14 +19,17 @@
 """
 #Import Local Modules
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
 from marvin.cloudstackAPI import (migrateVirtualMachine,
                                   prepareHostForMaintenance,
                                   cancelHostMaintenance)
 from marvin.lib.utils import cleanup_resources
 from marvin.lib.base import (Account,
                              VirtualMachine,
-                             ServiceOffering)
+                             ServiceOffering,
+                             Cluster,
+                             Host,
+                             Configurations)
 from marvin.lib.common import (get_zone,
                                get_domain,
                                get_template,
@@ -99,6 +102,33 @@ class TestHostHighAvailability(cloudstackTestCase):
             cls.zone.id,
             cls.services["ostype"]
         )
+
+
+        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, type="Routing")
+            if len(cls.hosts) >= 3:
+                clusterWithSufficientHosts = cluster
+                break
+
+        if clusterWithSufficientHosts is None:
+            raise unittest.SkipTest("No Cluster with 3 hosts found")
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='ha.tag'
+                                      )
+
+        assert isinstance(configs, list), "Config list not\
+                retrieved for ha.tag"
+
+        if configs[0].value != "ha":
+            raise unittest.SkipTest("Please set the global config\
+                    value for ha.tag as 'ha'")
+
+        Host.update(cls.api_client, id=cls.hosts[2].id, hosttags="ha")
+
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
 
@@ -123,6 +153,8 @@ class TestHostHighAvailability(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
+            # Remove the host from HA
+            Host.update(cls.api_client, id=cls.hosts[2].id, hosttags="")
             #Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:


Mime
View raw message