Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13057D24C for ; Mon, 27 May 2013 04:41:06 +0000 (UTC) Received: (qmail 33269 invoked by uid 500); 27 May 2013 04:41:05 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 33045 invoked by uid 500); 27 May 2013 04:40:57 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 32803 invoked by uid 99); 27 May 2013 04:40:55 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 May 2013 04:40:55 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 38D5189A8F1; Mon, 27 May 2013 04:40:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 16e9eac Date: Mon, 27 May 2013 04:40:55 +0000 (UTC) Updated Branches: refs/heads/master 61e150fd5 -> 16e9eaca8 unskipping skipped tests and indentation fixes Signed-off-by: Prasanna Santhanam Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/16e9eaca Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/16e9eaca Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/16e9eaca Branch: refs/heads/master Commit: 16e9eaca80bb4c7fe2baa2ce05fc03a9032277cd Parents: 61e150f Author: Prasanna Santhanam Authored: Mon May 27 10:10:01 2013 +0530 Committer: Prasanna Santhanam Committed: Mon May 27 10:10:01 2013 +0530 ---------------------------------------------------------------------- .../component/test_host_high_availability.py | 677 +++++++-------- .../component/test_vpc_host_maintenance.py | 2 - 2 files changed, 337 insertions(+), 342 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16e9eaca/test/integration/component/test_host_high_availability.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_host_high_availability.py b/test/integration/component/test_host_high_availability.py index ec297d4..57eb5ed 100644 --- a/test/integration/component/test_host_high_availability.py +++ b/test/integration/component/test_host_high_availability.py @@ -18,15 +18,12 @@ """ P1 tests for dedicated Host high availability """ #Import Local Modules -import marvin from nose.plugins.attrib import attr from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.integration.lib.utils import * from marvin.integration.lib.base import * from marvin.integration.lib.common import * -from marvin import remoteSSHClient -import datetime class Services: @@ -34,90 +31,90 @@ class Services: def __init__(self): self.services = { - "account": { - "email": "test@test.com", - "firstname": "HA", - "lastname": "HA", - "username": "HA", - # Random characters are appended for unique - # username - "password": "password", - }, - "service_offering_with_ha": { - "name": "Tiny Instance With HA Enabled", - "displaytext": "Tiny Instance", - "cpunumber": 1, - "cpuspeed": 100, # in MHz - "memory": 128, # In MBs - }, - "service_offering_without_ha": { - "name": "Tiny Instance Without HA", - "displaytext": "Tiny Instance", - "cpunumber": 1, - "cpuspeed": 100, # in MHz - "memory": 128, # In MBs - }, - "virtual_machine": { - "displayname": "VM", - "username": "root", - "password": "password", - "ssh_port": 22, - "hypervisor": 'XenServer', - # Hypervisor type should be same as - # hypervisor type of cluster - "privateport": 22, - "publicport": 22, - "protocol": 'TCP', - }, - "ostype": 'CentOS 5.3 (64-bit)', - "timeout": 100, - } + "account": { + "email": "test@test.com", + "firstname": "HA", + "lastname": "HA", + "username": "HA", + # Random characters are appended for unique + # username + "password": "password", + }, + "service_offering_with_ha": { + "name": "Tiny Instance With HA Enabled", + "displaytext": "Tiny Instance", + "cpunumber": 1, + "cpuspeed": 100, # in MHz + "memory": 128, # In MBs + }, + "service_offering_without_ha": { + "name": "Tiny Instance Without HA", + "displaytext": "Tiny Instance", + "cpunumber": 1, + "cpuspeed": 100, # in MHz + "memory": 128, # In MBs + }, + "virtual_machine": { + "displayname": "VM", + "username": "root", + "password": "password", + "ssh_port": 22, + "hypervisor": 'XenServer', + # Hypervisor type should be same as + # hypervisor type of cluster + "privateport": 22, + "publicport": 22, + "protocol": 'TCP', + }, + "ostype": 'CentOS 5.3 (64-bit)', + "timeout": 100, + } + class TestHostHighAvailability(cloudstackTestCase): """ Dedicated host HA test cases """ - + @classmethod def setUpClass(cls): - cls.api_client = super( - TestHostHighAvailability, - cls - ).getClsTestClient().getApiClient() + TestHostHighAvailability, + cls + ).getClsTestClient().getApiClient() cls.services = Services().services # Get Zone, Domain and templates cls.domain = get_domain( - cls.api_client, - cls.services - ) + cls.api_client, + cls.services + ) cls.zone = get_zone( - cls.api_client, - cls.services - ) + cls.api_client, + cls.services + ) cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"] - ) + cls.api_client, + cls.zone.id, + cls.services["ostype"] + ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering_with_ha = ServiceOffering.create( - cls.api_client, - cls.services["service_offering_with_ha"], - offerha=True - ) - + cls.api_client, + cls.services["service_offering_with_ha"], + offerha=True + ) + cls.service_offering_without_ha = ServiceOffering.create( - cls.api_client, - cls.services["service_offering_without_ha"], - offerha=False - ) - + cls.api_client, + cls.services["service_offering_without_ha"], + offerha=False + ) + cls._cleanup = [ - cls.service_offering_with_ha, - cls.service_offering_without_ha, - ] + cls.service_offering_with_ha, + cls.service_offering_without_ha, + ] return @classmethod @@ -133,11 +130,11 @@ class TestHostHighAvailability(cloudstackTestCase): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.account = Account.create( - self.apiclient, - self.services["account"], - admin=True, - domainid=self.domain.id - ) + self.apiclient, + self.services["account"], + admin=True, + domainid=self.domain.id + ) self.cleanup = [self.account] return @@ -150,11 +147,11 @@ class TestHostHighAvailability(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - @attr(configuration = "ha.tag") - @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator"]) + @attr(configuration="ha.tag") + @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator"]) def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self): """ Test VM deployments (Create HA enabled Compute Service Offering and VM) """ - + # Steps, #1. Create a Compute service offering with the 'Offer HA' option selected. #2. Create a Guest VM with the compute service offering created above. @@ -163,63 +160,63 @@ class TestHostHighAvailability(cloudstackTestCase): #The listServiceOffering API should list 'offerha' as true. #2. Select the newly created VM and ensure that the Compute offering field value lists the compute service offering that was selected. # Also, check that the HA Enabled field is enabled 'Yes'. - + #list and validate above created service offering with Ha enabled list_service_response = list_service_offering( - self.apiclient, - id=self.service_offering_with_ha.id - ) + self.apiclient, + id=self.service_offering_with_ha.id + ) self.assertEqual( isinstance(list_service_response, list), True, "listServiceOfferings returned invalid object in response." - ) + ) self.assertNotEqual( len(list_service_response), 0, "listServiceOfferings returned empty list." - ) + ) self.assertEqual( list_service_response[0].offerha, True, "The service offering is not HA enabled" - ) - + ) + #create virtual machine with the service offering with Ha enabled virtual_machine = VirtualMachine.create( - self.apiclient, - self.services["virtual_machine"], - accountid=self.account.name, - domainid=self.account.domainid, - serviceofferingid=self.service_offering_with_ha.id - ) + self.apiclient, + self.services["virtual_machine"], + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering_with_ha.id + ) vms = VirtualMachine.list( - self.apiclient, - id=virtual_machine.id, - listall=True - ) + self.apiclient, + id=virtual_machine.id, + listall=True + ) self.assertEqual( isinstance(vms, list), True, "listVirtualMachines returned invalid object in response." - ) + ) self.assertNotEqual( len(vms), 0, "listVirtualMachines returned empty list." - ) + ) self.debug("Deployed VM on host: %s" % vms[0].hostid) self.assertEqual( vms[0].haenable, True, "VM not created with HA enable tag" - ) + ) - @attr(configuration = "ha.tag") - @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) + @attr(configuration="ha.tag") + @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) def test_02_no_vm_creation_on_host_with_haenabled(self): """ Verify you can not create new VMs on hosts with an ha.tag """ - + # Steps, #1. Fresh install CS (Bonita) that supports this feature #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage @@ -229,122 +226,122 @@ class TestHostHighAvailability(cloudstackTestCase): # Validations, #Check to make sure the newly created VM is not on any HA enabled hosts #The VM should be created only on host1 or host2 and never host3 (HA enabled) - + #create and verify virtual machine with HA enabled service offering virtual_machine_with_ha = VirtualMachine.create( - self.apiclient, - self.services["virtual_machine"], - accountid=self.account.name, - domainid=self.account.domainid, - serviceofferingid=self.service_offering_with_ha.id - ) - + self.apiclient, + self.services["virtual_machine"], + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering_with_ha.id + ) + vms = VirtualMachine.list( - self.apiclient, - id=virtual_machine_with_ha.id, - listall=True - ) - + self.apiclient, + id=virtual_machine_with_ha.id, + listall=True + ) + self.assertEqual( isinstance(vms, list), True, "listVirtualMachines returned invalid object in response." - ) - + ) + self.assertNotEqual( len(vms), 0, "listVirtualMachines returned empty list." - ) - + ) + vm = vms[0] - + self.debug("Deployed VM on host: %s" % vm.hostid) - + #validate the virtual machine created is host Ha enabled list_hosts_response = list_hosts( - self.apiclient, - id=vm.hostid - ) + self.apiclient, + id=vm.hostid + ) self.assertEqual( isinstance(list_hosts_response, list), True, "listHosts returned invalid object in response." - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "listHosts retuned empty list in response." - ) - + ) + self.assertEqual( list_hosts_response[0].hahost, False, "VM created on HA enabled host." - ) - + ) + #create and verify virtual machine with Ha disabled service offering virtual_machine_without_ha = VirtualMachine.create( - self.apiclient, - self.services["virtual_machine"], - accountid=self.account.name, - domainid=self.account.domainid, - serviceofferingid=self.service_offering_without_ha.id - ) - + self.apiclient, + self.services["virtual_machine"], + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering_without_ha.id + ) + vms = VirtualMachine.list( - self.apiclient, - id=virtual_machine_without_ha.id, - listall=True - ) - + self.apiclient, + id=virtual_machine_without_ha.id, + listall=True + ) + self.assertEqual( isinstance(vms, list), True, "listVirtualMachines returned invalid object in response." - ) - + ) + self.assertNotEqual( len(vms), 0, "listVirtualMachines returned empty list." - ) - + ) + vm = vms[0] - + self.debug("Deployed VM on host: %s" % vm.hostid) - + #verify that the virtual machine created on the host is Ha disabled list_hosts_response = list_hosts( - self.apiclient, - id=vm.hostid - ) + self.apiclient, + id=vm.hostid + ) self.assertEqual( isinstance(list_hosts_response, list), True, "listHosts returned invalid object in response." - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "listHosts returned empty list." - ) - + ) + host = list_hosts_response[0] - + self.assertEqual( host.hahost, False, "VM migrated to HA enabled host." - ) + ) - @attr(configuration = "ha.tag") - @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) + @attr(configuration="ha.tag") + @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) 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) """ - + # Steps, #1. Create a Compute service offering with the 'Offer HA' option selected. #2. Create a Guest VM with the compute service offering created above. @@ -352,61 +349,61 @@ class TestHostHighAvailability(cloudstackTestCase): # Validations #The option from the 'Migrate instance to another host' dialog box' should list host3 as 'Not Suitable' for migration. #Confirm that the VM is migrated to the 'Suitable' host you selected (i.e. host2) - + #create and verify the virtual machine with HA enabled service offering virtual_machine_with_ha = VirtualMachine.create( - self.apiclient, - self.services["virtual_machine"], - accountid=self.account.name, - domainid=self.account.domainid, - serviceofferingid=self.service_offering_with_ha.id - ) - + self.apiclient, + self.services["virtual_machine"], + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering_with_ha.id + ) + vms = VirtualMachine.list( - self.apiclient, - id=virtual_machine_with_ha.id, - listall=True, - ) - + self.apiclient, + id=virtual_machine_with_ha.id, + listall=True, + ) + self.assertEqual( isinstance(vms, list), True, "List VMs should return valid response for deployed VM" - ) - + ) + self.assertNotEqual( len(vms), 0, "List VMs should return valid response for deployed VM" - ) - + ) + vm = vms[0] - + self.debug("Deployed VM on host: %s" % vm.hostid) - + #Find out a Suitable host for VM migration list_hosts_response = list_hosts( - self.apiclient, - ) + self.apiclient, + ) self.assertEqual( isinstance(list_hosts_response, list), True, "The listHosts API returned the invalid list" - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "The listHosts returned nothing." - ) + ) suitableHost = None for host in list_hosts_response: if host.suitableformigration == True and host.hostid != vm.hostid: suitableHost = host break - + self.assertTrue(suitableHost is not None, "suitablehost should not be None") - + #Migration of the VM to a suitable host self.debug("Migrating VM-ID: %s to Host: %s" % (self.vm.id, suitableHost.id)) @@ -417,20 +414,20 @@ class TestHostHighAvailability(cloudstackTestCase): #Verify that the VM migrated to a targeted Suitable host list_vm_response = list_virtual_machines( - self.apiclient, - id=vm.id - ) + self.apiclient, + id=vm.id + ) self.assertEqual( isinstance(list_vm_response, list), True, "The listVirtualMachines returned the invalid list." - ) + ) self.assertNotEqual( list_vm_response, None, "The listVirtualMachines API returned nothing." - ) + ) vm_response = list_vm_response[0] @@ -438,19 +435,19 @@ class TestHostHighAvailability(cloudstackTestCase): vm_response.id, vm.id, "The virtual machine id and the the virtual machine from listVirtualMachines is not matching." - ) + ) self.assertEqual( vm_response.hostid, suitableHost.id, "The VM is not migrated to targeted suitable host." - ) - - @attr(configuration = "ha.tag") - @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) + ) + + @attr(configuration="ha.tag") + @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) 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) """ - + # Steps, #1. Create a Compute service offering with the 'Offer HA' option selected. #2. Create a Guest VM with the compute service offering created above. @@ -458,62 +455,62 @@ class TestHostHighAvailability(cloudstackTestCase): # Validations, #The option from the 'Migrate instance to another host' dialog box should list host3 as 'Not Suitable' for migration. #By design, The Guest VM can STILL can be migrated to host3 if the admin chooses to do so. - + #create and verify virtual machine with HA enabled service offering virtual_machine_with_ha = VirtualMachine.create( - self.apiclient, - self.services["virtual_machine"], - accountid=self.account.name, - domainid=self.account.domainid, - serviceofferingid=self.service_offering_with_ha.id - ) - + self.apiclient, + self.services["virtual_machine"], + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering_with_ha.id + ) + vms = VirtualMachine.list( - self.apiclient, - id=virtual_machine_with_ha.id, - listall=True - ) - + self.apiclient, + id=virtual_machine_with_ha.id, + listall=True + ) + self.assertEqual( isinstance(vms, list), True, "The listVirtualMachines returned invalid object in response." - ) - + ) + self.assertNotEqual( len(vms), 0, "The listVirtualMachines returned empty response." - ) - + ) + vm = vms[0] - + self.debug("Deployed VM on host: %s" % vm.hostid) - + #Find out Non-Suitable host for VM migration list_hosts_response = list_hosts( - self.apiclient, - ) + self.apiclient, + ) self.assertEqual( isinstance(list_hosts_response, list), True, "listHosts returned invalid object in response." - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "listHosts returned empty response." - ) - - notSuitableHost = None + ) + + notSuitableHost = None for host in list_hosts_response: if not host.suitableformigration and host.hostid != vm.hostid: notSuitableHost = host - break - + break + self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None") - + #Migrate VM to Non-Suitable host self.debug("Migrating VM-ID: %s to Host: %s" % (vm.id, notSuitableHost.id)) @@ -524,39 +521,39 @@ class TestHostHighAvailability(cloudstackTestCase): #Verify that the virtual machine got migrated to targeted Non-Suitable host list_vm_response = list_virtual_machines( - self.apiclient, - id=vm.id - ) + self.apiclient, + id=vm.id + ) self.assertEqual( isinstance(list_vm_response, list), True, "listVirtualMachine returned invalid object in response." - ) + ) self.assertNotEqual( len(list_vm_response), 0, "listVirtualMachines returned empty response." - ) + ) self.assertEqual( list_vm_response[0].id, vm.id, "Virtual machine id with the virtual machine from listVirtualMachine is not matching." - ) + ) self.assertEqual( list_vm_response[0].hostid, notSuitableHost.id, "The detination host id of migrated VM is not matching." - ) + ) - @attr(configuration = "ha.tag") - @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) + @attr(configuration="ha.tag") + @attr(speed="slow") + @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): """ Verify that none of the VMs with HA enabled migrate to an ha tagged host during live migration """ - + # Steps, #1. Fresh install CS that supports this feature #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage @@ -567,128 +564,128 @@ class TestHostHighAvailability(cloudstackTestCase): # Validations, #1. Make sure the VMs are created on either host1 or host2 and not on host3 #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3. - + # create and verify virtual machine with HA disabled service offering virtual_machine_with_ha = VirtualMachine.create( - self.apiclient, - self.services["virtual_machine"], - accountid=self.account.name, - domainid=self.account.domainid, - serviceofferingid=self.service_offering_with_ha.id - ) - + self.apiclient, + self.services["virtual_machine"], + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering_with_ha.id + ) + vms = VirtualMachine.list( - self.apiclient, - id=virtual_machine_with_ha.id, - listall=True - ) - + self.apiclient, + id=virtual_machine_with_ha.id, + listall=True + ) + self.assertEqual( isinstance(vms, list), True, "List VMs should return valid response for deployed VM" - ) - + ) + self.assertNotEqual( len(vms), 0, "List VMs should return valid response for deployed VM" - ) - + ) + vm_with_ha_enabled = vms[0] - + #Verify the virtual machine got created on non HA host list_hosts_response = list_hosts( - self.apiclient, - id=vm_with_ha_enabled.hostid - ) + self.apiclient, + id=vm_with_ha_enabled.hostid + ) self.assertEqual( isinstance(list_hosts_response, list), True, "Check list response returns a valid list" - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "Check Host is available" - ) - + ) + self.assertEqual( list_hosts_response[0].hahost, False, "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 self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid) cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() cmd.id = vm_with_ha_enabled.hostid self.apiclient.prepareHostForMaintenance(cmd) - + timeout = self.services["timeout"] - + #verify the VM live migration happened to another running host self.debug("Waiting for VM to come up") wait_for_vm( self.apiclient, virtualmachineid=vm_with_ha_enabled.id, interval=timeout - ) - + ) + vms = VirtualMachine.list( - self.apiclient, - id=vm_with_ha_enabled.id, - listall=True, - ) - + self.apiclient, + id=vm_with_ha_enabled.id, + listall=True, + ) + self.assertEqual( isinstance(vms, list), True, "List VMs should return valid response for deployed VM" - ) - + ) + self.assertNotEqual( len(vms), 0, "List VMs should return valid response for deployed VM" - ) - + ) + vm_with_ha_enabled1 = vms[0] - + list_hosts_response = list_hosts( - self.apiclient, - id=vm_with_ha_enabled1.hostid - ) + self.apiclient, + id=vm_with_ha_enabled1.hostid + ) self.assertEqual( isinstance(list_hosts_response, list), True, "Check list response returns a valid list" - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "Check Host is available" - ) - + ) + self.assertEqual( list_hosts_response[0].hahost, False, "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) cmd = cancelHostMaintenance.cancelHostMaintenanceCmd() cmd.id = vm_with_ha_enabled.hostid self.apiclient.cancelHostMaintenance(cmd) - - @attr(configuration = "ha.tag") - @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) + + @attr(configuration="ha.tag") + @attr(speed="slow") + @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): """ Verify that none of the VMs without HA enabled migrate to an ha tagged host during live migration """ - + # Steps, #1. Fresh install CS that supports this feature #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage @@ -699,115 +696,115 @@ class TestHostHighAvailability(cloudstackTestCase): # Validations, #1. Make sure the VMs are created on either host1 or host2 and not on host3 #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3. - + # create and verify virtual machine with HA disabled service offering virtual_machine_without_ha = VirtualMachine.create( - self.apiclient, - self.services["virtual_machine"], - accountid=self.account.name, - domainid=self.account.domainid, - serviceofferingid=self.service_offering_without_ha.id - ) - + self.apiclient, + self.services["virtual_machine"], + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering_without_ha.id + ) + vms = VirtualMachine.list( - self.apiclient, - id=virtual_machine_without_ha.id, - listall=True - ) - + self.apiclient, + id=virtual_machine_without_ha.id, + listall=True + ) + self.assertEqual( isinstance(vms, list), True, "List VMs should return valid response for deployed VM" - ) - + ) + self.assertNotEqual( len(vms), 0, "List VMs should return valid response for deployed VM" - ) - + ) + vm_with_ha_disabled = vms[0] - + #Verify the virtual machine got created on non HA host list_hosts_response = list_hosts( - self.apiclient, - id=vm_with_ha_disabled.hostid - ) + self.apiclient, + id=vm_with_ha_disabled.hostid + ) self.assertEqual( isinstance(list_hosts_response, list), True, "Check list response returns a valid list" - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "Check Host is available" - ) - + ) + self.assertEqual( list_hosts_response[0].hahost, False, "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 self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid) cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() cmd.id = vm_with_ha_disabled.hostid self.apiclient.prepareHostForMaintenance(cmd) - + timeout = self.services["timeout"] - + #verify the VM live migration happened to another running host self.debug("Waiting for VM to come up") wait_for_vm( self.apiclient, virtualmachineid=vm_with_ha_disabled.id, interval=timeout - ) - + ) + vms = VirtualMachine.list( - self.apiclient, - id=vm_with_ha_disabled.id, - listall=True - ) - + self.apiclient, + id=vm_with_ha_disabled.id, + listall=True + ) + self.assertEqual( isinstance(vms, list), True, "List VMs should return valid response for deployed VM" - ) - + ) + self.assertNotEqual( len(vms), 0, "List VMs should return valid response for deployed VM" - ) - + ) + list_hosts_response = list_hosts( - self.apiclient, - id=vms[0].hostid - ) + self.apiclient, + id=vms[0].hostid + ) self.assertEqual( isinstance(list_hosts_response, list), True, "Check list response returns a valid list" - ) - + ) + self.assertNotEqual( len(list_hosts_response), 0, "Check Host is available" - ) - + ) + self.assertEqual( list_hosts_response[0].hahost, False, "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) cmd = cancelHostMaintenance.cancelHostMaintenanceCmd() cmd.id = vm_with_ha_disabled.hostid http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16e9eaca/test/integration/component/test_vpc_host_maintenance.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_vpc_host_maintenance.py b/test/integration/component/test_vpc_host_maintenance.py index 1cce276..d28b798 100644 --- a/test/integration/component/test_vpc_host_maintenance.py +++ b/test/integration/component/test_vpc_host_maintenance.py @@ -186,7 +186,6 @@ class Services: } -@unittest.skip("No suitable setup available for testing") class TestVMLifeCycleHostmaintenance(cloudstackTestCase): @classmethod @@ -562,7 +561,6 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase): return -@unittest.skip("No suitable setup available for testing") class TestVPCNetworkRules(cloudstackTestCase): @classmethod