Skip to content

Commit 98b9af2

Browse files
authored
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]>
1 parent a18b551 commit 98b9af2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import javax.inject.Inject;
2525

26+
import com.cloud.cpu.CPU;
2627
import com.cloud.dc.DataCenter;
2728
import com.cloud.dc.dao.DataCenterDao;
2829
import com.cloud.domain.Domain;
@@ -307,10 +308,15 @@ protected VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile vmProfile) {
307308
to.setNics(nics);
308309
to.setDisks(vmProfile.getDisks().toArray(new DiskTO[vmProfile.getDisks().size()]));
309310

310-
if (vmProfile.getTemplate().getBits() == 32) {
311-
to.setArch("i686");
311+
CPU.CPUArch templateArch = vmProfile.getTemplate().getArch();
312+
if (templateArch != null) {
313+
to.setArch(templateArch.getType());
312314
} else {
313-
to.setArch("x86_64");
315+
if (vmProfile.getTemplate().getBits() == 32) {
316+
to.setArch(CPU.CPUArch.x86.getType());
317+
} else {
318+
to.setArch(CPU.CPUArch.amd64.getType());
319+
}
314320
}
315321

316322
Map<String, String> detailsInVm = _userVmDetailsDao.listDetailsKeyPairs(vm.getId());

0 commit comments

Comments
 (0)