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)
|
log.Println(err)
|
||||||
continue
|
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]))
|
memoryUsedMiB, err := strconv.Atoi(string(memoryUsedRaw[0 : len(memoryUsedRaw)-1]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user