mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-24 14:32:33 +00:00
Merge pull request #9641 from cmaf/runtime-resize-mem-1
runtime: Add missing check in ResizeMemory for CH
This commit is contained in:
commit
ce030d1804
@ -1042,12 +1042,15 @@ func (clh *cloudHypervisor) ResizeMemory(ctx context.Context, reqMemMB uint32, m
|
||||
newMem = alignedRequest
|
||||
}
|
||||
|
||||
// Check if memory is the same as requested, a second Check is done
|
||||
// to consider the memory request now that is updated to be memory aligned
|
||||
// Post-alignment checks
|
||||
if currentMem == newMem {
|
||||
clh.Logger().WithFields(log.Fields{"current-memory": currentMem, "new-memory": newMem}).Debug("VM already has requested memory(after alignment)")
|
||||
return uint32(currentMem.ToMiB()), MemoryDevice{}, nil
|
||||
}
|
||||
// Check for aligned memory exceeding max hotplug size
|
||||
if newMem > (utils.MemUnit(uint32(maxHotplugSize.ToMiB())) * utils.MiB) {
|
||||
newMem = utils.MemUnit(uint32(maxHotplugSize.ToMiB())) * utils.MiB
|
||||
}
|
||||
|
||||
cl := clh.client()
|
||||
ctx, cancelResize := context.WithTimeout(ctx, clh.getClhAPITimeout()*time.Second)
|
||||
|
Loading…
Reference in New Issue
Block a user