mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-24 02:07:31 +00:00
Merge pull request #11822 from BbolroC/runtime-no-hotplug-ibm-sel-s390x
runtime: Set maxmem to initialmem on s390x when memory hotplug is disabled
This commit is contained in:
@@ -424,3 +424,21 @@ func (q *qemuS390x) qomGetPciPath(qemuID string, qmpCh *qmpChannel) (types.PciPa
|
||||
hvLogger.Warnf("qomGetPciPath not implemented for s390x")
|
||||
return types.PciPath{}, nil
|
||||
}
|
||||
|
||||
func (q *qemuS390x) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory {
|
||||
// For no hotplug memory, set hostMemoryMb to memoryMb, otherwise will cause
|
||||
// `invalid value of maxmem: maximum memory size (0x0) must be at least the initial memory size`
|
||||
if hostMemoryMb == 0 {
|
||||
hostMemoryMb = memoryMb
|
||||
}
|
||||
|
||||
memMax := fmt.Sprintf("%dM", hostMemoryMb)
|
||||
mem := fmt.Sprintf("%dM", memoryMb)
|
||||
memory := govmmQemu.Memory{
|
||||
Size: mem,
|
||||
Slots: slots,
|
||||
MaxMem: memMax,
|
||||
}
|
||||
|
||||
return memory
|
||||
}
|
||||
|
@@ -56,6 +56,12 @@ func TestQemuS390xMemoryTopology(t *testing.T) {
|
||||
|
||||
m := s390x.memoryTopology(mem, hostMem, slots)
|
||||
assert.Equal(expectedMemory, m)
|
||||
|
||||
// test when hostMem is set to 0 (no hotplug memory)
|
||||
hostMem = 0
|
||||
expectedMemory.MaxMem = fmt.Sprintf("%dM", mem)
|
||||
m = s390x.memoryTopology(mem, hostMem, slots)
|
||||
assert.Equal(expectedMemory, m)
|
||||
}
|
||||
|
||||
func TestQemuS390xAppendVhostUserDevice(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user