summaryrefslogtreecommitdiffstats
path: root/compass
diff options
context:
space:
mode:
authorm00133142 <meimei@huawei.com>2015-06-26 10:40:48 +0800
committerm00133142 <meimei@huawei.com>2015-06-30 11:19:30 +0800
commitd8adc74c86610e7414555bb331e3a0de121a2e7b (patch)
tree6b1fba13622aa71ee5166a325494c6f1cc45f754 /compass
parent5e05469acdb8da55f8862677c7cd68d257c68501 (diff)
add a complete cleanup scripts for compass
JIRA: BGS-79 Change-Id: I9b7e3b5244056971b54b2ea9e0d0c9a9db31c47a Signed-off-by: m00133142 <meimei@huawei.com>
Diffstat (limited to 'compass')
-rwxr-xr-x[-rw-r--r--]compass/deploy/func.sh17
1 files changed, 10 insertions, 7 deletions
diff --git a/compass/deploy/func.sh b/compass/deploy/func.sh
index 29c2c23..49ea947 100644..100755
--- a/compass/deploy/func.sh
+++ b/compass/deploy/func.sh
@@ -1,19 +1,22 @@
function tear_down_machines() {
- virtmachines=$(virsh list --name |grep pxe)
+ virtmachines=$(sudo virsh list --name |grep pxe)
for virtmachine in $virtmachines; do
echo "destroy $virtmachine"
- virsh destroy $virtmachine
+ sudo virsh destroy $virtmachine
if [[ "$?" != "0" ]]; then
echo "destroy instance $virtmachine failed"
exit 1
fi
done
- virtmachines=$(virsh list --all --name |grep pxe)
- for virtmachine in $virtmachines; do
- echo "undefine $virtmachine"
- virsh undefine $virtmachine
+
+ sudo virsh list --all|grep shut|awk '{print $2}'|xargs -n 1 sudo virsh undefine
+
+ vol_names=$(sudo virsh vol-list default |grep .img | awk '{print $1}')
+ for vol_name in $vol_names; do
+ echo "virsh vol-delete $vol_name"
+ sudo virsh vol-delete $vol_name --pool default
if [[ "$?" != "0" ]]; then
- echo "undefine instance $virtmachine failed"
+ echo "vol-delete $vol_name failed!"
exit 1
fi
done