Domain Destruction
domain_destroy.sh
1 #!/bin/sh
2
3 NAME=""
4 LVM_GROUP="vg2"
5
6 if [ $# -gt 0 ]
7 then
8 NAME=${1}
9 fi
10 LVM_NAME="kvm_${NAME}_vda"
11
12 if [ -e /dev/${LVM_GROUP}/${LVM_NAME} ]
13 then
14 # destroy a running domain
15 virsh destroy ${NAME}
16 # undefine the domain
17 virsh undefine ${NAME}
18 # remove the volume
19 lvremove /dev/${LVM_GROUP}/${LVM_NAME}
20 else
21 echo "${0}: no such domain"
22 fi
Destroy the domain
./domain_destroy.sh clone