⇤ ← Revision 1 as of 2017-11-11 22:22:49
539
Comment:
|
555
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
`domain_destouy.sh` | `domain_destroy.sh` |
Line 5: | Line 5: |
{{{ | {{{#!highlight bash |
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 # destrouy 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