5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-11 05:18:01 +03:00

Fix #1913: get_vm_disk_number: clone plugindata to avoid side effects

Accessing a non-existing 'format' key in plugindata (e.g., in LvmThinPlugin),
created it by autovivication, thus breaking the fallback to the default value
'raw' upon any following access.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
Stoiko Ivanov 2018-09-13 20:36:40 +02:00 committed by Thomas Lamprecht
parent 9dcf88bb27
commit f4cc2c4afe

View File

@ -529,7 +529,7 @@ my $get_vm_disk_number = sub {
my ($disk_name, $scfg, $vmid, $suffix) = @_;
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/;