[libvirt] [PATCH] implement BOOT_TIMEOUT

Eric Blake eblake at redhat.com
Wed Apr 13 17:31:50 UTC 2011


On 04/13/2011 02:15 AM, Alexander Todorov wrote:
> ---
>  tools/libvirt-guests.init.sh |    2 ++
>  tools/libvirt-guests.sysconf |    3 +++
>  2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/libvirt-guests.init.sh b/tools/libvirt-guests.init.sh
> index f247e5e..b462ea8 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
> +BOOT_TIMEOUT=0
>  
>  test -f "$sysconfdir"/sysconfig/libvirt-guests &&
>      . "$sysconfdir"/sysconfig/libvirt-guests
> @@ -166,6 +167,7 @@ start() {
>                      gettext "already active"; echo
>                  else
>                      retval run_virsh "$uri" start "$name" >/dev/null && \
> +                    sleep $BOOT_TIMEOUT && \

I think the idea of a configurable sleep between guests (so that they
are staged rather than run back-to-back as fast as virsh can respond)
makes sense, but don't like the name BOOT_TIMEOUT.  It's not a timeout,
so much as a delay.  And it's not tied to BOOT (which is what the init
script does when the host boots) so much as guest starts.  Does the name
START_DELAY work any better?

>                      gettext "done"; echo

As written, if you have n guests, you also have n sleeps.  But after the
last guest, that's wasted dead time.  It seems like the better usage
pattern would be to sleep _before_ starting a guest, and to write the
code where the first guest started skips that sleep (n guests, n-1 sleeps).

>                  fi
>              fi
> diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
> index cd58728..e970a00 100644
> --- a/tools/libvirt-guests.sysconf
> +++ b/tools/libvirt-guests.sysconf
> @@ -10,6 +10,9 @@
>  #           libvirtd
>  #ON_BOOT=start
>  
> +# number of seconds to wait before starting the next guest

And this would read better as "number of seconds to wait between each
guest start"

> +#BOOT_TIMEOUT=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

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110413/62f54cd3/attachment-0001.sig>


More information about the libvir-list mailing list