I created a VM using vmbuilder but I realize that I had set some of the flags incorrectly. Now when I do a virsh list -all it still appears, laughing at my novicity. How do I delete this? (I've already deleted the corresponding xml and qcow2 files).
Asked
Active
Viewed 3.4k times
15
2 Answers
19
If you have already removed the disk image file, you can completely get rid of the VM with virsh undefine <domain-id>. You can also specify --managed-save to delete any managed save images and --snapshots-metadata to remove snapshots for the specified VM.
If the VM is in inactive state you should use its name or UUID instead of domain-id.
Vladimir Blaskov
- 6,373
0
First, you need to stop the VM:
virsh shutdown --domain guest_name to stop it gracefully.
virsh destroy --domain guest_name to force stop it.
Then you can remove it as Vladimir Blaskov indicates above:
virsh undefine --domain guest_name
or use virsh undefine --domain guest_name --remove-all-storage to remove the disk(s).
See also Virsh command to delete a VM – Let’s discuss in detail!.