agent: stale-lock guard uses tasks?source=active (PVE 9.x rejects ?running=1)

Live test on felhom-pve (PVE 9.2.2) caught GET /nodes/{node}/tasks?running=1
returning HTTP 400 "property not defined in schema". The fail-safe correctly
left the lock, but the BackupRunning guard always errored. source=active is
the supported filter and returns the RUNNING tasks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0162BnMpUXscPsUB1cU8Tr6K
This commit is contained in:
2026-06-30 09:06:01 +02:00
parent 6e38e2f921
commit 1c078b943d
+6 -3
View File
@@ -63,13 +63,16 @@ func (c *Client) ListSnapshots(ctx context.Context, vmid int) ([]Snapshot, error
return ss, c.get(ctx, path, &ss) return ss, c.get(ctx, path, &ss)
} }
// ListRunningTasks returns the node's currently-running tasks (GET /nodes/{node}/tasks?running=1). // ListRunningTasks returns the node's currently-active tasks (GET /nodes/{node}/tasks?source=active).
// The startup stale-lock recovery uses it as the load-bearing safety guard: a backup lock is cleared // The startup stale-lock recovery uses it as the load-bearing safety guard: a backup lock is cleared
// ONLY when no vzdump task is genuinely in-flight for the guest (an agent restart while a real backup // ONLY when no vzdump task is genuinely in-flight for the guest (an agent restart while a real backup
// runs must never clear the live lock). // runs must never clear the live lock). NOTE: PVE 9.x rejects `?running=1` ("property not defined in
// schema") — `source=active` is the supported filter (it returns the RUNNING tasks); confirmed live on
// felhom-pve (PVE 9.2.2). active-source entries carry status "RUNNING"; we match on type+id, so the
// case difference vs the by-UPID status endpoint ("running") is moot.
func (c *Client) ListRunningTasks(ctx context.Context) ([]TaskStatus, error) { func (c *Client) ListRunningTasks(ctx context.Context) ([]TaskStatus, error) {
var ts []TaskStatus var ts []TaskStatus
return ts, c.get(ctx, "/nodes/"+c.node+"/tasks?running=1", &ts) return ts, c.get(ctx, "/nodes/"+c.node+"/tasks?source=active", &ts)
} }
// ListStorage returns GET /storage (cluster-wide storage definitions). // ListStorage returns GET /storage (cluster-wide storage definitions).