Re: [libvirt-users] Defining VM with snapshots?

Eric Blake
Wed, 28 Aug 2013 01:57:43 -0000

On 08/27/2013 08:47 AM, Skardal, Harald wrote:
> All,
>
> Using Centos 6.4 with provided libvirt:
> [root@node1 ~]# rpm -q libvirt
> libvirt-1.0.1-2.el6.x86_64
>
>
> Assume a VM with one or more live snapshots.
> In virsh the VM snapshots can be listed.
>
> With virsh:
>
>
> -          Stop and undefine this VM.
>
> -          Then define (and start) this VM.
>
> The new VM does not have the list of snapshots.
>
> Is there a way with virsh to rebuild the metadata such that libvirt
"knows" about the snapshots in the "disk stack"?

If you saved off the snapshot XML ('virsh snapshot-dumpxml $dom $name'
for each name in 'virsh snapshot-list $dom', and paying attention to
which one (if any) was the current snapshot with 'virsh snapshot-current
--name $dom'), then recreating that stack can be done with 'virsh
snapshot-create --redefine $dom $file [--current]' for each file of your
saved stack.

When it comes to migrating a domain with snapshots, this process of
defining the snapshots manually on the destination then undefining them
on the source, is still the only currently supported way (as actually
migrating snapshots requires a change to the RPC protocol used to drive
migration, as it requires passing potentially large amounts of data that
will not fit in a single migration cookie).

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org