[Linux-cluster] Startup delay for VMs in a cluster

Thomas Sjolshagen thomas at sjolshagen.net
Fri Jan 29 18:47:10 UTC 2010


On Jan 29, 2010, at 10:42 AM, Dirk H. Schulz wrote:

[SNIP]

> 
> But what about copying vm.sh to vm-something.sh and filling in a crude "sleep 60" after the vm start? Would you see any problems there (apart from updates to vm.sh going past it)?

Dirk,

I think you'd have to randomize the delay somewhat, i.e. something along the lines of the example below. However,
this example isn't the best since, in my view, there are a couple of problems related to the loop (could be "expensive")
as well as the maxwait vs. vm.sh 'start timeout' value relationship.

#!/bin/bash
# Set a max value for the sleep time per guest.
# NOTE: Must make sure the start timeout for the vm.sh script
# is longer than the $maxwait setting (for obvious reasons)
maxwait=30

value=$RANDOM
while [ $value -gt $maxwait ] ; do
     # Theoretically, this could loop for "a while" since $RANDOM can be
     # a value between 0 and 32K...
     value=$RANDOM
done

# Sleep for that time.
sleep $value





More information about the Linux-cluster mailing list