mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-30 18:23:35 +08:00
fix(host): add guest max mem size options (#24333)
This commit is contained in:
@@ -258,17 +258,23 @@ func (m *SGuestManager) InitQemuMaxCpus(machineCaps []monitor.MachineInfo, kvmMa
|
||||
|
||||
func (m *SGuestManager) InitQemuMaxMems(maxMems uint) {
|
||||
if m.host.IsX8664() {
|
||||
if maxMems > arch.X86_MAX_MEM_MB {
|
||||
if options.HostOptions.GuestMaxMemSizeMb > 0 {
|
||||
arch.X86_MAX_MEM_MB = uint(options.HostOptions.GuestMaxMemSizeMb)
|
||||
} else if maxMems > arch.X86_MAX_MEM_MB {
|
||||
arch.X86_MAX_MEM_MB = maxMems
|
||||
}
|
||||
}
|
||||
if m.host.IsAarch64() {
|
||||
if maxMems > arch.ARM_MAX_MEM_MB {
|
||||
if options.HostOptions.GuestMaxMemSizeMb > 0 {
|
||||
arch.ARM_MAX_MEM_MB = uint(options.HostOptions.GuestMaxMemSizeMb)
|
||||
} else if maxMems > arch.ARM_MAX_MEM_MB {
|
||||
arch.ARM_MAX_MEM_MB = maxMems
|
||||
}
|
||||
}
|
||||
if m.host.IsRiscv64() {
|
||||
if maxMems > arch.RISCV_MAX_MEM_MB {
|
||||
if options.HostOptions.GuestMaxMemSizeMb > 0 {
|
||||
arch.RISCV_MAX_MEM_MB = uint(options.HostOptions.GuestMaxMemSizeMb)
|
||||
} else if maxMems > arch.RISCV_MAX_MEM_MB {
|
||||
arch.RISCV_MAX_MEM_MB = maxMems
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +245,8 @@ type SHostOptions struct {
|
||||
EnableQemuDebugLog bool `help:"enable qemu debug logs" default:"false"`
|
||||
ResetDiskTmpDir string `help:"auto reset disk after guest shutdown will write disk to tmpdir"`
|
||||
|
||||
GuestMaxMemSizeMb int `help:"guest maximal mem size, default 0 is not set" default:"0"`
|
||||
|
||||
// container related endpoint
|
||||
// EnableContainerRuntime bool `help:"enable container runtime" default:"false"`
|
||||
ContainerRuntimeEndpoint string `help:"endpoint of container runtime service" default:"unix:///var/run/onecloud/containerd/containerd.sock"`
|
||||
|
||||
Reference in New Issue
Block a user