Hello,
Below is the steps to rename a kvm virtual machine.
1)Shutdown the Virtual machine first
virsh shutdown test1
or
virsh destroy test1
2) I just want to rename the virtual machine to test2
first dump the xml file of the old virtual machine which needs to be renamed
virsh dumpxml test1 > test2.xml
Then it will dump the xml file of test1 to test2.xml
The xml files are in the location /etc/libvirt/qemu
3)Then edit the file test2.xml using vi command line
vi /etc/libvirt/qemu/test2.xml
find the below two lines in the file
<domain type='kvm'>
<name>test1</name>
replace the test1 with test2(new name)
Then save it and exit
4)Then undefine the older virtual machine using the command
virsh undefine test1
5)Define the new one using the command
virsh define /etc/libvirt/qemu/test2.xml
New renamed vm will start now.
regards
Syamkumar.M
Below is the steps to rename a kvm virtual machine.
1)Shutdown the Virtual machine first
virsh shutdown test1
or
virsh destroy test1
2) I just want to rename the virtual machine to test2
first dump the xml file of the old virtual machine which needs to be renamed
virsh dumpxml test1 > test2.xml
Then it will dump the xml file of test1 to test2.xml
The xml files are in the location /etc/libvirt/qemu
3)Then edit the file test2.xml using vi command line
vi /etc/libvirt/qemu/test2.xml
find the below two lines in the file
<domain type='kvm'>
<name>test1</name>
replace the test1 with test2(new name)
Then save it and exit
4)Then undefine the older virtual machine using the command
virsh undefine test1
5)Define the new one using the command
virsh define /etc/libvirt/qemu/test2.xml
New renamed vm will start now.
regards
Syamkumar.M
error: Requested operation is not valid: domain is not running
ReplyDeleteNice procedure, thanks. I just used it to rename one of my KVM domains with no issues. The only additional thing that I had to do was to do a "virsh start new-domain".
ReplyDelete