feat(P05): drain + daemon drain-and-stop (REQ-061) + job migrate (REQ-116)

orca node drain <host>: marks draining, stops allocs via SSH, marks
drained. orca daemon drain-and-stop: stops v0.8 daemons on peers.
orca job migrate <name> --to <node>: drain+reschedule composite
(C3=a, not live-migrate). Node states: draining, drained.

---ci---
project: orca
phase: 05
milestone: v0.11
status: execute
---/ci---
This commit is contained in:
Jon Chery
2026-08-07 05:17:01 +00:00
parent f61ef2aa9e
commit 41bcf0a6bf
7 changed files with 1269 additions and 3 deletions
+13
View File
@@ -68,3 +68,16 @@ func (r *NodeRegistry) List(ctx context.Context) ([]*model.Node, error) {
func (r *NodeRegistry) Get(ctx context.Context, id string) (*model.Node, error) {
return r.repo.Get(ctx, id)
}
// SetNodeState updates a node's state to the given raw string (REQ-061).
// Used by the drain commands for the draining/drained states. This is
// the registry-level wrapper around store.NodeRepo.SetNodeState so the
// cli package does not need to reach into the repo directly.
func (r *NodeRegistry) SetNodeState(ctx context.Context, id, state string) error {
if err := r.repo.SetNodeState(ctx, id, state); err != nil {
r.audit.Record(ctx, "cli", "node.set_state", id, "failure", err, map[string]any{"state": state})
return fmt.Errorf("set node state: %w", err)
}
r.log.Info("node state set", slog.String("node_id", id), slog.String("state", state))
return nil
}