Repository: cloudstack Updated Branches: refs/heads/master 4796cceb3 -> 46c1c1c94
CLOUDSTACK-7391: Passing virtualmachineid while retrieving suitable hosts for migration 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/46c1c1c9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/46c1c1c9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/46c1c1c9 Branch: refs/heads/master Commit: 46c1c1c94969554b3c4c3867fefb64adbff45291 Parents: 4796cce Author: Gaurav Aradhye <gaurav.arad...@clogeny.com> Authored: Thu Sep 11 15:53:11 2014 +0530 Committer: SrikanteswaraRao Talluri <tall...@apache.org> Committed: Mon Sep 15 16:41:40 2014 +0530 ---------------------------------------------------------------------- .../maint/test_host_high_availability.py | 33 ++++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46c1c1c9/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 4cd7fd8..ecc23f7 100644 --- a/test/integration/component/maint/test_host_high_availability.py +++ b/test/integration/component/maint/test_host_high_availability.py @@ -336,14 +336,16 @@ class TestHostHighAvailability(cloudstackTestCase): """ 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. - #3. Select the VM and migrate VM to another host. Choose a 'Suitable' host (i.e. host2) + # 1. Create a Compute service offering with the 'Offer HA' option selected. + # 2. Create a Guest VM with the compute service offering created above. + # 3. Select the VM and migrate VM to another host. Choose a 'Suitable' host (i.e. host2) # 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) + # 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 + # create and verify the virtual machine with HA enabled service + # offering virtual_machine_with_ha = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -374,9 +376,10 @@ class TestHostHighAvailability(cloudstackTestCase): self.debug("Deployed VM on host: %s" % vm.hostid) - #Find out a Suitable host for VM migration + # Find out a Suitable host for VM migration list_hosts_response = list_hosts( self.apiclient, + virtualmachineid = vm.id ) self.assertEqual( isinstance(list_hosts_response, list), @@ -391,21 +394,25 @@ class TestHostHighAvailability(cloudstackTestCase): ) suitableHost = None for host in list_hosts_response: - if host.suitableformigration == True and host.hostid != vm.hostid: + if host.suitableformigration and host.hostid != vm.hostid: suitableHost = host break - self.assertTrue(suitableHost is not None, "suitablehost should not be None") + 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)) + # Migration of the VM to a suitable host + self.debug( + "Migrating VM-ID: %s to Host: %s" % + (vm.id, suitableHost.id)) cmd = migrateVirtualMachine.migrateVirtualMachineCmd() cmd.hostid = suitableHost.id - cmd.virtualmachineid = self.vm.id + cmd.virtualmachineid = vm.id self.apiclient.migrateVirtualMachine(cmd) - #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( self.apiclient, id=vm.id