libvirt-guests: implement START_DELAY

Allow libvirt-guests to stage a delay between guest startups,
to avoid system load caused by back-to-back startup.
This commit is contained in:
Alexander Todorov 2011-04-15 11:57:06 +03:00 committed by Eric Blake
parent e692352689
commit d934bd0a58
3 changed files with 11 additions and 0 deletions

View File

@ -165,6 +165,7 @@ Patches have also been contributed by:
Thibault VINCENT <thibault.vincent@smartjog.com>
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Jesse Cook <code.crashenx@gmail.com>
Alexander Todorov <atodorov@otb.bg>
[....send patches to get your name here....]

View File

@ -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

View File

@ -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