[pve-devel] [PATCH storage] Fix #1913: copy plugindata in get_vm_disknumber

Stoiko Ivanov s.ivanov at proxmox.com
Thu Sep 13 20:36:40 CEST 2018


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 the second access.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 PVE/Storage/Plugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index da91bdc..aefc7f8 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -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/;
-- 
2.11.0




More information about the pve-devel mailing list