mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
Merge pull request #417 from nitkon/maxmem
virtcontainers: Set ppc64le maxmem depending on qemu version
This commit is contained in:
@@ -68,6 +68,9 @@ const qmpSocket = "qmp.sock"
|
||||
|
||||
const defaultConsole = "console.sock"
|
||||
|
||||
var qemuMajorVersion int
|
||||
var qemuMinorVersion int
|
||||
|
||||
// agnostic list of kernel parameters
|
||||
var defaultKernelParameters = []Param{
|
||||
{"panic", "1"},
|
||||
@@ -472,6 +475,8 @@ func (q *qemu) waitSandbox(timeout int) error {
|
||||
}
|
||||
|
||||
q.qmpMonitorCh.qmp = qmp
|
||||
qemuMajorVersion = ver.Major
|
||||
qemuMinorVersion = ver.Minor
|
||||
|
||||
q.Logger().WithFields(logrus.Fields{
|
||||
"qmp-major-version": ver.Major,
|
||||
|
@@ -12,6 +12,7 @@ import (
|
||||
govmmQemu "github.com/intel/govmm/qemu"
|
||||
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
|
||||
"github.com/kata-containers/runtime/virtcontainers/utils"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type qemuPPC64le struct {
|
||||
@@ -54,6 +55,11 @@ var supportedQemuMachines = []govmmQemu.Machine{
|
||||
},
|
||||
}
|
||||
|
||||
// Logger returns a logrus logger appropriate for logging qemu messages
|
||||
func (q *qemuPPC64le) Logger() *logrus.Entry {
|
||||
return virtLog.WithField("subsystem", "qemu")
|
||||
}
|
||||
|
||||
// MaxQemuVCPUs returns the maximum number of vCPUs supported
|
||||
func MaxQemuVCPUs() uint32 {
|
||||
return uint32(128)
|
||||
@@ -105,12 +111,14 @@ func (q *qemuPPC64le) cpuModel() string {
|
||||
|
||||
func (q *qemuPPC64le) memoryTopology(memoryMb, hostMemoryMb uint64) govmmQemu.Memory {
|
||||
|
||||
if hostMemoryMb > defaultMemMaxPPC64le {
|
||||
hostMemoryMb = defaultMemMaxPPC64le
|
||||
} else {
|
||||
// align hostMemoryMb to 256MB multiples
|
||||
if qemuMajorVersion >= 2 && qemuMinorVersion >= 10 {
|
||||
q.Logger().Debug("Aligning maxmem to multiples of 256MB. Assumption: Kernel Version >= 4.11")
|
||||
hostMemoryMb -= (hostMemoryMb % 256)
|
||||
} else {
|
||||
q.Logger().Debug("Restricting maxmem to 32GB as Qemu Version < 2.10, Assumption: Kernel Version >= 4.11")
|
||||
hostMemoryMb = defaultMemMaxPPC64le
|
||||
}
|
||||
|
||||
return genericMemoryTopology(memoryMb, hostMemoryMb)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user