cleanup startall code

Only sleep when neccessary
This commit is contained in:
Dietmar Maurer 2012-03-20 09:43:10 +01:00
parent ed3ffe31d4
commit 30f6cd84a2

14
qm
View File

@ -248,19 +248,25 @@ __PACKAGE__->register_method ({
foreach my $vmid (keys %$vzlist) {
next if $vzlist->{$vmid}->{pid}; # already running
my $conf;
eval { $conf = PVE::QemuServer::load_config($vmid); };
if (my $err = $@) {
warn $err;
next;
}
next if !($conf && $conf->{onboot});
sleep(2) if $count != 0; # reduce load
$count++;
PVE::Cluster::check_cfs_quorum(); # abort when we loose quorum
eval {
my $conf = PVE::QemuServer::load_config($vmid);
if ($conf->{onboot}) {
print STDERR "Starting Qemu VM $vmid\n";
PVE::QemuServer::vm_start($storecfg, $vmid);
}
};
print STDERR $@ if $@;
warn $@ if $@;
}
return undef;