diff options
-rwxr-xr-x | ci/deploy/deploy.sh | 22 |
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 |