mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-26 22:23:01 +00:00
Do not exit on autoballoon errors, keep adjust memory for other VMs
This commit is contained in:
parent
806448df17
commit
dad147eb91
12
appvm.go
12
appvm.go
@ -318,17 +318,20 @@ func autoBalloon(l *libvirt.Libvirt, memoryMin, adjustPercent uint64) {
|
|||||||
|
|
||||||
memoryUsedRaw, err := ioutil.ReadFile(os.Getenv("HOME") + "/appvm/" + name + "/.memory_used")
|
memoryUsedRaw, err := ioutil.ReadFile(os.Getenv("HOME") + "/appvm/" + name + "/.memory_used")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Println(err)
|
||||||
|
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.Fatal(err)
|
log.Println(err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
memoryUsed := memoryUsedMiB * 1024
|
memoryUsed := memoryUsedMiB * 1024
|
||||||
|
|
||||||
_, memoryMax, memoryCurrent, _, _, err := l.DomainGetInfo(d)
|
_, memoryMax, memoryCurrent, _, _, err := l.DomainGetInfo(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Println(err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
memoryNew := uint64(float64(memoryUsed) * (1 + float64(adjustPercent)/100))
|
memoryNew := uint64(float64(memoryUsed) * (1 + float64(adjustPercent)/100))
|
||||||
@ -343,7 +346,8 @@ func autoBalloon(l *libvirt.Libvirt, memoryMin, adjustPercent uint64) {
|
|||||||
|
|
||||||
err = l.DomainSetMemory(d, memoryNew)
|
err = l.DomainSetMemory(d, memoryNew)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Println(err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
table.Append([]string{name,
|
table.Append([]string{name,
|
||||||
|
Loading…
Reference in New Issue
Block a user