Code Review
/
icn.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix go error in package_prerequisite step
[icn.git]
/
deploy
/
metal3-vm
/
04_verify.sh
diff --git
a/deploy/metal3-vm/04_verify.sh
b/deploy/metal3-vm/04_verify.sh
index
65301b5
..
70fbf22
100755
(executable)
--- a/
deploy/metal3-vm/04_verify.sh
+++ b/
deploy/metal3-vm/04_verify.sh
@@
-1,46
+1,27
@@
#!/usr/bin/env bash
#!/usr/bin/env bash
-
-set -x
+set -eu -o pipefail
# shellcheck disable=SC1091
source lib/common.sh
# shellcheck disable=SC1091
source lib/common.sh
-node=0
declare -i timeout=30
declare -i interval=60
declare -i timeout=30
declare -i interval=60
-function check_num_hosts {
- while read -r name address user password mac; do
- ((node+=1))
- done
- return $node
-}
-
-function check_bm_state {
- c=1
- n=$1
- while [ $c -le $n ]
- do
- echo "Welcone $c times"
- (( c++ ))
- done
-}
-
function check_provisioned {
declare -i prev_host_state=0
declare -i j=0
function check_provisioned {
declare -i prev_host_state=0
declare -i j=0
- while read -r name address user password mac; do
+ echo "VM state: 1 means provisioned & 0 means not yet provisioned"
+ while IFS=',' read -r name address user password mac; do
declare -i current_host_state=0
state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state')
declare -i current_host_state=0
state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state')
- echo
$name":
"$state
+ echo
"VM host metal3 state - "$name" :
"$state
if [ $state == "provisioned" ];then
current_host_state=1
fi
if [ $state == "provisioned" ];then
current_host_state=1
fi
- echo "j:"$j
- echo "current_host_state":$current_host_state
- echo "prev_host_state":$prev_host_state
+ echo "VM $name current_host_state : "$current_host_state
+ echo "VMs prev_host_state : "$prev_host_state
if [ $j -eq 0 ]; then
prev_host_state=$current_host_state
if [ $j -eq 0 ]; then
prev_host_state=$current_host_state
@@
-54,32
+35,35
@@
function check_provisioned {
prev_host_state=0
fi
prev_host_state=0
fi
- echo "
after:
prev_host_state:"$prev_host_state
+ echo "
All VM hosts aggregated state -
prev_host_state:"$prev_host_state
((j+=1))
done
return $prev_host_state
}
((j+=1))
done
return $prev_host_state
}
+function warm_up_time {
+ echo "Wait for 75s for all VM to reboot and network is up"
+ sleep 75
+}
+
function wait_for_provisioned {
function wait_for_provisioned {
- all_bmh_provisioned=1
- while ((timeout > 0)); do
- echo "Try $timeout: Wait for $interval seconds to check all bmh state"
+ declare -i k=1
+ declare -i t=$timeout
+ while ((t > 0)); do
+ echo "Try $k/$timeout iteration : Wait for $interval seconds to check all bmh state"
sleep $interval
sleep $interval
- list_nodes | check_provisioned
- all_bmh_state=$?
- if [[ $all_bmh_state -eq $all_bmh_provisioned ]]; then
- echo "All the bmh state is provisioned - vsuccess"
+ if ! list_nodes | check_provisioned; then
+ echo "All the VMs are provisioned - success"
+ warm_up_time
exit 0
fi
exit 0
fi
- ((timeout-=1))
+ ((t-=1))
+ ((k+=1))
done
exit 1
}
function verify_bm_hosts {
done
exit 1
}
function verify_bm_hosts {
- #list_nodes | check_num_hosts
- #nodes=$?
- #check_bm_state $nodes
wait_for_provisioned
}
wait_for_provisioned
}