vishesh92 commented on code in PR #13452:
URL: https://github.com/apache/cloudstack/pull/13452#discussion_r3441287204


##########
server/src/main/java/com/cloud/server/ManagementServerImpl.java:
##########
@@ -1707,22 +1717,31 @@ public Ternary<Pair<List<? extends Host>, Integer>, 
List<? extends Host>, Map<Ho
         }
 
         // Create deployment plan and VM profile
-        final Host srcHost = _hostDao.findById(vm.getHostId());
-        final DataCenterDeployment plan = new DataCenterDeployment(
-            srcHost.getDataCenterId(), srcHost.getPodId(), 
srcHost.getClusterId(), null, null, null);
+        final DataCenterDeployment plan = 
createDeploymentPlanForMigrationListing(vm);
         final VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(
             vm, null, _offeringDao.findById(vm.getId(), 
vm.getServiceOfferingId()), null, null);
 
         // Apply affinity constraints
         final ExcludeList excludes = applyAffinityConstraints(vm, vmProfile, 
plan, vmList);
 
         // Get hosts with capacity
-        List<Host> suitableHosts = getCapableSuitableHosts(vm, vmProfile, 
plan, filteredHosts, excludes, srcHost);
+        List<Host> suitableHosts = getCapableSuitableHosts(vm, vmProfile, 
plan, filteredHosts, excludes);

Review Comment:
   Why remove srcHost from here? IMO, it would be better to pass the source 
host and use that instead of fetching from the db every time.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to