4 LIBDIR="$(dirname "$(dirname "$(dirname "$PWD")")")"
8 source $LIBDIR/env/lib/common.sh
11 declare -i interval=60
13 function check_provisioned {
14 declare -i prev_host_state=0
16 echo "Baremetal state: 1 means provisioned & 0 means not yet provisioned"
17 while read -r name username password address; do
18 declare -i current_host_state=0
19 state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state')
20 echo "Baremetal host metal3 state - "$name" : "$state
22 if [ $state == "provisioned" ];then
26 echo "Baremetal $name current_host_state : "$current_host_state
27 echo "Previous Baremetals prev_host_state : "$prev_host_state
30 prev_host_state=$current_host_state
35 if [ $current_host_state -eq 1 ] && [ $prev_host_state -eq 1 ]; then
41 echo "All Baremetal hosts aggregated state - prev_host_state:"$prev_host_state
44 return $prev_host_state
47 function warm_up_time {
48 echo "Wait for 240s for all baremetal hosts to reboot and network is up"
52 function wait_for_provisioned {
55 while ((timeout > 0)); do
56 echo "Try $k iteration : Wait for $interval seconds to check all bmh state"
58 list_nodes | check_provisioned
60 if [[ $all_bmh_state -eq $all_bmh_provisioned ]]; then
61 echo "All the Baremetal hosts are provisioned - success"
71 function verify_bm_hosts {