Skip to content

Commit 0ba42ce

Browse files
committed
List only those hosts matching source host arch in multi-arch zones
1 parent 5aa79a6 commit 0ba42ce

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import javax.inject.Inject;
4545
import javax.naming.ConfigurationException;
4646

47+
import com.cloud.cpu.CPU;
48+
import com.cloud.utils.security.CertificateHelper;
4749
import org.apache.cloudstack.acl.ControlledEntity;
4850
import org.apache.cloudstack.acl.SecurityChecker;
4951
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
@@ -1612,6 +1614,13 @@ public Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Ho
16121614
logger.debug("Hosts having capacity and suitable for migration: {}", suitableHosts);
16131615
}
16141616

1617+
// Only list hosts of the same architecture as the source Host in a multi-arch zone
1618+
List<CPU.CPUArch> clusterArchs = ApiDBUtils.listZoneClustersArchs(vm.getDataCenterId());
1619+
if (CollectionUtils.isNotEmpty(clusterArchs) && clusterArchs.size() > 1) {
1620+
CPU.CPUArch hostArch = srcHost.getArch();
1621+
suitableHosts = suitableHosts.stream().filter(h -> h.getArch() == hostArch).collect(Collectors.toList());
1622+
}
1623+
16151624
return new Ternary<>(otherHosts, suitableHosts, requiresStorageMotion);
16161625
}
16171626

0 commit comments

Comments
 (0)