mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
List only those hosts matching source host arch in multi-arch zones (#10369)
* List only those hosts matching source host arch in multi-arch zones * remove duplicate import due to merge conflict * filter only if suitable hosts aren't empty * get cpu archs only if there are suitable hosts
This commit is contained in:
parent
ee32f4cfe8
commit
4b432c82ca
@ -44,6 +44,7 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.cpu.CPU;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
|
||||
@ -1612,6 +1613,14 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
logger.debug("Hosts having capacity and suitable for migration: {}", suitableHosts);
|
||||
}
|
||||
|
||||
// Only list hosts of the same architecture as the source Host in a multi-arch zone
|
||||
if (!suitableHosts.isEmpty()) {
|
||||
List<CPU.CPUArch> clusterArchs = ApiDBUtils.listZoneClustersArchs(vm.getDataCenterId());
|
||||
if (CollectionUtils.isNotEmpty(clusterArchs) && clusterArchs.size() > 1) {
|
||||
suitableHosts = suitableHosts.stream().filter(h -> h.getArch() == srcHost.getArch()).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
return new Ternary<>(otherHosts, suitableHosts, requiresStorageMotion);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user