fix lxc config key in get_start_stop_list sub

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@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2015-10-19 18:02:46 +02:00 committed by Dietmar Maurer
parent 9199356e3d
commit 04b2004b36

View File

@ -1145,30 +1145,24 @@ my $get_start_stop_list = sub {
my $bootorder = LONG_MAX; my $bootorder = LONG_MAX;
my $conf;
if ($d->{type} eq 'lxc') { if ($d->{type} eq 'lxc') {
my $conf = PVE::LXC::load_config($vmid); $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 };
}
} elsif ($d->{type} eq 'qemu') { } elsif ($d->{type} eq 'qemu') {
my $conf = PVE::QemuServer::load_config($vmid); $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 };
}
} else { } else {
die "unknown VM type '$d->{type}'\n"; 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) # skip ha managed VMs (started by pve-ha-manager)
return if defined($haconf->{ids}->{"pvevm:$vmid"}); return if defined($haconf->{ids}->{"pvevm:$vmid"});