From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D1E501FF0E5 for ; Wed, 12 Aug 2026 17:33:09 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id AF8802158F; Wed, 12 Aug 2026 17:33:01 +0200 (CEST) From: Elias Huhsovitz To: pve-devel@lists.proxmox.com Subject: [PATCH storage 0/3] generalize volname_for_format across storage plugins Date: Wed, 12 Aug 2026 17:32:49 +0200 Message-ID: <20260812153252.222298-1-e.huhsovitz@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1786548761586 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.854 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: DUUP7I7P4SEUELQSJSKXKWIOHHILG3HB X-Message-ID-Hash: DUUP7I7P4SEUELQSJSKXKWIOHHILG3HB X-MailFrom: e.huhsovitz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Elias Huhsovitz X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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