R-1192 follow-up: report host swap vs the guests' swap allowance (log once, hub alarm, local API); R-1194: no OOB stanza before the first felhom-sshd pass; unreleased
gates / gates (push) Successful in 1m56s
gates / gates (push) Successful in 1m56s
This commit is contained in:
1 parent
286a7e3ecf
commit
0da792e670
10 files changed
+215
-3
No files matched your search
@@ -57,6 +57,10 @@ type MemoryInfo struct {
|
||||
MaxMB int64 `json:"max_mb"`
|
||||
FloorMB int64 `json:"floor_mb"`
|
||||
Running bool `json:"running"`
|
||||
// HostSwapMB / GuestSwapMB (R-1192 follow-up): the host's swap and this guest's swap allowance, so the controller
|
||||
// can tell the household when the host has too little swap behind the guest (its install page). nil = not read.
|
||||
HostSwapMB *int64 `json:"host_swap_mb,omitempty"`
|
||||
GuestSwapMB *int64 `json:"guest_swap_mb,omitempty"`
|
||||
}
|
||||
|
||||
// memoryResizeRequest is the POST /guest/memory body.
|
||||
@@ -94,6 +98,8 @@ type memoryBounds struct {
|
||||
maxMB int64
|
||||
floorMB int64
|
||||
running bool
|
||||
hostSwapMB int64
|
||||
guestSwapMB int64
|
||||
}
|
||||
|
||||
func (b memoryBounds) refusal(code string) memoryRefusal {
|
||||
@@ -104,7 +110,9 @@ func (b memoryBounds) refusal(code string) memoryRefusal {
|
||||
}
|
||||
|
||||
func (b memoryBounds) info(vmid int) MemoryInfo {
|
||||
hostSwap, guestSwap := b.hostSwapMB, b.guestSwapMB
|
||||
return MemoryInfo{
|
||||
HostSwapMB: &hostSwap, GuestSwapMB: &guestSwap,
|
||||
VMID: vmid, AllocatedMB: b.allocatedMB, UsageMB: b.usageMB, HostTotalMB: b.hostTotalMB,
|
||||
MinMB: b.minMB, MaxMB: b.maxMB, FloorMB: b.floorMB, Running: b.running,
|
||||
}
|
||||
@@ -139,6 +147,8 @@ func (s *Server) readMemoryBounds(ctx context.Context, vmid int) (memoryBounds,
|
||||
hostTotalMB: node.Memory.Total / mib, // bytes → MB, floor (conservative for max)
|
||||
minMB: minGuestMemoryMB,
|
||||
running: st.Status == "running",
|
||||
hostSwapMB: node.Swap.Total / mib, // R-1192 follow-up: the kernel's SwapTotal, as Proxmox reports it
|
||||
guestSwapMB: cfg.Swap, // PVE config swap is MB
|
||||
}
|
||||
b.maxMB = b.hostTotalMB - hostReserveMB
|
||||
b.floorMB = b.usageMB + shrinkUsageMarginMB
|
||||
|
||||
Reference in new issue
Block a user