-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #844: allow to pre-delay start-all-marked guests on boot
Add a simple ExecStartPre command which reads the local node config, and if a delay is set the helper sleeps that long then exists. The systemd-unit approach was chosen as this ensures that we really only delay when doing the startall on node boot. The pve-guests service does not allows manual stops, starts or restarts, it can only be pulled in by the multi-user.target Mark this command with "-" to tell systemd that errors of it should not cause an abort, it's a best-effort approach. The journal from a 2 second delay would look like: > Nov 19 13:13:48 dev6 systemd[1]: Starting PVE guests... > Nov 19 13:13:48 dev6 pve-startall-delay[2318]: Delaying on-boot 'startall' command for 2 second(s). > ... > Nov 19 13:13:50 dev6 pve-guests[2339]: <root@pam> starting task UPID:dev6:00000924:00000529:5DD3DC7E:startall::root@pam: Signed-off-by: Thomas Lamprecht <[email protected]>
- Loading branch information
1 parent
f36240c
commit 1ff3fef
Showing
5 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use PVE::INotify; | ||
use PVE::NodeConfig; | ||
|
||
my $local_node = PVE::INotify::nodename(); | ||
|
||
my $node_config = eval { PVE::NodeConfig::load_config($local_node) } // {}; | ||
|
||
if (my $delay = $node_config->{'startall-onboot-delay'}) { | ||
warn "Delaying on-boot 'startall' command for $delay second(s).\n"; | ||
sleep($delay); # don't care for interrupts, best effort only | ||
} | ||
|
||
exit 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters