[pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS shorter than 2 characters
Arthur Bied-Charreton
a.bied-charreton at proxmox.com
Wed Jan 21 11:32:30 CET 2026
The regex in Storage::parse_lvm_name requires at least 2 characters, but
shorter IDs only failed with "contains illegal characters". Add explicit
length check to return a clearer error message in this case.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton at proxmox.com>
---
src/PVE/Storage/Plugin.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 6f3d691..58f714c 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -333,6 +333,11 @@ PVE::JSONSchema::register_format('pve-storage-vgname', \&parse_lvm_name);
sub parse_lvm_name {
my ($name, $noerr) = @_;
+ if (length($name) < 2) {
+ return undef if $noerr;
+ die "lvm name '$name' can't be shorter than 2 characters\n";
+ }
+
if ($name !~ m/^[a-z0-9][a-z0-9\-\_\.]*[a-z0-9]$/i) {
return undef if $noerr;
die "lvm name '$name' contains illegal characters\n";
--
2.47.3
More information about the pve-devel
mailing list