[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-3904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13722753#comment-13722753
 ] 

Min Chen commented on CLOUDSTACK-3904:
--------------------------------------

After investigation, this is not a list api issue. It seems like a regression 
introduced by this storage motion commit 
21ce3befc8ea9e1a6de449a21499a50ff141a183.  On VMware 5.0, Storage motion is 
supported in our DB, so based on this piece of code:

        if (canMigrateWithStorage) {
            allHostsPair = searchForServers(startIndex, pageSize, null, 
hostType, null, srcHost.getDataCenterId(), null,
                    null, null, null, null, null, srcHost.getHypervisorType(), 
srcHost.getHypervisorVersion());
            allHosts = allHostsPair.first();
            allHosts.remove(srcHost);

            // Check if the host has storage pools for all the volumes of the 
vm to be migrated.
            for (Iterator<HostVO> iterator = allHosts.iterator(); 
iterator.hasNext();) {
                Host host = iterator.next();
                Map<Volume, List<StoragePool>> volumePools = 
findSuitablePoolsForVolumes(vmProfile, host);
                if (volumePools.isEmpty()) {
                    iterator.remove();
                } else {
                    if (!host.getClusterId().equals(srcHost.getClusterId()) || 
usesLocal) {
                        requiresStorageMotion.put(host, true);
                    }
                }
            }

            plan = new DataCenterDeployment(srcHost.getDataCenterId(), null, 
null, null, null, null);

We will create a Deployment plan with null podId and null clusterId, which 
caused this NPE exception in listHostsCmd in invoking 
FirstFitAllocator.reorderHostsByNumberOfVms.
                
> listHosts API fails in VMware setup when virtualmachineid parameter is passed
> -----------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-3904
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-3904
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Automation, VMware
>    Affects Versions: 4.2.0
>         Environment: VMware setup
>            Reporter: Gaurav Aradhye
>            Assignee: Alena Prokharchyk
>            Priority: Critical
>
> listHosts API failing in VMware setup (observed through test cases and also 
> manually hitting the API through URL) when virtualmachineid parameter is 
> passed.
> ErrorText: SELECT pod.id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 
> 0)) FROM `cloud`.`host_pod_ref` pod LEFT JOIN `cloud`.`vm_instance` vm ON 
> pod.id = vm.pod_id WHERE pod.data_center_id = ?  GROUP BY pod.id ORDER BY 2 
> ASC
> Steps to reproduce:
> Hit listHosts URL throgh url. Suppose setup is hosted at ip x and port y.
> Create an instance. suppose virtualmachineid of instance is z.
> Hit URL:
> http://x:y/client/api?command=listHosts&&virtualmachineid=z

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to