[pve-devel] [PATCH storage] don't (accidentally) modify PVE::Cluster::vmlist

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jan 7 12:24:13 CET 2020


when listing volumes, otherwise an empty hash can be persisted into the
current worker's $vmlist, which could cause issues at various other API
endpoints.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    likely cause of https://forum.proxmox.com/threads/proxmox-api-unable-to-create-vm-already-exists-on-node.62868/

 PVE/Storage/Plugin.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index e826d36..0c39cbd 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -958,8 +958,11 @@ sub list_volumes {
 
 	foreach my $item (@$data) {
 	    if ($type eq 'images' || $type eq 'rootdir') {
-
-		my $vmtype = $vmlist->{ids}->{$item->{vmid}}->{type};
+		my $vminfo = $vmlist->{ids}->{$item->{vmid}};
+		my $vmtype;
+		if (defined($vminfo)) {
+		    $vmtype = $vminfo->{type};
+		}
 		if (defined($vmtype) && $vmtype eq 'lxc') {
 		    $item->{content} = 'rootdir';
 		} else {
-- 
2.20.1




More information about the pve-devel mailing list