Kirill Omelchenko
2014-Sep-24 10:58 UTC
[libvirt-users] Copy VM in running-snapshoted state to another host
Hello! I want to create some kind of time machine script for a vm. E.g. I have a running vm on one host which I need to save the state of. So I save (*dumpxml) all data: VM, net, snapshot. Then archive all of it including vm's disk images. Then I put this archive to some other host and to restore the vm by importing all the data from xmls. So now I'm trying to do the above manually and stuck at the stage of revert. Steps of what I'm doing are the following: (on Host-1) 1. Create VM with next configuration: http://pastebin.com/bsfG5tFZ 2. Setup CentOS 6.5 3. Create snapshot of running VM using next command: $ virsh snapshot-create-as [vm-name] [snapshot-name] --memspec snapshot=internal 4. Backup VM xml: $ virsh dumpxml [vm-name] > [vm-name].xml 5. Backup VM snapshot xml: $ virsh snapshot-dumpxml [vm-name] [snapshot-name] > [snapshot-name].xml 6. Backup networks used by VM: $ virsh net-dumpxml [net-name] > [net-name].xml 7. Shutdown VM and Backup images used by VM. 8. Copy all backup data to Host-2 (on Host-2) 1. Restore networks: $ virsh net-define [net-name].xml $ virsh net-start [net-name] $ virsh net-autostart [net-name] 2. Restore images to appropriate directories. 3. Restore VM: $ virsh define [vm-name].xml 4. Restore snapshot: $ virsh snapshot-create --redefine [vm-name] [snapshot-name].xml 5. Revert snapshot: $ virsh snapshot-revert [vm-name] [snapshot-name] After revert snapshot is in running state, VM is in running state, BUT is in just started state and is booting. So what could be the root of the issue? Thank you in advance.