summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-08-03 03:25:34 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-03 03:25:34 +0000
commite17dc35e2e445a7b7d52398a55d196cca8a680b3 (patch)
treeb4e662460ad336c46c758c189fe3fc190eac01fb /ci
parent989c92844cf3bc1a1f357277e1f90b72521ce731 (diff)
parente1267f7064473d66ebc570e47788420cbe1da8ca (diff)
Merge "Eliminate error logs in virtual deployment"
Diffstat (limited to 'ci')
-rwxr-xr-xci/deploy/deploy.sh32
1 files changed, 19 insertions, 13 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh
index e4a3851b..bfe0f6fa 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -274,25 +274,31 @@ function update_config
fi
}
-function clean_up
+function clean_up_virtual_env()
{
- local vm_name=$1
- local network_name=$2
+ local vms=$(virsh list --all | tail -n +3 | awk '{print $2}')
+ local active_vms=$(virsh list | tail -n +3 | awk '{print $2}')
+ for vm_name in ${VM_MULTINODE[@]} all_in_one daisy; do
+ if [[ $(echo $vms | tr " " "\n" | grep ^$vm_name$) ]]; then
+ [[ $(echo $active_vms | tr " " "\n" | grep ^$vm_name$) ]] && virsh destroy $vm_name
+ virsh undefine $vm_name
+ fi
+ done
- virsh destroy $vm_name
- virsh undefine $vm_name
- virsh net-destroy $network_name
- virsh net-undefine $network_name
+ local nets=$(virsh net-list --all | tail -n +3 |awk '{print $1}')
+ local active_nets=$(virsh net-list | tail -n +3 |awk '{print $1}')
+ for net_template in ${VMDELOY_DAISY_SERVER_NET} ${VMDEPLOY_TARGET_NODE_NET} ${VMDEPLOY_TARGET_KEEPALIVED_NET}; do
+ network_name=$(grep "<name>" $net_template | awk -F "<|>" '{print $3}')
+ if [[ $(echo $nets | tr " " "\n" | grep ^$network_name$) ]]; then
+ [[ $(echo $active_nets | tr " " "\n" | grep ^$network_name$) ]] && virsh net-destroy $network_name
+ virsh net-undefine $network_name
+ fi
+ done
}
echo "====== clean up all node and network ======"
if [ $IS_BARE == 0 ];then
- clean_up all_in_one daisy2
- for ((i=0;i<${#VM_MULTINODE[@]};i++));do
- virsh destroy ${VM_MULTINODE[$i]}
- virsh undefine ${VM_MULTINODE[$i]}
- done
- clean_up daisy daisy1
+ clean_up_virtual_env
else
virsh destroy daisy
virsh undefine daisy