summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-09-10 12:18:50 +0800
committerZhijiang Hu <hu.zhijiang@zte.com.cn>2017-09-10 12:18:50 +0800
commit923bd1535dd590754c33a6a8e2a664fd07eb4227 (patch)
tree1c35d3a06338e7b5a913d196356470535c8b0c20
parent4ccf28754c8581d093d31ef582af5ce1d18c6234 (diff)
get_mac_addresses_for_virtual() suppors all-in-one env
Change-Id: I6514292b16c784ced0dcb82d639fe10b425d63e2 Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
-rwxr-xr-xci/deploy/deploy.sh22
1 files changed, 16 insertions, 6 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh
index a104230d..22685e86 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -449,8 +449,19 @@ function get_mac_addresses_for_virtual()
tmpfile=$(mktemp XXXXXXXX.yml)
cp $DHA_CONF $tmpfile
- for ((i=0;i<${#VM_MULTINODE[@]};i++));do
- name=${VM_MULTINODE[$i]}
+ if [ $TARGET_HOSTS_NUM -ne 1 ]; then
+ for ((i=0;i<${#VM_MULTINODE[@]};i++));do
+ name=${VM_MULTINODE[$i]}
+ macs=$(virsh dumpxml $name | grep "<mac" | awk -F "'" '{print $2}' | tr "\n" " ")
+ line=$(awk "BEGIN{}(/name/&&/$name/){print NR}" $tmpfile)
+ sed -i "${line}a\ mac_addresses:" $tmpfile
+ for mac in $macs; do
+ line=$[ line + 1 ]
+ sed -i "${line}a\ - \'$mac\'" $tmpfile
+ done
+ done
+ else
+ name="all_in_one"
macs=$(virsh dumpxml $name | grep "<mac" | awk -F "'" '{print $2}' | tr "\n" " ")
line=$(awk "BEGIN{}(/name/&&/$name/){print NR}" $tmpfile)
sed -i "${line}a\ mac_addresses:" $tmpfile
@@ -458,7 +469,8 @@ function get_mac_addresses_for_virtual()
line=$[ line + 1 ]
sed -i "${line}a\ - \'$mac\'" $tmpfile
done
- done
+ fi
+
scp -q $tmpfile root@$DAISY_IP:$DHA
rm $tmpfile
}
@@ -484,9 +496,7 @@ if [ $IS_BARE == 0 ];then
done
fi
sleep 20
- if [ $TARGET_HOSTS_NUM -ne 1 ]; then
- get_mac_addresses_for_virtual
- fi
+ 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