Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,16 @@ func defaultL2Size(_ string, m checkpointstore.Manifest) int64 {
// capture fell through to the vRAM estimate below: a 14 GB capture
// asked for 96 GiB (80 GiB H100 default x 1.2). On a Retain
// StorageClass that over-allocation is permanent and per-capture.
// The floor is a guard against a degenerate manifest, not a default: it
// used to be 10 GiB, which discarded the measured size for every capture
// under ~8.5 GiB. A 269 MB cachedir capture provisioned 10 GiB (~20 GiB
// raw on a RAID-10 VPG), permanently, because these StorageClasses are
// Retain -- the same over-allocation this function was written to remove,
Comment thread
balajinvda marked this conversation as resolved.
Outdated
// one order of magnitude down. The 1.2x multiplier already covers fs
// overhead, and the L2 StorageClasses set allowVolumeExpansion, so
// sizing tight costs nothing.
if (m.CaptureMethod == "rootfs" || m.CaptureMethod == "cachedir") && m.TotalSizeBytes > 0 {
const floor = 10 * oneGiB
const floor = 2 * oneGiB
return max(m.TotalSizeBytes*12/10, floor)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,26 @@ func TestDefaultL2Size_RootfsUsesTotalSize(t *testing.T) {
}
}

// Small rootfs captures get a 10 GiB floor so fs overhead on a tiny tree
// doesn't provision a sub-GiB PVC that fails to format/fit.
func TestDefaultL2Size_RootfsFloor(t *testing.T) {
// The floor guards against a degenerate manifest; it is not a default size.
// It was 10 GiB, which meant the measured size was discarded for anything
// under ~8.5 GiB -- a 269 MB cachedir capture provisioned 10 GiB, permanently,
// because the L2 StorageClasses are Retain. Sizes above the floor must come
// from the measurement.
func TestDefaultL2Size_FloorOnlyAppliesBelowIt(t *testing.T) {
const oneGiB = int64(1) << 30
m := checkpointstore.Manifest{CaptureMethod: "rootfs", TotalSizeBytes: 2 * oneGiB}
if got := defaultL2Size("hash", m); got != 10*oneGiB {
t.Errorf("2 GB rootfs tree → %d GiB, want 10 GiB floor", got/oneGiB)

// Well under the floor: a 269 MB cachedir capture (the dev2 case).
tiny := checkpointstore.Manifest{CaptureMethod: "cachedir", TotalSizeBytes: 269 * 1000 * 1000}
if got := defaultL2Size("hash", tiny); got != 2*oneGiB {
t.Errorf("269 MB cachedir capture → %d GiB, want the 2 GiB floor", got/oneGiB)
Comment thread
balajinvda marked this conversation as resolved.
Outdated
}

// Above the floor: measurement wins, floor must not inflate it.
m := checkpointstore.Manifest{CaptureMethod: "rootfs", TotalSizeBytes: 5 * oneGiB}
want := 5 * oneGiB * 12 / 10
if got := defaultL2Size("hash", m); got != want {
t.Errorf("5 GB rootfs tree → %d GiB, want %d GiB (measured x1.2, not the floor)",
got/oneGiB, want/oneGiB)
}
}

Expand Down
Loading