On 02/01/2013 12:13 AM, Jonghee Youn wrote:
Currently, I've tried to move qemu VM image to a new computer.
So, I copied VM image files in /var/lib/libvirt/images,
This part is fine.
VM xml files in
/etc/libvirt/qemu, VM snapshot files in /var/lib/libvirt/qemu/snapshot to
the same places at the new computer.
That is not the recommended way to do things - it _might_ work if you
are using the same version of libvirt on both computers, and libvirtd is
_not_ running on the destination. However, the _preferred_ method, and
the only way that is guaranteed to work if libvirtd is newer on the
destination than on the source, or if libvirtd is already running on the
destination, is to use various 'virsh *dumpxml' commands on the source
followed by 'virsh *define' on the destination.
Everything is OK except snapshot!!
When I use "qemu-img info" for the copied VM image, I can see the snapshot
list in the result as shown below:
root@doc-scheduler:/var/lib/libvirt/images# qemu-img info VM22.img
image: VM22.img
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 1.7G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 VM22_A 228M 2013-01-31 10:06:45 00:06:38.110
But, when I use "virsh snapshot-list " for the copied VM, the result is
empty as follows:
root@doc-scheduler:~# virsh snapshot-list VM22
Name Creation Time State
------------------------------------------------------------
and of course, I can't revert to the snapshot.
Please let me know how I can copy my snapshots to the new machine.
Do 'virsh snapshot-list $dom --tree' on the source. Then, for each
snapshot in the list in tree order, do 'virsh snapshot-dumpxml $dom
$name --security-info > file' on the source, then 'virsh snapshot-create
$dom file --redefine' on the destination. If you also want to preserve
which snapshot is current, use 'virsh snapshot-current $dom --name' on
the source, the use the --current flag when re-creating that particular
name on the destination.
Someday, I'd like to make it easier to do domain migration, including
snapshots, all from a single virsh command, but we aren't quite there yet.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org