fix(lcow/v2): report physically backed VM stats#2834
Conversation
| // the controller migrating so only migration APIs are permitted. | ||
| c.vmID = state.GetVmID() | ||
| c.sandboxOptions = sandboxOptionsFromProto(state.GetSandboxOptions()) | ||
| if c.sandboxOptions != nil { |
There was a problem hiding this comment.
Do we not need sandboxOptions.FullyPhysicallyBacked option?
There was a problem hiding this comment.
Yes, we still need and retain sandboxOptions.FullyPhysicallyBacked. This change only stops using it as the stats predicate. Effective memory backing is !Memory.AllowOvercommit, while FullyPhysicallyBacked additionally controls device backing (for example, disabling VPMEM in favor of SCSI) and is still round-tripped in the migration payload. A caller can set AllowOvercommit=false without setting FullyPhysicallyBacked; that was the failing case. This mirrors V1's separate physicallyBacked and devicesPhysicallyBacked fields.
There was a problem hiding this comment.
The key is whether the option remains required for device/VPMEM behavior even though it is no longer the right stats predicate.
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
b1474f8 to
1fc6a13
Compare
Summary
Memory.AllowOvercommitsetting on cold boot and migration importProblem
LCOW V2 physically backed sandbox stats had two failure modes:
isPhysicallyBackedfrom the strongerFullyPhysicallyBackeddevice annotation instead of!Memory.AllowOvercommit, so a non-overcommitted VM could report a zero working set;Stats()unconditionally calledLookupVMMEMbefore branching, even though physically backed UVMs use HCSAssignedMemory. When that lookup failed, containerd dropped the metric and callers observed an empty metrics response.The change mirrors the established LCOW V1 behavior: memory is physically backed when overcommit is disabled, and vmmem working-set lookup is only used for VA-backed UVMs.
Validation
go test -tags "windows lcow" ./internal/controller/vm/... -count=1go test -tags "windows lcow" ./internal/builder/vm/lcow/... -count=1containerd-shim-lcow-v2.exefrom this branch and ranTest_SandboxStats_WorkingSet_PhysicallyBacked/LCOWagainst a local build 26200 host: PASS