Make wait_for mor flexable
Adding LOOP nums and SLEEPTIME as params
This commit is contained in:
parent
48b26a331f
commit
2a231ab855
|
@ -20,9 +20,14 @@ scp_noprompt(){
|
|||
}
|
||||
|
||||
wait_for(){
|
||||
for x in {0..60} ; do
|
||||
LOOPS=$1
|
||||
SLEEPTIME=$2
|
||||
shift ; shift
|
||||
i=0
|
||||
while [ $i -lt $LOOPS ] ; do
|
||||
i=$((i + 1))
|
||||
$@ && return 0 || true
|
||||
sleep 10
|
||||
sleep $SLEEPTIME
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@ cd $TOCI_WORKING_DIR/tripleo_incubator
|
|||
|
||||
id | grep libvirt || ( echo "You have been added to the libvirt group, this script will now exit but will succeed if run again in a new shell" ; exit 1 )
|
||||
|
||||
# looks like libvirt somtimes takes a little time to start
|
||||
wait_for 3 3 ls /var/run/libvirt/libvirt-sock
|
||||
|
||||
cd $TOCI_WORKING_DIR/tripleo_bm_poseur
|
||||
sudo ./bm_poseur --bridge-ip=none create-bridge
|
||||
sudo service libvirt-bin restart
|
||||
|
@ -37,5 +40,5 @@ DIB_PATH=$TOCI_WORKING_DIR/stackforge_diskimage-builder \
|
|||
|
||||
BOOTSTRAP_IP=`scripts/get-vm-ip bootstrap`
|
||||
# We're going to wait for it to finish firstboot
|
||||
wait_for ssh_noprompt root@$BOOTSTRAP_IP ls /opt/stack/boot-stack/boot-stack.done && break || true
|
||||
wait_for 30 10 ssh_noprompt root@$BOOTSTRAP_IP ls /opt/stack/boot-stack/boot-stack.done
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ ssh_noprompt root@$BOOTSTRAP_IP "cat /opt/stack/boot-stack/virtual-power-key.pub
|
|||
|
||||
# Now we have to wait for the bm poseur to appear on the compute node and for the compute node to then
|
||||
# update the scheduler
|
||||
wait_for ssh_noprompt root@$BOOTSTRAP_IP grep \'record updated for\' /var/log/upstart/nova-compute.log
|
||||
wait_for 20 10 ssh_noprompt root@$BOOTSTRAP_IP grep \'record updated for\' /var/log/upstart/nova-compute.log -A 100 \| grep \'Updating host status\'
|
||||
|
||||
# I've tried all kinds of things to wait for before doing the nova boot and can't find a reliable combination,
|
||||
# I suspect I need to watch the scheduler and compute log to follow a chain of events,
|
||||
|
@ -38,4 +38,4 @@ sleep 67
|
|||
nova boot --flavor 256 --image base --key_name default bmtest
|
||||
|
||||
# ping the node TODO : make this more readable and output less errors
|
||||
wait_for ssh_noprompt root@$BOOTSTRAP_IP 'source ~/stackrc ; ping -c 1 $(nova list | grep ctlplane | sed -e "s/.*=\(.*\) .*/\1/g")'
|
||||
wait_for 20 10 ssh_noprompt root@$BOOTSTRAP_IP 'source ~/stackrc ; ping -c 1 $(nova list | grep ctlplane | sed -e "s/.*=\(.*\) .*/\1/g")'
|
||||
|
|
Loading…
Reference in New Issue