aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-09-14 15:05:26 +0800
committerbaigk <baiguoku@huawei.com>2015-09-15 09:45:52 +0800
commitb40d47e921a9af9685329ce8a4bfcdc2aa81af4a (patch)
tree171bb7b716b09d871d3cd9d0df7a206df168c9ab
parent86af3f1897f0cc9b1231e6cbd9e302f5daf3f64c (diff)
bug fix: prepare to install ipmitool and retry reset baremetal using ipmi
JIRA: COMPASS-50 Change-Id: Ib6525ef5fba6a56da1dde652f18afcdc9dfe15ad Signed-off-by: baigk <baiguoku@huawei.com>
-rwxr-xr-xdeploy/prepare.sh2
-rw-r--r--deploy/template/power/ipmitool.tmpl30
2 files changed, 29 insertions, 3 deletions
diff --git a/deploy/prepare.sh b/deploy/prepare.sh
index 67fc4b65..8a9ecef0 100755
--- a/deploy/prepare.sh
+++ b/deploy/prepare.sh
@@ -19,7 +19,7 @@ function download_iso()
function prepare_env() {
export PYTHONPATH=/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages
sudo apt-get update -y
- sudo apt-get install -y --force-yes mkisofs bc curl
+ sudo apt-get install -y --force-yes mkisofs bc curl ipmitool
sudo apt-get install -y --force-yes git python-pip python-dev
sudo apt-get install -y --force-yes libxslt-dev libxml2-dev libvirt-dev build-essential qemu-utils qemu-kvm libvirt-bin virtinst libmysqld-dev
sudo pip install --upgrade pip
diff --git a/deploy/template/power/ipmitool.tmpl b/deploy/template/power/ipmitool.tmpl
index a3157132..5d2630af 100644
--- a/deploy/template/power/ipmitool.tmpl
+++ b/deploy/template/power/ipmitool.tmpl
@@ -1,3 +1,4 @@
+source \${COMPASS_DIR}/util/log.sh
#set default_ipmiUser=$getVar('ipmiUser', '')
#set default_ipmiPass=$getVar('ipmiPass', '')
#set hosts=$getVar('hosts', [])
@@ -19,7 +20,32 @@ exit 1
#set ipmiIp=$host.get('ipmiIp', '')
#set ipmiUser=$host.get('ipmiUser', $default_ipmiUser)
#set ipmiPass=$host.get('ipmiPass', $default_ipmiPass)
-ipmitool -I lan -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis bootdev pxe
-ipmitool -I lan -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis power reset
+for i in {1..5}; do
+ if ipmitool -I lan -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis bootdev pxe >/dev/null 2>&1
+ then
+ break
+ elif [[ i -lt 5 ]]
+ then
+ sleep 1
+ else
+ log_error "set $ipmiIp pxe fail"
+ exit 1
+ fi
+done
+sleep 1
+for i in {1..5}; do
+ if ipmitool -I lan -H $ipmiIp -U $ipmiUser -P $ipmiPass chassis power reset >/dev/null 2>&1
+ then
+ break
+ elif [[ i -lt 5 ]]
+ then
+ sleep 1
+ else
+ log_error "reset $ipmiIp fail"
+ exit 1
+ fi
+done
+log_info "set pxe and reset $ipmiIp successsully"
+sleep 1
#end for
#end if