Skip to content

fix: status() fetches the pool root without its children (#310) - #313

Merged
TheGrandWazoo merged 2 commits into
mainfrom
fix/310-status-no-children
Nov 27, 2026
Merged

TheGrandWazoo merged 2 commits into
mainfrom
fix/310-status-no-children

Conversation

@TheGrandWazoo

@TheGrandWazoo TheGrandWazoo commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Fixes #310 (phase 1). Phase 2 (optional cache) is tracked separately and conditionally in #311.

Problem

pvestatd calls status() every ~10 s, on every node, for every storage. Each call ran GET /pool/dataset?id=<pool>, which makes TrueNAS build the whole dataset tree under the pool. On a ~600-dataset pool with 8 nodes, that kept middlewared at 300–400 % CPU and made alloc_image time out (reported in #309 by @esaudet).

Fix

  • status() now calls GET /pool/dataset/id/<pool>?extra.retrieve_children=false. It still reports the pool root, so the numbers PVE shows don't change.
  • WebSocket transport: the REST→JSON-RPC mapping dropped query options, so perf(status): query only the configured dataset and cache the result per node #309's version only helped REST. The new _ws_query_opts maps extra.* query params (with true/false as JSON booleans) into the options of both pool.dataset.query mappings. Callers with no extra.* params still send {}.
  • Why the /id/ form: verified live, read-only, from pve01 on 2026-11-26:
Host /id/<pool>?extra.retrieve_children=false ?id=<pool>&extra.retrieve_children=false
CORE 13.0-U6.8 (REST) option ignored, same result as today returns []
SCALE 25.04 (REST) children=0, same used/avail works
SCALE 25.10 (REST) children=0, same used/avail works

WebSocket pool.dataset.query with {extra: {retrieve_children: false}}, pool-root payload:

Host Before After used/avail
SCALE 25.04 10.6 KB 3.4 KB identical
SCALE 25.10 14.2 KB 3.5 KB identical

These lab pools have only a handful of datasets. The saving scales with the number of datasets.

Testing

  • prove t/: 65 tests pass, including the new t/status.t (status call shape, missing pool, WS option mapping, unchanged options for other callers)
  • New test fails against the pre-fix module
  • perlcritic clean (CI profile)
  • CI green
  • Lab: dev build on pve01, then pvesm status and a full cycle on CORE (.90 REST), Scale01 (.91 WS), Scale2504-Tank01 + Multipath (.92 WS); check that the numbers match 4.0.3
  • Field: @esaudet runs the dev build and reports middlewared CPU before and after (decides perf: optional in-memory cache for status() (#310 phase 2, conditional) #311)

Docs

🤖 Generated with Claude Code

TheGrandWazoo and others added 2 commits November 26, 2026 09:34
pvestatd calls status() every ~10 s on every node for every storage, and
each call made TrueNAS build the whole dataset tree under the pool. On a
~600-dataset pool with 8 nodes that kept middlewared at 300-400 % CPU and
timed out alloc_image (reported in #309).

status() now asks for the pool root via /pool/dataset/id/<pool> with
extra.retrieve_children=false. It still reports the pool root, so PVE shows
the same numbers. The /id/ form is required: CORE 13 ignores the option
there, but answers [] when it is combined with an ?id= filter (verified
live on CORE 13.0-U6.8, SCALE 25.04 and 25.10).

The WS transport dropped query options entirely, so the option never
reached SCALE 25.04+, the very versions that reported the load.
_ws_query_opts now maps extra.* query parameters onto JSON-RPC query
options for both pool.dataset.query mappings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Operators on large pools see middlewared pinned and disk creation timing
out with nothing pointing at the plugin. The README entry names the symptom,
how to confirm pvestatd is the source, the fixed version, and where to
report if 4.0.4 is not enough (#311 decides whether a cache is needed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheGrandWazoo

Copy link
Copy Markdown
Owner Author

Lab results, 2026-11-27, pve01 (PVE 9.2.21). CI build 4.0.3~dev+3143d69; the packaged TrueNAS.pm md5 matches the branch.

  • pvesm status: all 4 storages active. Usage is identical to 4.0.3-1, apart from a few KB of live drift.
  • Full cycle (create → offline resize 2G → start → online resize 3G → stop → destroy), all PASS:
    • TrueNAS01-Tank01: CORE 13.0-U6.8, REST
    • TrueNAS-Scale01-Tank01: SCALE 25.10.6, WS
    • TrueNAS-Scale2504-Tank01: SCALE 25.04.2.6, WS
    • TrueNAS-Scale2504-Multipath: SCALE 25.04.2.6, WS + multipath
  • Logs: no pvestatd/pvedaemon warnings apart from the known Storage API 16: bump api() so PVE stops warning 'implementing an older storage API' #308 API notice.
  • Cleanup: no leftover volumes or iSCSI sessions. pve01 is restored to 4.0.3-1.

@TheGrandWazoo
TheGrandWazoo marked this pull request as ready for review November 27, 2026 14:45
@TheGrandWazoo
TheGrandWazoo merged commit bd8afc3 into main Nov 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: status() polling overloads TrueNAS middleware on large pools / multi-node clusters

1 participant