summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Yang <yangyang1@zte.com.cn>2017-09-11 19:40:00 +0800
committerAlex Yang <yangyang1@zte.com.cn>2017-09-12 09:33:58 +0800
commit94d3957c5aba2db70d06929ac9538280a71c6641 (patch)
tree8d28637ed8d6d53fb517498c8ef358eaeca586bf
parent923bd1535dd590754c33a6a8e2a664fd07eb4227 (diff)
Eliminate hard code about ipmi info in bash script
Change-Id: I642d130566137dff727b7227658afe6ace9473d6 Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
-rwxr-xr-xci/deploy/deploy.sh30
-rw-r--r--deploy/config/bm_environment/zte-baremetal1/deploy.yml61
2 files changed, 64 insertions, 27 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh
index 22685e86..b73c80f9 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -476,6 +476,31 @@ function get_mac_addresses_for_virtual()
}
+function reboot_baremetal_node()
+{
+ ips=(`grep ipmi_ip $DHA_CONF | awk '{print $2}' | tr "\n" " " | tr -d "\'"`)
+ ip_num=${#ips[@]}
+ users=(`grep ipmi_user $DHA_CONF | awk '{print $2}' | tr "\n" " " | tr -d "\'"`)
+ user_num=${#users[@]}
+ passwds=(`grep ipmi_pass $DHA_CONF | awk '{print $2}' | tr "\n" " " | tr -d "\'"`)
+ pass_num=${#passwds[@]}
+
+ if [ $ip_num -ne $TARGET_HOSTS_NUM ]; then
+ echo "ERROR: IPMI information should be provided for each node !"
+ exit 1
+ fi
+
+ for ((i=0; i<$ip_num; i++)); do
+ if [ $TARGET_HOSTS_NUM -eq $user_num ] && [ $TARGET_HOSTS_NUM -eq $pass_num ]; then
+ ipmitool -I lanplus -H ${ips[$i]} -U ${users[$i]} -P ${passwds[$i]} -R 1 chassis bootdev pxe
+ ipmitool -I lanplus -H ${ips[$i]} -U ${users[$i]} -P ${passwds[$i]} -R 1 chassis power reset
+ else
+ ipmitool -I lanplus -H ${ips[$i]} -R 1 chassis bootdev pxe
+ ipmitool -I lanplus -H ${ips[$i]} -R 1 chassis power reset
+ fi
+ done
+}
+
echo "====== create and find node ======"
if [ $IS_BARE == 0 ];then
if [ $TARGET_HOSTS_NUM == 1 ];then
@@ -498,10 +523,7 @@ if [ $IS_BARE == 0 ];then
sleep 20
get_mac_addresses_for_virtual
else
- for i in $(seq 106 110); do
- ipmitool -I lanplus -H 192.168.1.$i -U zteroot -P superuser -R 1 chassis bootdev pxe
- ipmitool -I lanplus -H 192.168.1.$i -U zteroot -P superuser -R 1 chassis power reset
- done
+ reboot_baremetal_node
fi
echo "====== prepare host and pxe ======"
diff --git a/deploy/config/bm_environment/zte-baremetal1/deploy.yml b/deploy/config/bm_environment/zte-baremetal1/deploy.yml
index d24a9569..0c147280 100644
--- a/deploy/config/bm_environment/zte-baremetal1/deploy.yml
+++ b/deploy/config/bm_environment/zte-baremetal1/deploy.yml
@@ -1,23 +1,38 @@
-adapter: ipmi
-hosts:
-- name: 'controller01'
- roles:
- - 'CONTROLLER_LB'
-- name: 'controller02'
- roles:
- - 'CONTROLLER_LB'
-- name: 'controller03'
- roles:
- - 'CONTROLLER_LB'
-- name: 'computer01'
- roles:
- - 'COMPUTER'
-- name: 'computer02'
- roles:
- - 'COMPUTER'
-disks:
- daisy: 50
-daisy_passwd: 'r00tme'
-daisy_ip: '10.20.7.3'
-daisy_gateway: '10.20.7.1'
-ceph_disk_name: '/dev/sdb'
+adapter: 'ipmi'
+hosts:
+- name: 'controller01'
+ roles:
+ - 'CONTROLLER_LB'
+ ipmi_ip: '192.168.1.106'
+ ipmi_user: 'testuser'
+ ipmi_pass: 'testpass'
+- name: 'controller02'
+ roles:
+ - 'CONTROLLER_LB'
+ ipmi_ip: '192.168.1.107'
+ ipmi_user: 'testuser'
+ ipmi_pass: 'testpass'
+- name: 'controller03'
+ roles:
+ - 'CONTROLLER_LB'
+ ipmi_ip: '192.168.1.108'
+ ipmi_user: 'testuser'
+ ipmi_pass: 'testpass'
+- name: 'computer01'
+ roles:
+ - 'COMPUTER'
+ ipmi_ip: '192.168.1.109'
+ ipmi_user: 'testuser'
+ ipmi_pass: 'testpass'
+- name: 'computer02'
+ roles:
+ - 'COMPUTER'
+ ipmi_ip: '192.168.1.110'
+ ipmi_user: 'testuser'
+ ipmi_pass: 'testpass'
+disks:
+ daisy: 50
+daisy_passwd: 'r00tme'
+daisy_ip: '10.20.7.3'
+daisy_gateway: '10.20.7.1'
+ceph_disk_name: '/dev/sdb'