diff options
author | Frank Brockners <fbrockne@cisco.com> | 2015-06-30 15:34:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-06-30 15:34:52 +0000 |
commit | bf5b9331cd860d0622d4eeab3093e8dced15188e (patch) | |
tree | 925cc044b901ca914cfa819068ff703dde8398bf /compass | |
parent | 7f1e323ebe159eac155f753a7c11be616e353698 (diff) | |
parent | d8adc74c86610e7414555bb331e3a0de121a2e7b (diff) |
Merge "add a complete cleanup scripts for compass"
Diffstat (limited to 'compass')
-rwxr-xr-x[-rw-r--r--] | compass/deploy/func.sh | 17 |
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 |