Chandan Purushothama created CLOUDSTACK-7391: ------------------------------------------------
Summary: [Automation] Fix the script "test_host_high_availability.py" - Error Message: "suitablehost should not be None" Key: CLOUDSTACK-7391 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7391 Project: CloudStack Issue Type: Test Security Level: Public (Anyone can view this level - this is the default.) Components: Automation, Test Affects Versions: 4.5.0 Reporter: Chandan Purushothama Fix For: 4.5.0 ========== Client Code: ========== 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) """ . . . 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, *BUG: Query the list of hosts with vm id. Only then the response will have list of suitable and non-suitable hosts. Else "suitableforMigration" is not returned in the response* ) 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") *Error Message: "suitablehost should not be None"* {code} Cmd : listHosts======= requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): 10.220.135.39 requests.packages.urllib3.connectionpool: DEBUG: "GET /client/api?apiKey=NpffyWZkfwK7gPcNpx28Ohv6K56ftl57A409SyokqHjJ2ZNe3AvvF3F0teTETeIIqrtlcWpQOooM3cQyPveGXw&command=listHosts&response=json&signature=gh2gh3mSzQNAcfMdspqc9v1JE3U%3D HTTP/1.1" 200 3708 test_03_cant_migrate_vm_to_host_with_ha_positive (integration.component.maint.test_host_high_availability.TestHostHighAvailability): DEBUG: Response : [{name : u's-2-VM', created : u'2014-08-20T04:31:37+0000', ipaddress : u'10.220.136.107', islocalstorageactive : False, podid : u'027c1e45-5867-40f8-8ad9-685b5eb63dd2', resourcestate : u'Enabled', zoneid : u'f2acfe0c-c8c8-4353-8f97-a3e0f14d6357', state : u'Up', version : u'4.5.0-SNAPSHOT', managementserverid : 231707544610094, podname : u'XenRT-Zone-0-Pod-0', id : u'bb004159-d510-42b4-bfd5-878140a11f78', lastpinged : u'1970-01-16T22:04:57+0000', type : u'SecondaryStorageVM', events : u'AgentDisconnected; PingTimeout; Remove; ShutdownRequested; AgentConnected; HostDown; ManagementServerDown; Ping; StartAgentRebalance', zonename : u'XenRT-Zone-0'}, {name : u'v-1-VM', created : u'2014-08-20T04:31:37+0000', ipaddress : u'10.220.136.105', islocalstorageactive : False, podid : u'027c1e45-5867-40f8-8ad9-685b5eb63dd2', resourcestate : u'Enabled', zoneid : u'f2acfe0c-c8c8-4353-8f97-a3e0f14d6357', state : u'Up', version : u'4.5.0-SNAPSHOT', managementserverid : 231707544610094, podname : u'XenRT-Zone-0-Pod-0', id : u'f328a0d1-f4cb-4486-9550-dd46c403c3ed', lastpinged : u'1970-01-16T22:04:57+0000', type : u'ConsoleProxy', events : u'AgentDisconnected; PingTimeout; Remove; ShutdownRequested; AgentConnected; HostDown; ManagementServerDown; Ping; StartAgentRebalance', zonename : u'XenRT-Zone-0'}, {cpuwithoverprovisioning : u'28800.0', version : u'4.5.0-SNAPSHOT', memorytotal : 31073792896, zoneid : u'f2acfe0c-c8c8-4353-8f97-a3e0f14d6357', cpunumber : 12, managementserverid : 231707544610094, cpuallocated : u'2.08%', memoryused : 4211653, id : u'1f5f180e-3eb1-4a6a-92f8-8df71df57962', cpuused : u'0.03%', hypervisorversion : u'6.2.0', clusterid : u'af55ad36-15c8-424b-916b-db1550aae5ff', capabilities : u'xen-3.0-x86_64 , xen-3.0-x86_32p , hvm-3.0-x86_32 , hvm-3.0-x86_32p , hvm-3.0-x86_64', state : u'Up', memoryallocated : 268435456, networkkbswrite : 5383, cpuspeed : 2400, cpusockets : 2, type : u'Routing', events : u'AgentDisconnected; PingTimeout; Remove; ShutdownRequested; AgentConnected; HostDown; ManagementServerDown; Ping; StartAgentRebalance', zonename : u'XenRT-Zone-0', podid : u'027c1e45-5867-40f8-8ad9-685b5eb63dd2', clustertype : u'CloudManaged', hahost : False, lastpinged : u'1970-01-16T22:04:56+0000', ipaddress : u'10.220.131.132', disconnected : u'2014-08-20T04:27:31+0000', name : u'cl08-15', networkkbsread : 2563, created : u'2014-08-20T04:25:28+0000', clustername : u'XenRT-Zone-0-Pod-0-Cluster-0', hypervisor : u'XenServer', islocalstorageactive : False, resourcestate : u'Enabled', hosttags : u'host2', podname : u'XenRT-Zone-0-Pod-0'}, {cpuwithoverprovisioning : u'28800.0', version : u'4.5.0-SNAPSHOT', memorytotal : 31073784960, zoneid : u'f2acfe0c-c8c8-4353-8f97-a3e0f14d6357', cpunumber : 12, managementserverid : 231707544610094, cpuallocated : u'19.79%', memoryused : 4332244, id : u'9746bc8b-efb7-46e1-93ac-70fb571776f4', cpuused : u'0.03%', hypervisorversion : u'6.2.0', clusterid : u'af55ad36-15c8-424b-916b-db1550aae5ff', capabilities : u'xen-3.0-x86_64 , xen-3.0-x86_32p , hvm-3.0-x86_32 , hvm-3.0-x86_32p , hvm-3.0-x86_64', state : u'Up', memoryallocated : 3221225472, networkkbswrite : 5562, cpuspeed : 2400, cpusockets : 2, type : u'Routing', events : u'AgentDisconnected; PingTimeout; Remove; ShutdownRequested; AgentConnected; HostDown; ManagementServerDown; Ping; StartAgentRebalance', zonename : u'XenRT-Zone-0', podid : u'027c1e45-5867-40f8-8ad9-685b5eb63dd2', clustertype : u'CloudManaged', hahost : False, lastpinged : u'1970-01-16T22:04:56+0000', ipaddress : u'10.220.131.133', disconnected : u'2014-08-20T04:27:31+0000', name : u'cl08-16', networkkbsread : 8995, created : u'2014-08-20T04:25:11+0000', clustername : u'XenRT-Zone-0-Pod-0-Cluster-0', hypervisor : u'XenServer', islocalstorageactive : False, resourcestate : u'Enabled', podname : u'XenRT-Zone-0-Pod-0'}] test_03_cant_migrate_vm_to_host_with_ha_positive (integration.component.maint.test_host_high_availability.TestHostHighAvailability): CRITICAL: FAILED: test_03_cant_migrate_vm_to_host_with_ha_positive: ['Traceback (most recent call last):\n', ' File "/usr/lib/python2.7/unittest/case.py", line 332, in run\n testMethod()\n', ' File "/root/cloudstack/test/integration/component/maint/test_host_high_availability.py", line 398, in test_03_cant_migrate_vm_to_host_with_ha_positive\n self.assertTrue(suitableHost is not None, "suitablehost should not be None")\n', ' File "/usr/lib/python2.7/unittest/case.py", line 425, in assertTrue\n raise self.failureException(msg)\n', 'AssertionError: suitablehost should not be None\n'] --------------------- >> end captured logging << --------------------- Stacktrace File "/usr/lib/python2.7/unittest/case.py", line 332, in run testMethod() File "/root/cloudstack/test/integration/component/maint/test_host_high_availability.py", line 398, in test_03_cant_migrate_vm_to_host_with_ha_positive self.assertTrue(suitableHost is not None, "suitablehost should not be None") File "/usr/lib/python2.7/unittest/case.py", line 425, in assertTrue raise self.failureException(msg) 'suitablehost should not be None\n-------------------- >> begin captured stdout << ---------------------\n=== TestName: test_03_cant_migrate_vm_to_host_with_ha_positive | Status : FAILED ===\n\n\n--------------------- >> end captured stdout << ----------------------\n-------------------- >> begin captured logging << --------------------\ntest_03_cant_migrate_vm_to_host_with_ha_positive (integration.component.maint.test_host_high_availability.TestHostHighAvailability): DEBUG: ::::::::::::STARTED : TC: test_03_cant_migrate_vm_to_host_with_ha_positive {code} -- This message was sent by Atlassian JIRA (v6.2#6252)