Skip to content

Commit a1918ee

Browse files
committed
Add srcHost back to method parameters
1 parent 8a48f3d commit a1918ee

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

server/src/main/java/com/cloud/server/ManagementServerImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,14 +1637,16 @@ public ExcludeList applyAffinityConstraints(VirtualMachine vm, VirtualMachinePro
16371637
* @param plan The deployment plan
16381638
* @param compatibleHosts List of technically compatible hosts
16391639
* @param excludes ExcludeList with hosts to avoid
1640+
* @param srcHost Source host (for architecture filtering)
16401641
* @return List of suitable hosts with capacity
16411642
*/
16421643
protected List<Host> getCapableSuitableHosts(
16431644
final VirtualMachine vm,
16441645
final VirtualMachineProfile vmProfile,
16451646
final DataCenterDeployment plan,
16461647
final List<? extends Host> compatibleHosts,
1647-
final ExcludeList excludes) {
1648+
final ExcludeList excludes,
1649+
final Host srcHost) {
16481650

16491651
List<Host> suitableHosts = new ArrayList<>();
16501652

@@ -1670,7 +1672,6 @@ protected List<Host> getCapableSuitableHosts(
16701672

16711673
// Only list hosts of the same architecture as the source Host in a multi-arch zone
16721674
if (!suitableHosts.isEmpty()) {
1673-
Host srcHost = _hostDao.findById(vm.getHostId());
16741675
List<CPU.CPUArch> clusterArchs = ApiDBUtils.listZoneClustersArchs(vm.getDataCenterId());
16751676
if (CollectionUtils.isNotEmpty(clusterArchs) && clusterArchs.size() > 1) {
16761677
suitableHosts = suitableHosts.stream().filter(h -> h.getArch() == srcHost.getArch()).collect(Collectors.toList());
@@ -1719,7 +1720,7 @@ public Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Ho
17191720
final ExcludeList excludes = applyAffinityConstraints(vm, vmProfile, plan, vmList);
17201721

17211722
// Get hosts with capacity
1722-
List<Host> suitableHosts = getCapableSuitableHosts(vm, vmProfile, plan, filteredHosts, excludes);
1723+
List<Host> suitableHosts = getCapableSuitableHosts(vm, vmProfile, plan, filteredHosts, excludes, srcHost);
17231724

17241725
final Pair<List<? extends Host>, Integer> otherHosts = new Pair<>(allHostsPair.first(), allHostsPair.second());
17251726
return new Ternary<>(otherHosts, suitableHosts, requiresStorageMotion);

0 commit comments

Comments
 (0)