mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
unskipping skipped tests
and indentation fixes Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
61e150fd58
commit
16e9eaca80
@ -18,15 +18,12 @@
|
|||||||
""" P1 tests for dedicated Host high availability
|
""" P1 tests for dedicated Host high availability
|
||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
import marvin
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import *
|
from marvin.cloudstackTestCase import *
|
||||||
from marvin.cloudstackAPI import *
|
from marvin.cloudstackAPI import *
|
||||||
from marvin.integration.lib.utils import *
|
from marvin.integration.lib.utils import *
|
||||||
from marvin.integration.lib.base import *
|
from marvin.integration.lib.base import *
|
||||||
from marvin.integration.lib.common import *
|
from marvin.integration.lib.common import *
|
||||||
from marvin import remoteSSHClient
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
@ -34,90 +31,90 @@ class Services:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.services = {
|
self.services = {
|
||||||
"account": {
|
"account": {
|
||||||
"email": "test@test.com",
|
"email": "test@test.com",
|
||||||
"firstname": "HA",
|
"firstname": "HA",
|
||||||
"lastname": "HA",
|
"lastname": "HA",
|
||||||
"username": "HA",
|
"username": "HA",
|
||||||
# Random characters are appended for unique
|
# Random characters are appended for unique
|
||||||
# username
|
# username
|
||||||
"password": "password",
|
"password": "password",
|
||||||
},
|
},
|
||||||
"service_offering_with_ha": {
|
"service_offering_with_ha": {
|
||||||
"name": "Tiny Instance With HA Enabled",
|
"name": "Tiny Instance With HA Enabled",
|
||||||
"displaytext": "Tiny Instance",
|
"displaytext": "Tiny Instance",
|
||||||
"cpunumber": 1,
|
"cpunumber": 1,
|
||||||
"cpuspeed": 100, # in MHz
|
"cpuspeed": 100, # in MHz
|
||||||
"memory": 128, # In MBs
|
"memory": 128, # In MBs
|
||||||
},
|
},
|
||||||
"service_offering_without_ha": {
|
"service_offering_without_ha": {
|
||||||
"name": "Tiny Instance Without HA",
|
"name": "Tiny Instance Without HA",
|
||||||
"displaytext": "Tiny Instance",
|
"displaytext": "Tiny Instance",
|
||||||
"cpunumber": 1,
|
"cpunumber": 1,
|
||||||
"cpuspeed": 100, # in MHz
|
"cpuspeed": 100, # in MHz
|
||||||
"memory": 128, # In MBs
|
"memory": 128, # In MBs
|
||||||
},
|
},
|
||||||
"virtual_machine": {
|
"virtual_machine": {
|
||||||
"displayname": "VM",
|
"displayname": "VM",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
"password": "password",
|
"password": "password",
|
||||||
"ssh_port": 22,
|
"ssh_port": 22,
|
||||||
"hypervisor": 'XenServer',
|
"hypervisor": 'XenServer',
|
||||||
# Hypervisor type should be same as
|
# Hypervisor type should be same as
|
||||||
# hypervisor type of cluster
|
# hypervisor type of cluster
|
||||||
"privateport": 22,
|
"privateport": 22,
|
||||||
"publicport": 22,
|
"publicport": 22,
|
||||||
"protocol": 'TCP',
|
"protocol": 'TCP',
|
||||||
},
|
},
|
||||||
"ostype": 'CentOS 5.3 (64-bit)',
|
"ostype": 'CentOS 5.3 (64-bit)',
|
||||||
"timeout": 100,
|
"timeout": 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestHostHighAvailability(cloudstackTestCase):
|
class TestHostHighAvailability(cloudstackTestCase):
|
||||||
""" Dedicated host HA test cases """
|
""" Dedicated host HA test cases """
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|
||||||
cls.api_client = super(
|
cls.api_client = super(
|
||||||
TestHostHighAvailability,
|
TestHostHighAvailability,
|
||||||
cls
|
cls
|
||||||
).getClsTestClient().getApiClient()
|
).getClsTestClient().getApiClient()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(
|
cls.domain = get_domain(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services
|
cls.services
|
||||||
)
|
)
|
||||||
cls.zone = get_zone(
|
cls.zone = get_zone(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services
|
cls.services
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.template = get_template(
|
cls.template = get_template(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
cls.services["ostype"]
|
||||||
)
|
)
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
cls.services["virtual_machine"]["template"] = cls.template.id
|
cls.services["virtual_machine"]["template"] = cls.template.id
|
||||||
|
|
||||||
cls.service_offering_with_ha = ServiceOffering.create(
|
cls.service_offering_with_ha = ServiceOffering.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering_with_ha"],
|
cls.services["service_offering_with_ha"],
|
||||||
offerha=True
|
offerha=True
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.service_offering_without_ha = ServiceOffering.create(
|
cls.service_offering_without_ha = ServiceOffering.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering_without_ha"],
|
cls.services["service_offering_without_ha"],
|
||||||
offerha=False
|
offerha=False
|
||||||
)
|
)
|
||||||
|
|
||||||
cls._cleanup = [
|
cls._cleanup = [
|
||||||
cls.service_offering_with_ha,
|
cls.service_offering_with_ha,
|
||||||
cls.service_offering_without_ha,
|
cls.service_offering_without_ha,
|
||||||
]
|
]
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -133,11 +130,11 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
self.apiclient = self.testClient.getApiClient()
|
self.apiclient = self.testClient.getApiClient()
|
||||||
self.dbclient = self.testClient.getDbConnection()
|
self.dbclient = self.testClient.getDbConnection()
|
||||||
self.account = Account.create(
|
self.account = Account.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["account"],
|
self.services["account"],
|
||||||
admin=True,
|
admin=True,
|
||||||
domainid=self.domain.id
|
domainid=self.domain.id
|
||||||
)
|
)
|
||||||
self.cleanup = [self.account]
|
self.cleanup = [self.account]
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -150,8 +147,8 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(configuration = "ha.tag")
|
@attr(configuration="ha.tag")
|
||||||
@attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator"])
|
@attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator"])
|
||||||
def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self):
|
def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self):
|
||||||
""" Test VM deployments (Create HA enabled Compute Service Offering and VM) """
|
""" Test VM deployments (Create HA enabled Compute Service Offering and VM) """
|
||||||
|
|
||||||
@ -166,57 +163,57 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#list and validate above created service offering with Ha enabled
|
#list and validate above created service offering with Ha enabled
|
||||||
list_service_response = list_service_offering(
|
list_service_response = list_service_offering(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=self.service_offering_with_ha.id
|
id=self.service_offering_with_ha.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_service_response, list),
|
isinstance(list_service_response, list),
|
||||||
True,
|
True,
|
||||||
"listServiceOfferings returned invalid object in response."
|
"listServiceOfferings returned invalid object in response."
|
||||||
)
|
)
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_service_response),
|
len(list_service_response),
|
||||||
0,
|
0,
|
||||||
"listServiceOfferings returned empty list."
|
"listServiceOfferings returned empty list."
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_service_response[0].offerha,
|
list_service_response[0].offerha,
|
||||||
True,
|
True,
|
||||||
"The service offering is not HA enabled"
|
"The service offering is not HA enabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
#create virtual machine with the service offering with Ha enabled
|
#create virtual machine with the service offering with Ha enabled
|
||||||
virtual_machine = VirtualMachine.create(
|
virtual_machine = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["virtual_machine"],
|
self.services["virtual_machine"],
|
||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering_with_ha.id
|
serviceofferingid=self.service_offering_with_ha.id
|
||||||
)
|
)
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=virtual_machine.id,
|
id=virtual_machine.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"listVirtualMachines returned invalid object in response."
|
"listVirtualMachines returned invalid object in response."
|
||||||
)
|
)
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"listVirtualMachines returned empty list."
|
"listVirtualMachines returned empty list."
|
||||||
)
|
)
|
||||||
self.debug("Deployed VM on host: %s" % vms[0].hostid)
|
self.debug("Deployed VM on host: %s" % vms[0].hostid)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
vms[0].haenable,
|
vms[0].haenable,
|
||||||
True,
|
True,
|
||||||
"VM not created with HA enable tag"
|
"VM not created with HA enable tag"
|
||||||
)
|
)
|
||||||
|
|
||||||
@attr(configuration = "ha.tag")
|
@attr(configuration="ha.tag")
|
||||||
@attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
@attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
||||||
def test_02_no_vm_creation_on_host_with_haenabled(self):
|
def test_02_no_vm_creation_on_host_with_haenabled(self):
|
||||||
""" Verify you can not create new VMs on hosts with an ha.tag """
|
""" Verify you can not create new VMs on hosts with an ha.tag """
|
||||||
|
|
||||||
@ -232,30 +229,30 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#create and verify virtual machine with HA enabled service offering
|
#create and verify virtual machine with HA enabled service offering
|
||||||
virtual_machine_with_ha = VirtualMachine.create(
|
virtual_machine_with_ha = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["virtual_machine"],
|
self.services["virtual_machine"],
|
||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering_with_ha.id
|
serviceofferingid=self.service_offering_with_ha.id
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=virtual_machine_with_ha.id,
|
id=virtual_machine_with_ha.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"listVirtualMachines returned invalid object in response."
|
"listVirtualMachines returned invalid object in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"listVirtualMachines returned empty list."
|
"listVirtualMachines returned empty list."
|
||||||
)
|
)
|
||||||
|
|
||||||
vm = vms[0]
|
vm = vms[0]
|
||||||
|
|
||||||
@ -263,53 +260,53 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#validate the virtual machine created is host Ha enabled
|
#validate the virtual machine created is host Ha enabled
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm.hostid
|
id=vm.hostid
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"listHosts returned invalid object in response."
|
"listHosts returned invalid object in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"listHosts retuned empty list in response."
|
"listHosts retuned empty list in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_hosts_response[0].hahost,
|
list_hosts_response[0].hahost,
|
||||||
False,
|
False,
|
||||||
"VM created on HA enabled host."
|
"VM created on HA enabled host."
|
||||||
)
|
)
|
||||||
|
|
||||||
#create and verify virtual machine with Ha disabled service offering
|
#create and verify virtual machine with Ha disabled service offering
|
||||||
virtual_machine_without_ha = VirtualMachine.create(
|
virtual_machine_without_ha = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["virtual_machine"],
|
self.services["virtual_machine"],
|
||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering_without_ha.id
|
serviceofferingid=self.service_offering_without_ha.id
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=virtual_machine_without_ha.id,
|
id=virtual_machine_without_ha.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"listVirtualMachines returned invalid object in response."
|
"listVirtualMachines returned invalid object in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"listVirtualMachines returned empty list."
|
"listVirtualMachines returned empty list."
|
||||||
)
|
)
|
||||||
|
|
||||||
vm = vms[0]
|
vm = vms[0]
|
||||||
|
|
||||||
@ -317,20 +314,20 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#verify that the virtual machine created on the host is Ha disabled
|
#verify that the virtual machine created on the host is Ha disabled
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm.hostid
|
id=vm.hostid
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"listHosts returned invalid object in response."
|
"listHosts returned invalid object in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"listHosts returned empty list."
|
"listHosts returned empty list."
|
||||||
)
|
)
|
||||||
|
|
||||||
host = list_hosts_response[0]
|
host = list_hosts_response[0]
|
||||||
|
|
||||||
@ -338,10 +335,10 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
host.hahost,
|
host.hahost,
|
||||||
False,
|
False,
|
||||||
"VM migrated to HA enabled host."
|
"VM migrated to HA enabled host."
|
||||||
)
|
)
|
||||||
|
|
||||||
@attr(configuration = "ha.tag")
|
@attr(configuration="ha.tag")
|
||||||
@attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
@attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
||||||
def test_03_cant_migrate_vm_to_host_with_ha_positive(self):
|
def test_03_cant_migrate_vm_to_host_with_ha_positive(self):
|
||||||
""" Verify you can not migrate VMs to hosts with an ha.tag (positive) """
|
""" Verify you can not migrate VMs to hosts with an ha.tag (positive) """
|
||||||
|
|
||||||
@ -355,30 +352,30 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#create and verify the virtual machine with HA enabled service offering
|
#create and verify the virtual machine with HA enabled service offering
|
||||||
virtual_machine_with_ha = VirtualMachine.create(
|
virtual_machine_with_ha = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["virtual_machine"],
|
self.services["virtual_machine"],
|
||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering_with_ha.id
|
serviceofferingid=self.service_offering_with_ha.id
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=virtual_machine_with_ha.id,
|
id=virtual_machine_with_ha.id,
|
||||||
listall=True,
|
listall=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
vm = vms[0]
|
vm = vms[0]
|
||||||
|
|
||||||
@ -386,19 +383,19 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#Find out a Suitable host for VM migration
|
#Find out a Suitable host for VM migration
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"The listHosts API returned the invalid list"
|
"The listHosts API returned the invalid list"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"The listHosts returned nothing."
|
"The listHosts returned nothing."
|
||||||
)
|
)
|
||||||
suitableHost = None
|
suitableHost = None
|
||||||
for host in list_hosts_response:
|
for host in list_hosts_response:
|
||||||
if host.suitableformigration == True and host.hostid != vm.hostid:
|
if host.suitableformigration == True and host.hostid != vm.hostid:
|
||||||
@ -417,20 +414,20 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#Verify that the VM migrated to a targeted Suitable host
|
#Verify that the VM migrated to a targeted Suitable host
|
||||||
list_vm_response = list_virtual_machines(
|
list_vm_response = list_virtual_machines(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm.id
|
id=vm.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_vm_response, list),
|
isinstance(list_vm_response, list),
|
||||||
True,
|
True,
|
||||||
"The listVirtualMachines returned the invalid list."
|
"The listVirtualMachines returned the invalid list."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
list_vm_response,
|
list_vm_response,
|
||||||
None,
|
None,
|
||||||
"The listVirtualMachines API returned nothing."
|
"The listVirtualMachines API returned nothing."
|
||||||
)
|
)
|
||||||
|
|
||||||
vm_response = list_vm_response[0]
|
vm_response = list_vm_response[0]
|
||||||
|
|
||||||
@ -438,16 +435,16 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
vm_response.id,
|
vm_response.id,
|
||||||
vm.id,
|
vm.id,
|
||||||
"The virtual machine id and the the virtual machine from listVirtualMachines is not matching."
|
"The virtual machine id and the the virtual machine from listVirtualMachines is not matching."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
vm_response.hostid,
|
vm_response.hostid,
|
||||||
suitableHost.id,
|
suitableHost.id,
|
||||||
"The VM is not migrated to targeted suitable host."
|
"The VM is not migrated to targeted suitable host."
|
||||||
)
|
)
|
||||||
|
|
||||||
@attr(configuration = "ha.tag")
|
@attr(configuration="ha.tag")
|
||||||
@attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
@attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
||||||
def test_04_cant_migrate_vm_to_host_with_ha_negative(self):
|
def test_04_cant_migrate_vm_to_host_with_ha_negative(self):
|
||||||
""" Verify you can not migrate VMs to hosts with an ha.tag (negative) """
|
""" Verify you can not migrate VMs to hosts with an ha.tag (negative) """
|
||||||
|
|
||||||
@ -461,30 +458,30 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#create and verify virtual machine with HA enabled service offering
|
#create and verify virtual machine with HA enabled service offering
|
||||||
virtual_machine_with_ha = VirtualMachine.create(
|
virtual_machine_with_ha = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["virtual_machine"],
|
self.services["virtual_machine"],
|
||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering_with_ha.id
|
serviceofferingid=self.service_offering_with_ha.id
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=virtual_machine_with_ha.id,
|
id=virtual_machine_with_ha.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"The listVirtualMachines returned invalid object in response."
|
"The listVirtualMachines returned invalid object in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"The listVirtualMachines returned empty response."
|
"The listVirtualMachines returned empty response."
|
||||||
)
|
)
|
||||||
|
|
||||||
vm = vms[0]
|
vm = vms[0]
|
||||||
|
|
||||||
@ -492,25 +489,25 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#Find out Non-Suitable host for VM migration
|
#Find out Non-Suitable host for VM migration
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"listHosts returned invalid object in response."
|
"listHosts returned invalid object in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"listHosts returned empty response."
|
"listHosts returned empty response."
|
||||||
)
|
)
|
||||||
|
|
||||||
notSuitableHost = None
|
notSuitableHost = None
|
||||||
for host in list_hosts_response:
|
for host in list_hosts_response:
|
||||||
if not host.suitableformigration and host.hostid != vm.hostid:
|
if not host.suitableformigration and host.hostid != vm.hostid:
|
||||||
notSuitableHost = host
|
notSuitableHost = host
|
||||||
break
|
break
|
||||||
|
|
||||||
self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
|
self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
|
||||||
|
|
||||||
@ -524,36 +521,36 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
#Verify that the virtual machine got migrated to targeted Non-Suitable host
|
#Verify that the virtual machine got migrated to targeted Non-Suitable host
|
||||||
list_vm_response = list_virtual_machines(
|
list_vm_response = list_virtual_machines(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm.id
|
id=vm.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_vm_response, list),
|
isinstance(list_vm_response, list),
|
||||||
True,
|
True,
|
||||||
"listVirtualMachine returned invalid object in response."
|
"listVirtualMachine returned invalid object in response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_vm_response),
|
len(list_vm_response),
|
||||||
0,
|
0,
|
||||||
"listVirtualMachines returned empty response."
|
"listVirtualMachines returned empty response."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_vm_response[0].id,
|
list_vm_response[0].id,
|
||||||
vm.id,
|
vm.id,
|
||||||
"Virtual machine id with the virtual machine from listVirtualMachine is not matching."
|
"Virtual machine id with the virtual machine from listVirtualMachine is not matching."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_vm_response[0].hostid,
|
list_vm_response[0].hostid,
|
||||||
notSuitableHost.id,
|
notSuitableHost.id,
|
||||||
"The detination host id of migrated VM is not matching."
|
"The detination host id of migrated VM is not matching."
|
||||||
)
|
)
|
||||||
|
|
||||||
@attr(configuration = "ha.tag")
|
@attr(configuration="ha.tag")
|
||||||
@attr(speed = "slow")
|
@attr(speed="slow")
|
||||||
@attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
@attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
||||||
def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self):
|
def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self):
|
||||||
""" Verify that none of the VMs with HA enabled migrate to an ha tagged host during live migration """
|
""" Verify that none of the VMs with HA enabled migrate to an ha tagged host during live migration """
|
||||||
|
|
||||||
@ -570,55 +567,55 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
# create and verify virtual machine with HA disabled service offering
|
# create and verify virtual machine with HA disabled service offering
|
||||||
virtual_machine_with_ha = VirtualMachine.create(
|
virtual_machine_with_ha = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["virtual_machine"],
|
self.services["virtual_machine"],
|
||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering_with_ha.id
|
serviceofferingid=self.service_offering_with_ha.id
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=virtual_machine_with_ha.id,
|
id=virtual_machine_with_ha.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
vm_with_ha_enabled = vms[0]
|
vm_with_ha_enabled = vms[0]
|
||||||
|
|
||||||
#Verify the virtual machine got created on non HA host
|
#Verify the virtual machine got created on non HA host
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm_with_ha_enabled.hostid
|
id=vm_with_ha_enabled.hostid
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"Check list response returns a valid list"
|
"Check list response returns a valid list"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"Check Host is available"
|
"Check Host is available"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_hosts_response[0].hahost,
|
list_hosts_response[0].hahost,
|
||||||
False,
|
False,
|
||||||
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
#put the Host in maintainance mode
|
#put the Host in maintainance mode
|
||||||
self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid)
|
self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid)
|
||||||
@ -634,58 +631,58 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
self.apiclient,
|
self.apiclient,
|
||||||
virtualmachineid=vm_with_ha_enabled.id,
|
virtualmachineid=vm_with_ha_enabled.id,
|
||||||
interval=timeout
|
interval=timeout
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm_with_ha_enabled.id,
|
id=vm_with_ha_enabled.id,
|
||||||
listall=True,
|
listall=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
vm_with_ha_enabled1 = vms[0]
|
vm_with_ha_enabled1 = vms[0]
|
||||||
|
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm_with_ha_enabled1.hostid
|
id=vm_with_ha_enabled1.hostid
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"Check list response returns a valid list"
|
"Check list response returns a valid list"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"Check Host is available"
|
"Check Host is available"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_hosts_response[0].hahost,
|
list_hosts_response[0].hahost,
|
||||||
False,
|
False,
|
||||||
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_enabled.hostid)
|
self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_enabled.hostid)
|
||||||
cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
|
cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
|
||||||
cmd.id = vm_with_ha_enabled.hostid
|
cmd.id = vm_with_ha_enabled.hostid
|
||||||
self.apiclient.cancelHostMaintenance(cmd)
|
self.apiclient.cancelHostMaintenance(cmd)
|
||||||
|
|
||||||
@attr(configuration = "ha.tag")
|
@attr(configuration="ha.tag")
|
||||||
@attr(speed = "slow")
|
@attr(speed="slow")
|
||||||
@attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
@attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
|
||||||
def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self):
|
def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self):
|
||||||
""" Verify that none of the VMs without HA enabled migrate to an ha tagged host during live migration """
|
""" Verify that none of the VMs without HA enabled migrate to an ha tagged host during live migration """
|
||||||
|
|
||||||
@ -702,55 +699,55 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
|
|
||||||
# create and verify virtual machine with HA disabled service offering
|
# create and verify virtual machine with HA disabled service offering
|
||||||
virtual_machine_without_ha = VirtualMachine.create(
|
virtual_machine_without_ha = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["virtual_machine"],
|
self.services["virtual_machine"],
|
||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering_without_ha.id
|
serviceofferingid=self.service_offering_without_ha.id
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=virtual_machine_without_ha.id,
|
id=virtual_machine_without_ha.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
vm_with_ha_disabled = vms[0]
|
vm_with_ha_disabled = vms[0]
|
||||||
|
|
||||||
#Verify the virtual machine got created on non HA host
|
#Verify the virtual machine got created on non HA host
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm_with_ha_disabled.hostid
|
id=vm_with_ha_disabled.hostid
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"Check list response returns a valid list"
|
"Check list response returns a valid list"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"Check Host is available"
|
"Check Host is available"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_hosts_response[0].hahost,
|
list_hosts_response[0].hahost,
|
||||||
False,
|
False,
|
||||||
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
#put the Host in maintainance mode
|
#put the Host in maintainance mode
|
||||||
self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid)
|
self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid)
|
||||||
@ -766,47 +763,47 @@ class TestHostHighAvailability(cloudstackTestCase):
|
|||||||
self.apiclient,
|
self.apiclient,
|
||||||
virtualmachineid=vm_with_ha_disabled.id,
|
virtualmachineid=vm_with_ha_disabled.id,
|
||||||
interval=timeout
|
interval=timeout
|
||||||
)
|
)
|
||||||
|
|
||||||
vms = VirtualMachine.list(
|
vms = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vm_with_ha_disabled.id,
|
id=vm_with_ha_disabled.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(vms, list),
|
isinstance(vms, list),
|
||||||
True,
|
True,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(vms),
|
len(vms),
|
||||||
0,
|
0,
|
||||||
"List VMs should return valid response for deployed VM"
|
"List VMs should return valid response for deployed VM"
|
||||||
)
|
)
|
||||||
|
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=vms[0].hostid
|
id=vms[0].hostid
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
isinstance(list_hosts_response, list),
|
isinstance(list_hosts_response, list),
|
||||||
True,
|
True,
|
||||||
"Check list response returns a valid list"
|
"Check list response returns a valid list"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
len(list_hosts_response),
|
len(list_hosts_response),
|
||||||
0,
|
0,
|
||||||
"Check Host is available"
|
"Check Host is available"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_hosts_response[0].hahost,
|
list_hosts_response[0].hahost,
|
||||||
False,
|
False,
|
||||||
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
"The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_disabled.hostid)
|
self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_disabled.hostid)
|
||||||
cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
|
cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
|
||||||
|
|||||||
@ -186,7 +186,6 @@ class Services:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@unittest.skip("No suitable setup available for testing")
|
|
||||||
class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
|
class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -562,7 +561,6 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@unittest.skip("No suitable setup available for testing")
|
|
||||||
class TestVPCNetworkRules(cloudstackTestCase):
|
class TestVPCNetworkRules(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user