fix(P3): record enrolled intent on the idempotent guest-attach path too

This commit is contained in:
2026-06-12 17:51:52 +02:00
parent bbb284e378
commit 9580c8c75d
+4 -1
View File
@@ -260,9 +260,12 @@ func (s *Server) handleDiskGuestAttach(w http.ResponseWriter, r *http.Request, v
return
}
mounts := cfg.MountPoints()
// Idempotency: already bound at `where`? (a bind's mp= equals the guest path).
// Idempotency: already bound at `where`? (a bind's mp= equals the guest path). Still (re)record the
// ENROLLED intent — a drive bound at a prior boot must be known to self-heal even if never
// re-attached this process lifetime.
for key, spec := range mounts {
if _, mp, _ := parseMount(spec); mp == where {
s.recordIntent(r.Context(), where, "enrolled")
s.logger.Info("local-api: guest-attach idempotent (already bound)", "vmid", vmid, "where", where, "slot", key)
writeOK(w, map[string]any{"vmid": vmid, "attached": where, "slot": key, "already": true})
return