5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-09-10 01:44:24 +03:00

get_vm_disk_number: follow up cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2018-09-14 09:17:06 +02:00
parent f4cc2c4afe
commit dd1fa860d0

View File

@@ -528,13 +528,15 @@ sub create_base {
my $get_vm_disk_number = sub { my $get_vm_disk_number = sub {
my ($disk_name, $scfg, $vmid, $suffix) = @_; my ($disk_name, $scfg, $vmid, $suffix) = @_;
my $disk_regex = qr/(vm|base)-$vmid-disk-(\d+)$suffix/;
my $type = $scfg->{type}; my $type = $scfg->{type};
my $def = { %{$defaultData->{plugindata}->{$type}} }; my $def = { %{$defaultData->{plugindata}->{$type}} };
my $valid_formats = $def->{format}[0];
my $disk_regex = qr/(vm|base)-$vmid-disk-(\d+)$suffix/; my $valid = $def->{format}[0];
$disk_regex = qr/(vm|base|subvol|basevol)-$vmid-disk-(\d+)/ if ($valid->{subvol}) {
if $valid_formats->{subvol}; $disk_regex = qr/(vm|base|subvol|basevol)-$vmid-disk-(\d+)/;
}
if ($disk_name =~ m/$disk_regex/) { if ($disk_name =~ m/$disk_regex/) {
return $2; return $2;