[libvirt-users] Virtual machine removal through command line.

Le Bris Gilles devops035 at gmail.com
Thu Dec 18 22:35:17 UTC 2014


Hi,

Until today, I hadn't found a way to cleanly remove a KVM virtual machine
through command line on CentOS 6 or 7! I had to run 'systemctl restart
libvirtd' or 'service libvirtd restart'

After several months (!!!), I found this thread:
https://github.com/pradels/vagrant-libvirt/issues/107

Now, I know how to cleanly remove a KVM virtual machine (with default file
location):
virsh destroy vm.example.com
virsh undefine vm.example.com --managed-save
/bin/rm /var/lib/libvirt/images/vm.example.com.img
/bin/rm /var/log/libvirt/qemu/vm.example.com.log
virsh vol-delete /var/lib/libvirt/images/vm.example.com.img --pool default

I don't know if the last command ('virsh vol-delete' avoiding the libvirtd
restart) is a bug or a feature but it must be documented! Only a libvirt
developer can guess something like this.

Feel free to change my instructions in any way you think it's better but at
least document this in a public place (http://wiki.libvirt.org for example).

Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20141218/46246761/attachment.htm>


More information about the libvirt-users mailing list