blob: ef14e5ff41c8b416a8a1273f9c3090d1484e4d91 [file] [log] [blame]
David K. Bainbridge317e7d72016-05-11 08:31:44 -07001#!/bin/bash
2
3function verify {
4 local L=$1
5 for i in $L; do
6 grep $i /etc/bind/maas/dhcp_harvest.inc > /dev/null 2>&1
7 if [ $? -ne 0 ]; then
8 echo "0"
9 return
10 fi
11 done
12 echo "1"
13}
14
15for i in $(uvt-kvm list); do
16 virsh start $i
17done
18
19LIST=$(uvt-kvm list)
20CNT=$(uvt-kvm list | wc -l)
21# plus 4 for the switches
22
23RETRY=5
24VERIFIED=0
25while [ $VERIFIED -ne 1 -a $RETRY -gt 0 ]; do
26 echo "INFO: Waiting for VMs to start"
27 sleep 5
28 curl -slL -XPOST http://127.0.0.1:8954/harvest >> /dev/null
29 VERIFIED=$(verify $LIST)
30 RETRY=$(expr $RETRY - 1)
31 echo "INFO: Verifing all VMs started"
32done
33
34if [ $VERIFIED -ne 1 ]; then
35 echo "ERROR: Likely VMs did not all boot correctly"
36 exit 1
37else
38 echo "INFO: Looks like all VM started correctly"
39fi