DaanHoogland commented on code in PR #9619:
URL: https://github.com/apache/cloudstack/pull/9619#discussion_r1740534538
##########
api/src/main/java/org/apache/cloudstack/api/response/ClusterResponse.java:
##########
@@ -247,4 +251,12 @@ public void setOvm3vip(String ovm3vip) {
public void setCapacities(List<CapacityResponse> capacities) {
this.capacities = capacities;
}
+
+ public String getArchitecture() {
+ return architecture;
+ }
+
Review Comment:
is this one needed?
##########
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java:
##########
@@ -1213,6 +1215,11 @@ public Cluster updateCluster(UpdateClusterCmd cmd) {
}
}
+ if (architecture != null) {
Review Comment:
meaning it can never be unset?
##########
api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java:
##########
@@ -787,6 +791,14 @@ public void setIsTagARule(Boolean tagARule) {
isTagARule = tagARule;
}
+ public String getArchitecture() {
+ return architecture;
+ }
+
Review Comment:
is this one needed?
##########
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java:
##########
@@ -2746,6 +2753,13 @@ public HostVO fillRoutingHostVO(final HostVO host, final
StartupRoutingCommand s
throw new IllegalArgumentException("Can't add host whose
hypervisor type is: " + hyType + " into cluster: " + clusterVO.getId() +
" whose hypervisor type is: " +
clusterVO.getHypervisorType());
}
+ CPU.CPUArchitecture hostCpuArchitecture =
CPU.CPUArchitecture.fromType(ssCmd.getCpuArchitecture());
+ if (hostCpuArchitecture != null && clusterVO.getArch() != null &&
hostCpuArchitecture != clusterVO.getArch()) {
+ String msg = String.format("Can't add a host whose architecture
is: %s into cluster of architecture type: %s",
+ hostCpuArchitecture.getType(),
clusterVO.getArch().getType());
+ logger.error(msg);
+ throw new IllegalArgumentException(msg);
+ }
Review Comment:
this bit makes the isMultiArch flag necessary. I think we shouldn't
implement that and allow dynamic use of architectures (responsibility of the
operator) cc @rajujith @andrijapanicsb @NuxRo
##########
api/src/main/java/com/cloud/cpu/CPU.java:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.cpu;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+import org.apache.commons.lang3.StringUtils;
+
+public class CPU {
+
+ public static final String archX86Identifier = "i686";
+ public static final String archX86_64Identifier = "x86_64";
+ public static final String archARM64Identifier = "arm64";
+
+ public enum CPUArchitecture {
Review Comment:
why is this enum embedded in a class and not top levwel in the package?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]