This is an automated email from the ASF dual-hosted git repository.
weizhou 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 98b9af29040 server: set VirtualMachineTO arch from template if present
(#11530)
98b9af29040 is described below
commit 98b9af29040533089a7f8153c74f95f9c324d66b
Author: Abhishek Kumar <[email protected]>
AuthorDate: Wed Sep 24 12:51:40 2025 +0530
server: set VirtualMachineTO arch from template if present (#11530)
* server: set VirtualMachineTO arch from template if present
Fixes #11529
Signed-off-by: Abhishek Kumar <[email protected]>
* refactor
Signed-off-by: Abhishek Kumar <[email protected]>
---------
Signed-off-by: Abhishek Kumar <[email protected]>
---
.../main/java/com/cloud/hypervisor/HypervisorGuruBase.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
b/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
index c510502f5f9..4f14fe20dac 100644
--- a/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -23,6 +23,7 @@ import java.util.UUID;
import javax.inject.Inject;
+import com.cloud.cpu.CPU;
import com.cloud.dc.DataCenter;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.domain.Domain;
@@ -307,10 +308,15 @@ public abstract class HypervisorGuruBase extends
AdapterBase implements Hypervis
to.setNics(nics);
to.setDisks(vmProfile.getDisks().toArray(new
DiskTO[vmProfile.getDisks().size()]));
- if (vmProfile.getTemplate().getBits() == 32) {
- to.setArch("i686");
+ CPU.CPUArch templateArch = vmProfile.getTemplate().getArch();
+ if (templateArch != null) {
+ to.setArch(templateArch.getType());
} else {
- to.setArch("x86_64");
+ if (vmProfile.getTemplate().getBits() == 32) {
+ to.setArch(CPU.CPUArch.x86.getType());
+ } else {
+ to.setArch(CPU.CPUArch.amd64.getType());
+ }
}
Map<String, String> detailsInVm =
_userVmDetailsDao.listDetailsKeyPairs(vm.getId());