summaryrefslogtreecommitdiffstats
path: root/ci/deploy
diff options
context:
space:
mode:
authorAlex Yang <yangyang1@zte.com.cn>2017-08-02 20:26:50 +0800
committerAlex Yang <yangyang1@zte.com.cn>2017-08-02 23:49:16 +0800
commite1267f7064473d66ebc570e47788420cbe1da8ca (patch)
tree607bcfca16c7ed4440f3828581a8b98101999a05 /ci/deploy
parentc91f763177b26dc05be4ccc8536f4cd76296d983 (diff)
Eliminate error logs in virtual deployment
There are some error messages in virtual deployment, such as "Domain not found" or "network is already active". The script forgets to destroy the keep-alived network, and should not destroy a non-existent VM or network. Change-Id: I8d9dce9d70f732bd6942b293e407e1845d81fc39 Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
Diffstat (limited to 'ci/deploy')
-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 8dbda717..ca4f3373 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -267,25 +267,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