From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [PATCH storage 0/3] generalize volname_for_format across storage plugins
Date: Wed, 12 Aug 2026 17:32:49 +0200 [thread overview]
Message-ID: <20260812153252.222298-1-e.huhsovitz@proxmox.com> (raw)
Previously, only the LVM plugin explicitly validated that a requested
volume format matched the provided volume name. This inconsistency
allowed other storage backends to silently accept mismatched names and
formats, leading to confusing states (as was previously mentioned in
bug #7811).
Centralize volname_for_format() in the base PVE::Storage::Plugin.
This design allows individual plugins to override specific parsing
behavior while sharing the core validation logic.
The new validation method operates in two modes:
* Lax mode (default): Names without an extension are
automatically adapted to the requested format. Names that
explicitly spell out a contradicting format are rejected.
* Strict mode: Any format mismatch results in an error.
To preserve backwards compatibility, only the default lax
mode is currently used in alloc_image() and rename_volume().
Should strict volume name guidelines be needed in the
future, the strict parameter can be enabled at the call
sites.
Potential Pitfalls
------------------
Because this introduces stricter validation checks, there is a chance
it may break existing systems, scripts, or automation that previously
relied on passing mismatched volume names and formats without
triggering an error.
Patch Overview
--------------
Elias Huhsovitz (3):
plugin: refactor format parsing in parse_volname and parse_name_dir
plugin: generalize volname_for_format across storage plugins
test: plugin: add unit tests for volname_for_format
src/PVE/Storage/BTRFSPlugin.pm | 6 +-
src/PVE/Storage/LVMPlugin.pm | 39 +-
src/PVE/Storage/LvmThinPlugin.pm | 18 +-
src/PVE/Storage/Plugin.pm | 99 +++-
src/PVE/Storage/RBDPlugin.pm | 22 +-
src/PVE/Storage/ZFSPlugin.pm | 2 +
src/PVE/Storage/ZFSPoolPlugin.pm | 37 ++
src/test/run_plugin_tests.pl | 1 +
src/test/volname_for_format_test.pm | 813 ++++++++++++++++++++++++++++
9 files changed, 1005 insertions(+), 32 deletions(-)
create mode 100644 src/test/volname_for_format_test.pm
--
2.47.3
next reply other threads:[~2026-08-12 15:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 15:32 Elias Huhsovitz [this message]
2026-08-12 15:32 ` [PATCH storage 1/3] plugin: refactor format parsing in parse_volname and parse_name_dir Elias Huhsovitz
2026-08-12 15:32 ` [PATCH storage 2/3] plugin: generalize volname_for_format across storage plugins Elias Huhsovitz
2026-08-12 15:32 ` [PATCH storage 3/3] test: plugin: add unit tests for volname_for_format Elias Huhsovitz
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=20260812153252.222298-1-e.huhsovitz@proxmox.com \
--to=e.huhsovitz@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox