[libvirt] [PATCH 0/3] [PoC] snapshot += xml

Philipp Hahn hahn at univention.de
Tue Apr 12 06:27:47 UTC 2011


Hello,

this is just a proof-of-concept implementation for storing the domain xml
description with the xml snapshot data. This is needed for Qemu, since
restoring a Qemu domain after changing the "virtual hardware" (like changing
RAM size, number of CPUs, controllers) is not possible: The "loadvm" command
will fail to restore the saved state.

My idea was to save the domain XML data with the snapshot XML data, which
currently just contains a reference to the domain UUID. On snapshot-restore
that domain description is restored to overwrites the current domain
description.

I descided to store a reference to the parsed domainObj with the
domainSnapshotObj, since my goal was to detect on revert, if resuing the
currently running Qemu process is possible, or the the process needs to be
restartet with different arguments to revert changes to the "virtual
hardware". I hadn't had time to implement this yet, so currently the Qemu
process is restarted on every revert, which disconnects any VNC session and
is also a lot slower then simply calling "loadvm".
For this implementation I needed to pass "virCapsPtr" down to
virDomainSnapshotDefParseString(). I only implemented that correctly for
Qemu, so vbox and esx might be broken currently.

An alternative (and simpler) implementation would be to just store the
unparsed XML description with the runtime domainSnapshotObj. This would
simplify copying the domain description, but would complicate detecting
if "loadvm" is possible or Qemu must be restarted.

The implementation currently works very well for me, but I noticed some memory
leak, which might be related to this patch (or some other, since my version
of libvirt contains several other patches as well).

Philipp Hahn (3):
  Swap virDomain / virFomainSnapshot declaration
  snapshot: save domain description with snapshot
  Snapshot: restore domain description from snapshot

 src/conf/domain_conf.c |   27 +++++++++++--
 src/conf/domain_conf.h |  102 ++++++++++++++++++++++++-----------------------
 src/esx/esx_driver.c   |    2 +-
 src/qemu/qemu_driver.c |   43 +++++++++++++++++++-
 src/vbox/vbox_tmpl.c   |    2 +-
 5 files changed, 117 insertions(+), 59 deletions(-)




More information about the libvir-list mailing list