While looking at my work on incremental backups, Nir raised a good
point: if we want to recreate a set of known checkpoints on one
machine that will be taking over a domain from another machine,
my initial proposal required making multiple API calls to list the
XML for each checkpoint on the source, and then more API calls to
redefine each checkpoint on the destination; it also had the drawback
that the list has to be presented in topological order (the API won't
let you define a child checkpoint if the parent is not defined first).
He asked if I could instead add bulk APIs, for getting the XML for
all checkpoints at once, and then for redefining all checkpoints at
once.
Since my checkpoint code borrows heavily from concepts in the snapshot
code, I chose to tackle the problem by starting with this series, which
does the same thing for snapshots as what I plan to do for checkpoints.
That is, since this patch series adds virDomainGetXMLDesc(,
VIR_DOMAIN_XML_SNAPSHOTS) and virDomainSnapshotCreateXML(,
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE_LIST), the checkpoint series
will add virDOmainGetXMLDesc(, VIR_DOMAIN_XML_CHECKPOINTS) and
virDomainCheckpointCreateXML(, VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE_LIST)
with very similar code.
Note that I'm posting the series now to start review; the bulk
query is fully implemented (patch 6), while the bulk redefine still
needs more work (patch 7 defines the API, but the actual implementation
is trickier, so I'll be posting additional patches later once I get
them working). Patch 1 is a revision of work posted previously in a
different series where all other patches of that series are now on
mainline. Also available at:
https://repo.or.cz/libvirt/ericb.git/shortlog/refs/tags/snapshot-bulk-v1
Eric Blake (7):
domain: Document VIR_DOMAIN_XML_MIGRATABLE
snapshot: Give virDomainSnapshotDefFormat its own flags
snapshot: Refactor virDomainSnapshotDefFormat
snapshot: Add virDomainSnapshotObjListFormat
domain: Expand virDomainDefFormatInternal with snapshots
domain: Add VIR_DOMAIN_XML_SNAPSHOTS flag
snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE_LIST flag
include/libvirt/libvirt-domain-snapshot.h | 3 +
include/libvirt/libvirt-domain.h | 1 +
src/conf/domain_conf.h | 8 ++
src/conf/snapshot_conf.h | 18 ++-
src/conf/domain_conf.c | 71 ++++++++--
src/conf/snapshot_conf.c | 162 ++++++++++++++++------
src/esx/esx_driver.c | 1 -
src/libvirt-domain-snapshot.c | 21 ++-
src/libvirt-domain.c | 14 ++
src/libvirt_private.syms | 2 +
src/network/bridge_driver.c | 3 +-
src/qemu/qemu_domain.c | 24 +++-
src/qemu/qemu_driver.c | 7 +-
src/test/test_driver.c | 10 +-
src/vbox/vbox_common.c | 5 +-
src/vz/vz_driver.c | 3 +-
tests/domainsnapshotxml2xmltest.c | 16 ++-
tools/virsh-domain.c | 7 +
tools/virsh-snapshot.c | 13 ++
19 files changed, 293 insertions(+), 96 deletions(-)
--
2.20.1