1. View all KVM virtual machines
2. Renaming a KVM virtual machine is best to shut down the virtual machine before exporting its XML file
[[Email PROTECTED]_KVM ~]# cd/etc/libvirt/qemu[[email protected]_kvm qemu]# virsh dumpxml > Kvm_00.xml
3, in order to let the renamed virtual machine name and disk file name consistent, we can first name the previous disk file to Kvm_00.img
[Email PROTECTED]_KVM ~]# cd/var/lib/libvirt/mv kvm_client00.img kvm_00.img // Renaming a virtual machine disk file name
4. edit Kvm_00.xml file, modify <name> tag pair and disk File , here we change the disk file into kvm_00.img
<domain type='KVM'> <name>kvm_00</name> ...... ... The omission of .....<disk type='file'Device='Disk'> <driver name='Qemu'Type='Raw'Cache='None'/> <sourcefile='/var/lib/libvirt/images/kvm_00.img'/>
5. Use the Virsh undefine command to delete the previous virtual machine and define a new KVM virtual machine based on the new XML file
[[Email PROTECTED]_KVM ~]# virsh undefine kvm_client00 // Delete kvm_client00 virtual machine [email protected]_ KVM ~]# virsh define/etc/libvirt/qemukvm_00.xml // redefine a new KVM virtual machine
6. Finally we can use the Virsh List--all command again to view the results as follows:
The KVM machine, renamed as above, can be started directly, without affecting the files of the Udev dynamic management device. Compared to the previous virtual machine, just the name changed.
Respect for the work of others reproduced please be sure to indicate the source: http://www.cnblogs.com/5201351/p/4464350.html
Renaming a KVM virtual machine