davidjumani commented on a change in pull request #4375:
URL: https://github.com/apache/cloudstack/pull/4375#discussion_r506587901



##########
File path: server/src/main/java/com/cloud/server/ManagementServerImpl.java
##########
@@ -1326,10 +1327,9 @@ private HypervisorType getHypervisorType(VMInstanceVO 
vm, StoragePool srcVolumeP
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Searching for all hosts in cluster " + cluster 
+ " for migrating VM " + vm);
             }
-            allHostsPair = searchForServers(startIndex, pageSize, null, 
hostType, null, null, null, cluster, null, keyword, null, null, null, null);
-            // Filter out the current host.
+            allHostsPair = searchForServers(startIndex, pageSize, null, 
hostType, null, null, null, cluster, null, keyword, null, null, null,
+                null, srcHost.getId());
             allHosts = allHostsPair.first();
-            allHosts.remove(srcHost);
             plan = new DataCenterDeployment(srcHost.getDataCenterId(), 
srcHost.getPodId(), srcHost.getClusterId(), null, null, null);
         }
 

Review comment:
       It's needed here since the data type is different `Pair<List<HostVO>, 
Integer>` vs `Pair<List<? extends Host>, Integer>`. Also the allHostsPair 
contains the total count of servers whereas the allHosts lists contains only 
those in the specified page / pagesize




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to