David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Jonathan Hart | 93956f5 | 2017-08-22 13:12:42 -0700 | [diff] [blame^] | 3 | # Copyright 2017-present Open Networking Foundation |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 17 | function verify { |
| 18 | local L=$1 |
| 19 | for i in $L; do |
| 20 | grep $i /etc/bind/maas/dhcp_harvest.inc > /dev/null 2>&1 |
| 21 | if [ $? -ne 0 ]; then |
| 22 | echo "0" |
| 23 | return |
| 24 | fi |
| 25 | done |
| 26 | echo "1" |
| 27 | } |
| 28 | |
| 29 | for i in $(uvt-kvm list); do |
| 30 | virsh start $i |
| 31 | done |
| 32 | |
| 33 | LIST=$(uvt-kvm list) |
| 34 | CNT=$(uvt-kvm list | wc -l) |
| 35 | # plus 4 for the switches |
| 36 | |
| 37 | RETRY=5 |
| 38 | VERIFIED=0 |
| 39 | while [ $VERIFIED -ne 1 -a $RETRY -gt 0 ]; do |
| 40 | echo "INFO: Waiting for VMs to start" |
| 41 | sleep 5 |
| 42 | curl -slL -XPOST http://127.0.0.1:8954/harvest >> /dev/null |
| 43 | VERIFIED=$(verify $LIST) |
| 44 | RETRY=$(expr $RETRY - 1) |
| 45 | echo "INFO: Verifing all VMs started" |
| 46 | done |
| 47 | |
| 48 | if [ $VERIFIED -ne 1 ]; then |
| 49 | echo "ERROR: Likely VMs did not all boot correctly" |
| 50 | exit 1 |
| 51 | else |
| 52 | echo "INFO: Looks like all VM started correctly" |
| 53 | fi |