David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | function 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 | |
| 15 | for i in $(uvt-kvm list); do |
| 16 | virsh start $i |
| 17 | done |
| 18 | |
| 19 | LIST=$(uvt-kvm list) |
| 20 | CNT=$(uvt-kvm list | wc -l) |
| 21 | # plus 4 for the switches |
| 22 | |
| 23 | RETRY=5 |
| 24 | VERIFIED=0 |
| 25 | while [ $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" |
| 32 | done |
| 33 | |
| 34 | if [ $VERIFIED -ne 1 ]; then |
| 35 | echo "ERROR: Likely VMs did not all boot correctly" |
| 36 | exit 1 |
| 37 | else |
| 38 | echo "INFO: Looks like all VM started correctly" |
| 39 | fi |