blob: 15a30942b98908c2e59e0a3e09253a4f408dd39a [file] [log] [blame]
David K. Bainbridge317e7d72016-05-11 08:31:44 -07001#!/bin/bash
2
Jonathan Hart93956f52017-08-22 13:12:42 -07003# 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. Bainbridge317e7d72016-05-11 08:31:44 -070017function 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
29for i in $(uvt-kvm list); do
30 virsh start $i
31done
32
33LIST=$(uvt-kvm list)
34CNT=$(uvt-kvm list | wc -l)
35# plus 4 for the switches
36
37RETRY=5
38VERIFIED=0
39while [ $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"
46done
47
48if [ $VERIFIED -ne 1 ]; then
49 echo "ERROR: Likely VMs did not all boot correctly"
50 exit 1
51else
52 echo "INFO: Looks like all VM started correctly"
53fi