This is an automated email from the ASF dual-hosted git repository.
pearl11594 pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.20 by this push:
new 4b432c82ca0 List only those hosts matching source host arch in
multi-arch zones (#10369)
4b432c82ca0 is described below
commit 4b432c82ca00fa1bd9198de82434d1e6d9fcd321
Author: Pearl Dsilva <[email protected]>
AuthorDate: Wed Feb 19 08:43:41 2025 -0500
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
---
server/src/main/java/com/cloud/server/ManagementServerImpl.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/server/src/main/java/com/cloud/server/ManagementServerImpl.java
b/server/src/main/java/com/cloud/server/ManagementServerImpl.java
index 9ffad8b8418..8575a26a5cb 100644
--- a/server/src/main/java/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/main/java/com/cloud/server/ManagementServerImpl.java
@@ -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);
}