diff options
author | Zhijiang Hu <hu.zhijiang@zte.com.cn> | 2017-02-23 00:54:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-02-23 00:54:36 +0000 |
commit | cd585136acb636d6b13b173cf593c5f01c5f33a8 (patch) | |
tree | 3a1d2a4a61ccdd99433b923b9bca3d4f03908f28 /deploy/check_os_progress.sh | |
parent | f4a614caf60085929165a21f7c1bfe5d5f47fb09 (diff) | |
parent | 3b6f139b066fa61df852f480be3a583479c78eb6 (diff) |
Merge "Baremetal Deployment on zte-pod2 JIRA: DAISY-30"
Diffstat (limited to 'deploy/check_os_progress.sh')
-rwxr-xr-x | deploy/check_os_progress.sh | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/deploy/check_os_progress.sh b/deploy/check_os_progress.sh index bf44fe28..abbd7e5a 100755 --- a/deploy/check_os_progress.sh +++ b/deploy/check_os_progress.sh @@ -1,20 +1,62 @@ #!/bin/bash +usage() +{ + cat << EOF +USAGE: `basename $0` [-d deploy_env] [-n hosts_num] + +OPTIONS: + -d deploy environment of daisy(0:virtual or 1:baremetal) + -n target node numbers + +EXAMPLE: + sudo `basename $0` -d 1 -n 5 +EOF +} + +while getopts "d:n:h" OPTION +do + case $OPTION in + d) + deploy_env=${OPTARG} + ;; + n) + hosts_num=${OPTARG} + ;; + h) + usage + exit 0 + ;; + *) + echo "${OPTION} is not a valid argument" + usage + exit 0 + ;; + esac +done + source /root/daisyrc_admin cluster_id=`daisy cluster-list | awk -F "|" '{print $2}' | sed -n '4p'` -daisy install $cluster_id --skip-pxe-ipmi true +skip=false +if [ $deploy_env == 0 ];then + skip=true +fi + +echo "run daisy install command" +daisy install $cluster_id --skip-pxe-ipmi $skip + echo "check os installing progress..." while true; do os_install_active=`daisy host-list --cluster-id $cluster_id | awk -F "|" '{print $8}' | grep -c "active" ` os_install_failed=`daisy host-list --cluster-id $cluster_id | awk -F "|" '{print $8}' | grep -c "install-failed" ` - if [ $os_install_active -eq 1 ]; then + if [ $os_install_active -eq $hosts_num ]; then echo "os installing successful ..." break elif [ $os_install_failed -gt 0 ]; then echo "os installing have failed..." exit 1 else - progress=`daisy host-list --cluster-id $cluster_id |grep DISCOVERY_SUCCESSFUL |awk -F "|" '{print $7}'|sed s/[[:space:]]//g` - echo "os in installing, the progress is $progress%" + progress=`daisy host-list --cluster-id $cluster_id |grep DISCOVERY_SUCCESSFUL |awk -F "|" '{print $7}'|sed s/[[:space:]]//g|sed ':a;N;$ s/\n/ /g;ba'` + echo "os in installing, the progress of each node is $progress%" sleep 10 fi done |