agent v0.33.0: C1 net — pre-start self-heal hook + decommission mp-delete

Pre-start PVE hookscript (internal/guesthook) creates host-root placeholders for
absent bind-mount sources so the guest always boots (fail-closed); decommission
now pct set --delete's the dead mp (GuestBinder.DetachBind) so a missing source
can't brick the next reboot (B3 C1 bug). Non-hollow tests + companions. Installed
+ registered per-guest by the provision back-half. Transitional ahead of the
intermediary-mount re-architecture which makes C1 structural.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 16:11:10 +02:00
parent 2a4affc3a8
commit 44cdf82631
11 changed files with 490 additions and 3 deletions
+15
View File
@@ -70,6 +70,21 @@ func (b *GuestBinder) AttachBind(ctx context.Context, vmid int, mountKey, where
return nil
}
// DetachBind removes a mountpoint bind from the guest config (`pct set <vmid> --delete <mpN>`). This is
// the decommission/eject counterpart to AttachBind and the C1 FIX: a drive whose bind is removed here
// leaves NO dead `mpN` whose now-missing source would brick the guest on its next reboot (the B3
// critical bug, where decommission unmounted the drive but never deleted the bind). It runs on a RUNNING
// guest — a plain config edit, NOT a start — so it takes no start lock and cannot deadlock (unlike a
// pre-start `--delete`, which is why the boot-time net uses placeholders instead). The live in-guest
// mount lingers until the next reboot; the caller unmounts the host source separately.
func (b *GuestBinder) DetachBind(ctx context.Context, vmid int, mountKey string) error {
if err := b.run(ctx, "pct", "set", strconv.Itoa(vmid), "--delete", mountKey); err != nil {
return fmt.Errorf("guest-detach: pct set %d --delete %s: %w", vmid, mountKey, err)
}
b.logger.Info("guest-detach: mountpoint bind removed from guest config", "vmid", vmid, "slot", mountKey)
return nil
}
// RebootGuest reboots the guest (graceful shutdown + start) so persisted-but-inactive mountpoint
// binds activate (slice 10 P2: the host-side live inject is blocked on an unprivileged guest, so a
// drive enrolled into a RUNNING guest activates only at the next boot — this is the user-triggered