[pve-devel] [PATCH pve-manager 1/2] fix lxc config key in get_start_stop_list sub

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Oct 19 18:02:46 CEST 2015


When adding the new LXC config format we forgot to adapt the
get_start_stop_list and do s/pve.startup/onboot/

This fixes that qemu VMs were started always before LXC CTs,
irregardless of the defined order.

This also let's us simplify the surrounding code and reduce code
reuse.

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

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 4f708e7..8a8a7c1 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1145,30 +1145,24 @@ my $get_start_stop_list = sub {
 	    
 	    my $bootorder = LONG_MAX;
 
+	    my $conf;
 	    if ($d->{type} eq 'lxc') {
-		my $conf = PVE::LXC::load_config($vmid); 
-		return if $autostart && !$conf->{'onboot'};
-		
-		if ($conf->{'pve.startup'}) {
-		    $startup = PVE::JSONSchema::pve_parse_startup_order($conf->{'startup'});
-		    $startup->{order} = $bootorder if !defined($startup->{order});
-		} else {
-		    $startup = { order => $bootorder };
-		}
+		$conf = PVE::LXC::load_config($vmid);
 	    } elsif ($d->{type} eq 'qemu') {
-		my $conf = PVE::QemuServer::load_config($vmid);
-		return if $autostart && !$conf->{onboot};
-
-		if ($conf->{startup}) {
-		    $startup =  PVE::JSONSchema::pve_parse_startup_order($conf->{startup});
-		    $startup->{order} = $bootorder if !defined($startup->{order});
-		} else {
-		    $startup = { order => $bootorder };
-		}
+		$conf = PVE::QemuServer::load_config($vmid);
 	    } else {
 		die "unknown VM type '$d->{type}'\n";
 	    }
 
+	    return if $autostart && !$conf->{onboot};
+
+	    if ($conf->{startup}) {
+		$startup =  PVE::JSONSchema::pve_parse_startup_order($conf->{startup});
+		$startup->{order} = $bootorder if !defined($startup->{order});
+	    } else {
+		$startup = { order => $bootorder };
+	    }
+
 	    # skip ha managed VMs (started by pve-ha-manager)
 	    return if defined($haconf->{ids}->{"pvevm:$vmid"});
 	    
-- 
2.1.4




More information about the pve-devel mailing list