mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-27 10:31:31 +00:00
Fix random panics during autoballonning. (#17)
There is a race condition, when good behaving VMs will temporarily truncate .memory_used to 0 bytes (update is not atomic). Also, as a matter of principle, VMs should not crash the host, ever. Co-authored-by: msm <msm@cert.pl>
This commit is contained in:
parent
63cd3fc79d
commit
c0801541b3
4
appvm.go
4
appvm.go
|
@ -310,6 +310,10 @@ func autoBalloon(l *libvirt.Libvirt, memoryMin, adjustPercent uint64) {
|
|||
log.Println(err)
|
||||
continue
|
||||
}
|
||||
if len(memoryUsedRaw) == 0 {
|
||||
log.Println("Empty .memory_used file for domain", name)
|
||||
continue
|
||||
}
|
||||
memoryUsedMiB, err := strconv.Atoi(string(memoryUsedRaw[0 : len(memoryUsedRaw)-1]))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
|
|
Loading…
Reference in a new issue