project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] Config drift scanner reports an offline node's objects as removed (phantom removal wave on every node outage)

Open daglimmer opened this issue 2 months ago • 1 comments

Overview

When a PVE node is powered off (maintenance, reboot, hardware outage), the config drift scanner reports that node's guests and NICs as removed objects — even though nothing was destroyed. The next scan after the node comes back reports them as normal again. Every node outage therefore fires a wave of false "object removed" drift events.

Observed in production (2026-09-29)

A PVE node (pve-cl-01, 3-node cluster, PVE 9.x) went down at ~16:46 UTC. The very next drift scan of that cluster emitted 10 false removal events in one sweep:

  • 6x network — every NIC of the offline node: pve-cl-01/eno1, pve-cl-01/enx0c3796c1d74a, pve-cl-01/enx0c3796c1d753, pve-cl-01/vmbr0, pve-cl-01/vmbr1, pve-cl-01/wlp0s20f3
  • 4x vm_config — every guest on that node: lxc/150, lxc/402, lxc/607, lxc/943

All ten objects were verified present and unchanged after the node returned; every one of the ten events was a phantom.

Why it happens

_fetch_state() skips a node silently when its per-node reads fail (_api_get returns non-200 for a down node) — correct behaviour for snapshot robustness. But the deletion-detection step at the end of _scan_cluster() only sees that some (kind, scope) baseline keys are now absent from the fetched state, and emits each one as a removal ({"path": "*", "op": "removed"}, severity warning for vm_config/storage). It has no information about WHY the scope is missing.

An offline node does not answer nodes/<n>/network or nodes/<n>/<t>/<vmid>/config, so its scopes never enter the state — and the scanner reads their absence as "object removed".

Impact

  1. Alert noise: a critical-adjacent removal wave on every node reboot/power event. In our case the same wave also re-fired on every scan while a settle was pending — the scanner has no dedup, so each 6h sweep re-fires open classes.
  2. A real footgun: acknowledging+promoting these events while the node is down rebaselines the affected scopes — promote rebaselines from LIVE state, and the offline node's objects are invisible, so they get deleted from the baseline. When the node returns, every one of them fires as fresh mirror-image added drift. A routine "clean up the alerts" action during a maintenance window corrupts the baseline.
  3. ISO-27001 evidence surface: drift feeds are used as audit evidence; recurring false removals erode the signal value of the whole feed.

Proposed behaviour

At drift-diff generation time, for any removal whose owning node is offline at scan time:

  1. Do NOT emit the event as removed.
  2. Preferred: emit it with kind unknown (or the existing low-severity equivalent, e.g. severity info) plus a "node offline" annotation carrying the owning node name, so the feed stays self-explanatory.
  3. Liveness source: the cluster/node status PegaProx already tracks (the manager's node status) — a cheap guard at diff-generation time, no new collectors.
  4. Normal removal detection resumes automatically once the node is back online.

Safety argument: the guard only delays removal detection until node recovery. If an object is genuinely destroyed while its node is down, the baseline still holds it, so the first scan after the node returns emits a normal removal event for it. No true removal is ever lost — only phantom noise is suppressed.

Scope is network (<node>/<iface>) and vm_config (node from the baseline snapshot); cluster-wide kinds (storage, cluster_options) keep normal removal detection because they are read through the cluster endpoint, not the offline node.

Happy to send the PR (with repro/regression/recovery tests) on the Testing base if the approach is agreed. Related but distinct: #815 (webhook dispatch).

daglimmer avatar Oct 02 '26 12:10 daglimmer

👋 Thanks for opening an issue!

It looks like the issue template was removed (or this was opened outside the templates). We rely on the Bug / Feature template so we can actually act on reports — a description-only issue with the template deleted almost always misses the details we need (version, repro, environment).

Please open a fresh issue using one of the templates (New issue → 🐛 Bug Report or ✨ Feature Request) and fill in the sections. 🐾

This is an automated message — closing for now; reopen with a completed template.

github-actions[bot] avatar Oct 02 '26 12:10 github-actions[bot]