[libvirt] [PATCH] implement BOOT_TIMEOUT

Alexander Todorov atodorov at otb.bg
Thu Apr 14 10:21:54 UTC 2011


На 13.04.2011 20:31, Eric Blake написа:
> 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?
>

I have no preference on the name.


>>                       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).
>

Right, that makes sense. It was a quick patch to resolve my particular issue 
where starting 10 guests at once puts big load on my system.

I will rework the patch with your comments and post it again but was wondering 
about something more advanced.

Is it possible to specify the order(and timeouts) in which individual guests are 
started? As it seems currently this is not possible.

I've come across a situation where one of the guests needs to start first 
(provides a database) and then another guests needs to start second (an app 
server). The reason is that this is a proprietary app which is badly written and 
fails to connect/re-connect to the database if it is not online in the first place.

Regards,
Alexander.




More information about the libvir-list mailing list