plugin: fix parse_name_dir regression for custom volume names
prior to the introduction of snapshot as volume chains, volume names of
almost arbitrary form were accepted. only forbid filenames which are
part of the newly introduced namespace for snapshot files, while
deprecating other names not following our usual naming scheme, instead
of forbidding them outright.
Fixes: b63147f5df "plugin: fix volname parsing"
Co-authored-by: Shannon Sterz <s.sterz@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Shannon Sterz <s.sterz@proxmox.com>
Link: https://lore.proxmox.com/20250731111519.931104-2-f.gruenbichler@proxmox.com
This commit is contained in:
committed by
Thomas Lamprecht
parent
94a54793cd
commit
a477189575
@ -715,8 +715,11 @@ sub parse_name_dir {
|
|||||||
if ($name =~ m!^((vm-|base-|subvol-)(\d+)-[^/\s]+\.(raw|qcow2|vmdk|subvol))$!) {
|
if ($name =~ m!^((vm-|base-|subvol-)(\d+)-[^/\s]+\.(raw|qcow2|vmdk|subvol))$!) {
|
||||||
my $isbase = $2 eq 'base-' ? $2 : undef;
|
my $isbase = $2 eq 'base-' ? $2 : undef;
|
||||||
return ($1, $4, $isbase); # (name, format, isBase)
|
return ($1, $4, $isbase); # (name, format, isBase)
|
||||||
|
} elsif (parse_snap_name($name)) {
|
||||||
|
die "'$name' is a snapshot filename, not a volume!\n";
|
||||||
} elsif ($name =~ m!^((base-)?[^/\s]+\.(raw|qcow2|vmdk|subvol))$!) {
|
} elsif ($name =~ m!^((base-)?[^/\s]+\.(raw|qcow2|vmdk|subvol))$!) {
|
||||||
warn "this volume name `$name` is not supported anymore\n" if !parse_snap_name($name);
|
warn "this volume name `$name` is deprecated, please use (base-/vm-/subvol-)-NNN- as prefix\n";
|
||||||
|
return ($1, $3, $2); # (name ,format, isBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
die "unable to parse volume filename '$name'\n";
|
die "unable to parse volume filename '$name'\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user