]> xenbits.xensource.com Git - libvirt.git/commitdiff
libvirt-guests: implement START_DELAY
authorAlexander Todorov <atodorov@otb.bg>
Fri, 15 Apr 2011 08:57:06 +0000 (11:57 +0300)
committerEric Blake <eblake@redhat.com>
Fri, 15 Apr 2011 17:15:06 +0000 (11:15 -0600)
Allow libvirt-guests to stage a delay between guest startups,
to avoid system load caused by back-to-back startup.

AUTHORS
tools/libvirt-guests.init.sh
tools/libvirt-guests.sysconf

diff --git a/AUTHORS b/AUTHORS
index fded3757ab77812a341f71dfb8ea222ca2244183..b43207b7b76d6be34ce29337a8484990e664c236 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -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....]
 
index f247e5e449400883b09ab53a073f43f690e67577..30f957aa5a5a1dcbe9c4412c8a1a622bade79895 100644 (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
index cd58728b43700f5ab8e1c13b52893f624045986d..37b258ef529fccf912eaa5978db8ec26adeb0b1b 100644 (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