mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-7387: Corrected code related to adding host tags
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
13357cff7d
commit
1b14fa6abe
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user