[pve-devel] [PULL 2/4] Skip templates when using the start all VMs button

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Mar 18 09:30:29 CET 2016


From: Caspar Smit <casparsmit at supernas.eu>

Refactored and now using PVE::QemuConfig and PVE::LXC::Config
Moved the next if.. statements into the corresponding branches

Signed-off-by: Caspar Smit <casparsmit at supernas.eu>
Reviewed-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/API2/Nodes.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index d4af788..5f37d81 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1274,6 +1274,18 @@ __PACKAGE__->register_method ({
 		foreach my $vmid (sort {$a <=> $b} keys %$vmlist) {
 		    my $d = $vmlist->{$vmid};
 
+		    # skip templates
+		    my $conf;
+		    if ($d->{type} eq 'lxc') {
+			$conf = PVE::LXC::Config->load_config($vmid);
+			next if PVE::LXC::Config->is_template($conf);
+		    } elsif ($d->{type} eq 'qemu') {
+			$conf = PVE::QemuConfig->load_config($vmid);
+			next if PVE::QemuConfig->is_template($conf);
+		    } else {
+			die "unknown VM type '$d->{type}'\n";
+		    }
+
 		    PVE::Cluster::check_cfs_quorum(); # abort when we loose quorum
 	    
 		    eval {
-- 
2.1.4





More information about the pve-devel mailing list