I created a KVM guest from the command line with virt-install
where I used the command line options --disk pool=vg0,size=20
and --name virt1.example.com
.
How can I delete this KVM guest from the command line? I don't need it anymore.
Just for the record the whole command line was
virt-install --debug --hvm --vnc --name virt1.example.com --os-type=linux --os-variant=rhel6 --pxe --network network=default,model=e1000,mac=02:54:00:13:be:e4 --disk pool=vg0,size=20 --ram 1024 --vcpus=1
and here is some extra information
[root@server ~]# virsh vol-list vg0
Name Path
-----------------------------------------
lv0 /dev/vg0/lv0
lv_swap /dev/vg0/lv_swap
virt1.example.com.img /dev/vg0/virt1.example.com.img
[root@server ~]# virsh list
Id Name State
----------------------------------
3 virt1.example.com running
Update
Running these three commands seems to remove the installed KVM
virsh destroy virt1.example.com
virsh undefine virt1.example.com
virsh vol-delete --pool vg0 virt1.example.com.img
For more details see the terminal session:
[root@server ~]# virsh list --all
Id Name State
----------------------------------
3 virt1.example.com running
[root@server ~]# virsh undefine virt1.example.com
error: Failed to undefine domain virt1.example.com
error: Requested operation is not valid: cannot delete active domain
[root@server ~]# virsh destroy virt1.example.com
Domain virt1.example.com destroyed
[root@server ~]# virsh list --all
Id Name State
----------------------------------
- virt1.example.com shut off
[root@server ~]# virsh undefine virt1.example.com
Domain virt1.example.com has been undefined
[root@server ~]# virsh list --all
Id Name State
----------------------------------
[root@server ~]# virsh vol-list --pool vg0
Name Path
-----------------------------------------
lv0 /dev/vg0/lv0
lv_swap /dev/vg0/lv_swap
virt1.example.com.img /dev/vg0/virt1.example.com.img
[root@server ~]# virsh vol-delete --pool vg0 virt1.example.com.img
Vol virt1.example.com.img deleted
[root@server ~]# virsh vol-list --pool vg0
Name Path
-----------------------------------------
lv0 /dev/vg0/lv0
lv_swap /dev/vg0/lv_swap
[root@server ~]# cat /etc/issue
CentOS Linux release 6.0 (Final)
Kernel \r on an \m
[root@server ~]# virsh --version
0.8.1