summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorAlex Yang <yangyang1@zte.com.cn>2017-07-29 20:29:52 +0800
committerAlex Yang <yangyang1@zte.com.cn>2017-07-31 15:35:11 +0800
commitb35baf61e48a1d2aff88e7c3e100aa996422d849 (patch)
treeded0fe80802a336d1729f607baadac9a90e3b5e5 /ci
parente47fc2d62d07633c1883253d42f8e2cade35e868 (diff)
Correct the mapping of nodes and roles in virtual deploy
JIRA: DAISY-56 Now the roles are assigned to nodes randomly, because the function 'add_hosts_interface' in tempest.py just uses zip to map the host's name to the host. libvirt_utils.py: get mac addresses from VM environment.py: save the mac addresses daisy_server.py: write a new deploy.yml which contains the mac addresses and copy the file to daisy server get_conf.py: get mac addresses from the new deploy.yml tempest.py: assigned roles to nodes when the mac addresses matched controller.xml: increase the RAM to make difference with computer nodes deploy.sh: apply this change to bash script Change-Id: Ia61b60d39d319c5d01e3505727fafc63a0585858 Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
Diffstat (limited to 'ci')
-rwxr-xr-xci/deploy/deploy.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh
index bb6418df..0abc4e25 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -330,6 +330,27 @@ ssh $SSH_PARAS $DAISY_IP "bash $REMOTE_SPACE/deploy/prepare.sh -n $NETWORK -b $I
echo "====== prepare cluster and pxe ======"
ssh $SSH_PARAS $DAISY_IP "python ${REMOTE_SPACE}/deploy/tempest.py --dha $DHA --network $NETWORK --cluster 'yes'"
+
+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]}
+ macs=$(virsh dumpxml $name | grep "<mac" | awk -F "'" '{print $2}' | tr "\n" " ")
+ line=$(awk "BEGIN{}(/name/&&/controller01/){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
+ scp -q $tmpfile root@$DAISY_IP:$DHA
+ rm $tmpfile
+}
+
+
echo "====== create and find node ======"
if [ $IS_BARE == 0 ];then
if [ $TARGET_HOSTS_NUM == 1 ];then
@@ -350,6 +371,9 @@ if [ $IS_BARE == 0 ];then
done
fi
sleep 20
+ if [ $TARGET_HOSTS_NUM -ne 1 ]; then
+ get_mac_addresses_for_virtual
+ fi
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