R-1192: every guest may swap as much as its RAM (bring-up, RAM resize, once at start) — the measured 8 GB freeze; unreleased
gates / gates (push) Successful in 1m39s
gates / gates (push) Successful in 1m39s
This commit is contained in:
1 parent
4e1621c650
commit
286a7e3ecf
8 files changed
+206
-1
No files matched your search
@@ -645,6 +645,9 @@ func buildBringUpConfig(spec BringUpSpec, cfg proxmox.GuestConfig) map[string]st
|
||||
}
|
||||
if spec.MemoryMB > 0 {
|
||||
params["memory"] = strconv.Itoa(spec.MemoryMB)
|
||||
// R-1192: swap = RAM. Left unset, Proxmox gives an LXC 512 MB, and a guest that fills its RAM can then evict
|
||||
// only program code — the measured freeze (localapi.GuestSwapMB carries the reasoning and the numbers).
|
||||
params["swap"] = strconv.Itoa(spec.MemoryMB)
|
||||
}
|
||||
for i, m := range spec.Mounts {
|
||||
// backup=1 for data-bearing mounts: extra LXC mountpoints default to backup=0 = EXCLUDED
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package reconcile
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/proxmox"
|
||||
)
|
||||
|
||||
// R-1192: a new guest is created with swap = its RAM (left unset, Proxmox gives an LXC 512 MB — the measured freeze,
|
||||
// felhom.eu audits/fixes-2026-10-21/P4-freeze/). COMPANION RED-PROOF: drop params["swap"] in buildBringUpConfig.
|
||||
func TestR1192_BringUpSetsSwapToTheRAM(t *testing.T) {
|
||||
p := buildBringUpConfig(BringUpSpec{MemoryMB: 4096}, proxmox.GuestConfig{})
|
||||
if p["memory"] != "4096" || p["swap"] != "4096" {
|
||||
t.Fatalf("bring-up params memory=%q swap=%q, want 4096/4096", p["memory"], p["swap"])
|
||||
}
|
||||
if q := buildBringUpConfig(BringUpSpec{}, proxmox.GuestConfig{}); q["swap"] != "" {
|
||||
t.Fatalf("no memory in the spec → no swap written either, got %q", q["swap"])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user