[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]