@@ -1644,7 +1644,8 @@ protected List<Host> getCapableSuitableHosts(
16441644 final VirtualMachineProfile vmProfile ,
16451645 final DataCenterDeployment plan ,
16461646 final List <? extends Host > compatibleHosts ,
1647- final ExcludeList excludes ) {
1647+ final ExcludeList excludes ,
1648+ final Host srcHost ) {
16481649
16491650 List <Host > suitableHosts = new ArrayList <>();
16501651
@@ -1670,7 +1671,6 @@ protected List<Host> getCapableSuitableHosts(
16701671
16711672 // Only list hosts of the same architecture as the source Host in a multi-arch zone
16721673 if (!suitableHosts .isEmpty ()) {
1673- Host srcHost = _hostDao .findById (vm .getHostId ());
16741674 List <CPU .CPUArch > clusterArchs = ApiDBUtils .listZoneClustersArchs (vm .getDataCenterId ());
16751675 if (CollectionUtils .isNotEmpty (clusterArchs ) && clusterArchs .size () > 1 ) {
16761676 suitableHosts = suitableHosts .stream ().filter (h -> h .getArch () == srcHost .getArch ()).collect (Collectors .toList ());
@@ -1719,7 +1719,7 @@ public Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Ho
17191719 final ExcludeList excludes = applyAffinityConstraints (vm , vmProfile , plan , vmList );
17201720
17211721 // Get hosts with capacity
1722- List <Host > suitableHosts = getCapableSuitableHosts (vm , vmProfile , plan , filteredHosts , excludes );
1722+ List <Host > suitableHosts = getCapableSuitableHosts (vm , vmProfile , plan , filteredHosts , excludes , srcHost );
17231723
17241724 final Pair <List <? extends Host >, Integer > otherHosts = new Pair <>(allHostsPair .first (), allHostsPair .second ());
17251725 return new Ternary <>(otherHosts , suitableHosts , requiresStorageMotion );
0 commit comments