Hello folks,
here's a second try at this wrt to Eric's comments.
BOOT_TIMEOUT changed to START_DELAY, updated wording in the conf file to better
reflect what this does and added a flag to skip sleeping for the first ever
started guest.
---
tools/libvirt-guests.init.sh | 7 +++++++
tools/libvirt-guests.sysconf | 3 +++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tools/libvirt-guests.init.sh b/tools/libvirt-guests.init.sh
index f247e5e..30f957a 100644
--- a/tools/libvirt-guests.init.sh
+++ b/tools/libvirt-guests.init.sh
@@ -42,6 +42,7 @@ URIS=default
ON_BOOT=start
ON_SHUTDOWN=suspend
SHUTDOWN_TIMEOUT=0
+START_DELAY=0
test -f "$sysconfdir"/sysconfig/libvirt-guests &&
. "$sysconfdir"/sysconfig/libvirt-guests
@@ -141,6 +142,7 @@ start() {
return 0
fi
+ isfirst=true
while read uri list; do
configured=false
set -f
@@ -165,6 +167,11 @@ start() {
if "$guest_running"; then
gettext "already active"; echo
else
+ if "$isfirst"; then
+ isfirst=false
+ else
+ sleep $START_DELAY
+ fi
retval run_virsh "$uri" start "$name"
>/dev/null && \
gettext "done"; echo
fi
diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
index cd58728..37b258e 100644
--- a/tools/libvirt-guests.sysconf
+++ b/tools/libvirt-guests.sysconf
@@ -10,6 +10,9 @@
# libvirtd
#ON_BOOT=start
+# number of seconds to wait between each guest start
+#START_DELAY=0
+
# action taken on host shutdown
# - suspend all running guests are suspended using virsh managedsave
# - shutdown all running guests are asked to shutdown. Please be careful with