mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(host): set max cpus for virt machine type (#15339)
This commit is contained in:
@@ -141,6 +141,8 @@ func (m *SGuestManager) InitQemuMaxCpus(machineCaps []monitor.MachineInfo, kvmMa
|
||||
// You can add an IOMMU using: -device intel-iommu,intremap=on,eim=on
|
||||
// Set x86 machine max cpu 240 for now.
|
||||
m.qemuMachineCpuMax[machine] = minFunc(cpuMax, m.qemuMachineCpuMax[machine])
|
||||
} else {
|
||||
m.qemuMachineCpuMax[machine] = cpuMax
|
||||
}
|
||||
log.Infof("Machine type %s max cpus: %d", machine, m.qemuMachineCpuMax[machine])
|
||||
}
|
||||
|
||||
@@ -2163,7 +2163,9 @@ func (s *SKVMGuestInstance) OnResumeSyncMetadataInfo() {
|
||||
} else {
|
||||
meta.Set("__cpu_mode", jsonutils.NewString(api.CPU_MODE_HOST))
|
||||
}
|
||||
meta.Set("__pcie_extend_bus", jsonutils.JSONTrue)
|
||||
if s.hasPcieExtendBus() {
|
||||
meta.Set("__pcie_extend_bus", jsonutils.JSONTrue)
|
||||
}
|
||||
cmdline, err := s.getQemuCmdline()
|
||||
if err != nil {
|
||||
log.Errorf("Get qemu process cmdline error: %v", err)
|
||||
|
||||
@@ -744,11 +744,12 @@ func (s *SKVMGuestInstance) gpusHasVga() bool {
|
||||
}
|
||||
|
||||
func (s *SKVMGuestInstance) initCpuDesc() error {
|
||||
cpudesc, err := s.archMan.GenerateCpuDesc(uint(s.Desc.Cpu), s)
|
||||
s.fixGuestMachineType()
|
||||
cpuDesc, err := s.archMan.GenerateCpuDesc(uint(s.Desc.Cpu), s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.Desc.CpuDesc = cpudesc
|
||||
s.Desc.CpuDesc = cpuDesc
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -809,7 +810,7 @@ func (s *SKVMGuestInstance) initMemDescFromMemoryInfo(memoryDevicesInfoList []mo
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SKVMGuestInstance) initMachineDesc() {
|
||||
func (s *SKVMGuestInstance) fixGuestMachineType() {
|
||||
if s.GetOsName() == OS_NAME_MACOS {
|
||||
s.Desc.Machine = api.VM_MACHINE_TYPE_Q35
|
||||
s.Desc.Bios = qemu.BIOS_UEFI
|
||||
@@ -822,6 +823,9 @@ func (s *SKVMGuestInstance) initMachineDesc() {
|
||||
}
|
||||
s.Desc.Bios = qemu.BIOS_UEFI
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SKVMGuestInstance) initMachineDesc() {
|
||||
s.Desc.MachineDesc = s.archMan.GenerateMachineDesc(s.Desc.CpuDesc.Accel)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user