X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?p=genesis.git;a=blobdiff_plain;f=fuel%2Fprototypes%2Fauto-deploy%2Fexamples%2Flibvirt%2Ftools%2Fcleanup_example_vms.sh;fp=fuel%2Fprototypes%2Fauto-deploy%2Fexamples%2Flibvirt%2Ftools%2Fcleanup_example_vms.sh;h=0000000000000000000000000000000000000000;hp=960b21ea6de88012744e7624ab361fba44f5d51a;hb=e94d5484ecdf8021245d961479dae07ea2f8321f;hpb=563547b4a9f44090f32c0e17d040114854563760 diff --git a/fuel/prototypes/auto-deploy/examples/libvirt/tools/cleanup_example_vms.sh b/fuel/prototypes/auto-deploy/examples/libvirt/tools/cleanup_example_vms.sh deleted file mode 100755 index 960b21e..0000000 --- a/fuel/prototypes/auto-deploy/examples/libvirt/tools/cleanup_example_vms.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - - -error_exit () { - echo "$@" - exit 1 -} - -topdir=$(cd $(dirname $(readlink -f $BASH_SOURCE)); cd ..; pwd) -netdir=$topdir/conf/networks -vmdir=$topdir/conf/vms - -if [ ! -d $netdir ]; then - error_exit "No net directory $netdir" - exit 1 -elif [ ! -d $vmdir ]; then - error_exit "No VM directory $vmdir" - exit 1 -fi - - -if [ "`whoami`" != "root" ]; then - error_exit "You need be root to run this script" -fi - -for vm in $vmdir/* -do - vmname=`basename $vm` - virsh dumpxml $vmname >/dev/null 2>&1 - if [ $? -eq 0 ]; then - diskfile=`virsh dumpxml $vmname | grep "/dev/null - virsh undefine $vmname - rm -f $diskfile - fi -done - -for net in $netdir/* -do - netname=`basename $net` - virsh net-dumpxml $netname >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "Found net $netname, deleting" - virsh net-destroy $netname - virsh net-undefine $netname - fi -done