mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 07:19:06 +00:00
Merge pull request #1361 from darfux/fix-mem-id
vc:qemu: Fix id calculation of memory hotplug
This commit is contained in:
commit
71fc406381
@ -1220,7 +1220,13 @@ func (q *qemu) hotplugAddMemory(memDev *memoryDevice) (int, error) {
|
||||
}
|
||||
|
||||
if len(memoryDevices) != 0 {
|
||||
memDev.slot = memoryDevices[len(memoryDevices)-1].Data.Slot + 1
|
||||
maxSlot := -1
|
||||
for _, device := range memoryDevices {
|
||||
if maxSlot < device.Data.Slot {
|
||||
maxSlot = device.Data.Slot
|
||||
}
|
||||
}
|
||||
memDev.slot = maxSlot + 1
|
||||
}
|
||||
err = q.qmpMonitorCh.qmp.ExecHotplugMemory(q.qmpMonitorCh.ctx, "memory-backend-ram", "mem"+strconv.Itoa(memDev.slot), "", memDev.sizeMB)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user