[pve-devel] [PATCH manager 1/3] get_filtered_vmlist: save VM conf in own subhash

Philip Abernethy p.abernethy at proxmox.com
Tue Sep 5 17:54:24 CEST 2017


From: Thomas Lamprecht <t.lamprecht at proxmox.com>

small refactoring in get_filtered_vmlist: save a VMs config in its
own subhash to avoid collisions with other data which we want to save
in the vmid list, for now this is only `type` but in the next patch
I want to save also the class

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/API2/Nodes.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index c85c9f57..101a4f40 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1248,7 +1248,7 @@ my $get_filtered_vmlist = sub {
 	    return if !$templates && $class->is_template($conf);
 	    return if !$ha_managed && PVE::HA::Config::vm_is_ha_managed($vmid);
 
-	    $res->{$vmid} = $conf;
+	    $res->{$vmid}->{conf} = $conf;
 	    $res->{$vmid}->{type} = $d->{type};
 	};
 	warn $@ if $@;
@@ -1265,7 +1265,7 @@ my $get_start_stop_list = sub {
 
     my $resList = {};
     foreach my $vmid (keys %$vmlist) {
-	my $conf = $vmlist->{$vmid};
+	my $conf = $vmlist->{$vmid}->{conf};
 
 	next if $autostart && !$conf->{onboot};
 
-- 
2.11.0





More information about the pve-devel mailing list