From: thomas moore <thomas@mooresolutions.co.nz>
To: "pbs-devel" <pbs-devel@lists.proxmox.com>
Subject: [RFC] add max-depth to the datastore snapshots API endpoint
Date: Sat, 22 Aug 2026 12:15:38 +1200 [thread overview]
Message-ID: <1a026d2b773.4f0fd0cd237366.1462259800663760854@mooresolutions.co.nz> (raw)
In-Reply-To:
[-- Attachment #1: Type: text/plain, Size: 2436 bytes --]
Hi all
This is a proposal for discussion, not a patch. The
developer documentation asks that plans be discussed before
starting work, so I'd like to check whether this would be
acceptable before writing it.
GET /api2/json/admin/datastore/{store}/snapshots returns only
the snapshots in the requested namespace, so a client wanting
a datastore-wide view has to call
/admin/datastore/{store}/namespace first and then issue one
snapshots request per namespace. I ran into this writing a
third-party monitoring client.
Tested against PBS 4.2:
/admin/datastore/pbs/snapshots -> 485 snapshots (root
only)
/admin/datastore/pbs/snapshots?ns=test -> 1 snapshot
/admin/datastore/pbs/snapshots?max-depth=7 -> 400
parameter verification failed - 'max-depth': schema does not
allow additional properties
Proposal: accept an optional max-depth using the
existing NS_MAX_DEPTH_SCHEMA, defaulting to 0 so behaviour is
unchanged for current callers.
This looks anticipated in the code. As of
5d95fc20e, src/api2/admin/datastore.rs lines 571, 575 and 583
each carry a "// FIXME: Recursion" on the group
construction in list_snapshots_blocking, with a further one at
565 about filtering by owner before collecting.
ListAccessibleBackupGroups already takes max_depth and applies
the per-namespace privilege and owner checks during iteration,
and get_snapshots_count uses it in roughly the shape list_snapshots
would need.
I'd send it as two patches: the refactor
onto ListAccessibleBackupGroups with no behavioural change, then
max-depth on top. I can test on a 4.2 instance including with a
token holding DatastoreAudit on the root namespace only, to
confirm namespaces the token cannot see stay absent from a
recursive listing.
Questions for the list
1. Is adding max-depth to the snapshots endpoint acceptable in
principle?
2. Is ListAccessibleBackupGroups the right vehicle here, or is
there a reason list_snapshots does not already use it?
3. Snapshot entries carry no namespace field, so a recursive
listing is ambiguous unless the client tracks it per request. Adding
one would mean a new field on SnapshotListItem, which is also
decoded from remote instances in server/sync.rs and server/push.rs
If you'd rather this were solved another way or not at all I'm
happy to hear it before writing anything.
Regards Thomas Moore
[-- Attachment #2: Type: text/html, Size: 4201 bytes --]
reply other threads:[~2026-08-22 0:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a026d2b773.4f0fd0cd237366.1462259800663760854@mooresolutions.co.nz \
--to=thomas@mooresolutions.co.nz \
--cc=pbs-devel@lists.proxmox.com \
--cc=sales@mooresolutions.co.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.