server: set VirtualMachineTO arch from template if present (#11530)

* server: set VirtualMachineTO arch from template if present

Fixes #11529

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* refactor

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

---------

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2025-09-24 12:51:40 +05:30 committed by GitHub
parent a18b5514e6
commit 98b9af2904
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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());