[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] implement BOOT_TIMEOUT



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]