[virt-tools-list] Creating memory file on disk

Eric Blake eblake at redhat.com
Thu Nov 17 14:06:21 UTC 2011


On 11/17/2011 04:58 AM, Echo6 wrote:
> Hi!
> 
> I have a need to store a copy of the virtual machines memory in a file on disk, ideally during a snapshot or pause.

'virsh save' stores a copy of virtual machine memory in a file on disk,
in a manner that 'virsh store' can then use to resume the guest.
However, that file format is one used by qemu migration, and not
necessarily a direct map of the memory as used by the guest.

Similarly, 'virsh snapshot' can create an internal snapshot into a qcow2
image, but I'm not sure if the qemu-img tool provides enough smarts to
analyze that internal snapshot in a manner in which you can recreate
guest memory state from that point in time.

There is also the virDomainMemoryPeek API which lets you directly snoop
the contents of guest RAM; if the guest is paused, then you can use this
API to incrementally recreate the entire state of guest RAM (for
implementation reasons, this should never peek at more than 64k at a
time).  However, this API is not currently exposed via 'virsh' (patches
welcome); you'd have to write your own C program, or use python, perl,
ruby, or other language bindings to get at it.

> 
> According to the qemu manpage, this may be possible using -mem-path options
> 
> -mem-path path
>            Allocate guest RAM from a temporarily created file in path.
> 
> Is it possible to enable this option using virt-manager? I assume it is, but how?

virt-manager does not expose this; in fact, libvirt does not use the
-mem-path argument for any of the currently defined XML for a domain.
If you have ideas on how to add that to the libvirt XML, propose them on
libvir-list at redhat.com; libvirt has to provide it before virt-manager
can expose it.

In the meantime, libvirt does let you add arbitrary qemu commandline
arguments, using the <qemu:commandline> XML; this would allow you to
manually add -mem-path for experimentation purposes, but it is
unsupported and might not work, so try it out on something you don't
mind accidentally trashing.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20111117/46f143db/attachment.sig>


More information about the virt-tools-list mailing list