From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [RFC http-server/manager 0/2] add pvesh record subcommand
Date: Wed, 17 Jun 2026 18:47:47 +0200 [thread overview]
Message-ID: <20260617164749.574759-1-h.laimer@proxmox.com> (raw)
Implements a new pvesh subcommand that records the API requests a user makes
and prints them as the equivalent `pvesh` commands, e.g. to find the CLI/API
equivalent of an action done in the web UI.
`pvesh record <user>` creates a `<pid>.req` file under /run/pve-api-record/
containing the user and an `all` flag. The http-server (pveproxy) reads it and
appends the matching API requests (including data) to a spool file
`<pid>.events`. The pvesh process reads those entries, translates them into
`pvesh ..` and prints them. By default only writing requests (POST/PUT/DELETE)
are recorded, `--all` also includes reads (GET).
With the pid of the pvesh process as the identifier, this works with multiple,
concurrently running recordings. The pvesh process holds a lock on `<pid>.req`,
so if it is killed without cleaning up, the http-server can reap the stale
files once it can take the lock.
This spans two repos: the recording hook in pve-http-server and the `record`
command in pve-manager that uses it.
Note: recorded parameters are verbatim, so any secret submitted in a request
(e.g. a password) appears in the printed commands.
Turned out to be really handy for testing things, but i could also see how this
could be helpful in getting more familiar with the api in general and having a
way to map ui intercations to scriptable api requests.
also put pre-build packages on sani(`pvesh-record-rfc/`)
pve-http-server:
Hannes Laimer (1):
apiserver: add opt-in recording of api requests
src/Makefile | 1 +
src/PVE/APIServer/AnyEvent.pm | 17 +++
src/PVE/APIServer/RequestRecorder.pm | 188 +++++++++++++++++++++++++++
3 files changed, 206 insertions(+)
create mode 100644 src/PVE/APIServer/RequestRecorder.pm
pve-manager:
Hannes Laimer (1):
pvesh: add 'record' subcommand to trace user's API requests
PVE/CLI/pvesh.pm | 140 ++++++++++++++++++++++++++++++++++++++++
PVE/Service/pveproxy.pm | 1 +
2 files changed, 141 insertions(+)
Summary over all repositories:
5 files changed, 347 insertions(+), 0 deletions(-)
--
Generated by murpp 0.12.0
next reply other threads:[~2026-06-17 16:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 16:47 Hannes Laimer [this message]
2026-06-17 16:47 ` [PATCH pve-http-server 1/2] apiserver: add opt-in recording of api requests Hannes Laimer
2026-06-17 16:47 ` [PATCH pve-manager 2/2] pvesh: add 'record' subcommand to trace user's API requests Hannes Laimer
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=20260617164749.574759-1-h.laimer@proxmox.com \
--to=h.laimer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/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.