[pve-devel] [RFC manager] startall: add predelay to autostarted guests

Thomas Lamprecht t.lamprecht at proxmox.com
Tue May 3 15:37:19 CEST 2016


Sometimes it isn't enough to rely on systemd to get everything ready
before executing 'startall', as even iof a service is started it may
"do stuff" until really ready, e.g. ceph.
Add an possibility to make a pre start delay on VMs with defined
startup order, this does not break current setups by altering
the semantics of 'up'.

Some useres complained that this wasn't possible in general and
others run into real problems with ceph, or iSCSI, see:
https://forum.proxmox.com/threads/26340/
---
 PVE/API2/Nodes.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 8487518..1656db2 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1292,6 +1292,16 @@ __PACKAGE__->register_method ({
 			my $default_delay = 0;
 			my $upid;
 
+			# for initial start up delay (e.g. storage is started but not yet ready)
+			my $pre_start_delay = defined($d->{predelay}) ?
+			    int($d->{predelay}) : $default_delay;
+			if ($pre_start_delay > 0) {
+			    print STDERR "Waiting for $pre_start_delay seconds (pre start delay)\n";
+			    for (my $i = 0; $i < $pre_start_delay; $i++) {
+				sleep(1);
+			    }
+			}
+
 			if ($d->{type} eq 'lxc') {
 			    return if PVE::LXC::check_running($vmid);
 			    print STDERR "Starting CT $vmid\n";
-- 
2.1.4





More information about the pve-devel mailing list