summaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-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