restore-test: add rootfs override alongside bind-mount overrides
PVE refuses a restore carrying mountpoint params unless rootfs is also set ("mount
points configured, but 'rootfs' not set"). Size the rootfs override from the source
rootfs (rootfsSizeGB/sizeToGB, round up). Validated manually on the host: restore of
bind-mounted 9201 with --rootfs + --mp0/--mp9 overrides boots + tears down cleanly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,3 +46,19 @@ func TestBindMountOverrides(t *testing.T) {
|
||||
t.Error("expected nil when there are no bind mounts")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootfsSizeGB(t *testing.T) {
|
||||
cases := map[string]int{
|
||||
"local-lvm:vm-9201-disk-0,size=8G": 8,
|
||||
"local-lvm:base,size=512M": 1, // rounds up
|
||||
"local-lvm:base,size=1T": 1024,
|
||||
"local-lvm:base,size=0": 0,
|
||||
"local-lvm:base": 0, // no size field
|
||||
"local-lvm:base,size=8": 8, // unit-less → GB
|
||||
}
|
||||
for spec, want := range cases {
|
||||
if got := rootfsSizeGB(spec); got != want {
|
||||
t.Errorf("rootfsSizeGB(%q) = %d, want %d", spec, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user