I’ve been playing about with virtual machines for a bit, using a mixture of CentOS 6.5 as the host, and Fedora on my laptop to set up the guests. I’ve been using virt-manager which is an easy tool. But oops this morning I created a virtual machine which I didn’t spell right. I don’t seem to be able to rename it virt-manager. Well it’s not that simple, but once you know how, it’s not that hard at all.
- Shutdown the machine you want to rename
virsh shutdown machine1 or virsh destroy machine1
- Use virsh dump to dump the virtual machines xml to the new name
virsh dump machine1 > machine2.xml
- The xml files are in the location /etc/libvirt/qemu, so edit /etc/libvirt/qemu/machine2.xml
- Find this
<domain type='kvm'> <name>machine1</name
- Replace machine1 with machine2, save the file.
- Undefine the old machine
virsh undefine machine1
- Now you can define the new machine and boot it
virsh define machine2.xml