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.
Also available at:
https://repo.or.cz/libvirt/ericb.git/shortlog/refs/tags/snapshot-bulk-v3
Changes since v2:
- address lots of comments from John
- split and rearrange some patches
- incorporate remaining patches from my series fixing --redefine bugs
- rebase to master
001/18:[down] 'qemu: Refactor snapshot check for _LIVE vs. _REDEFINE'
002/18:[down] 'snapshot: Rework virDomainSnapshotState enum'
003/18:[down] 'qemu: Use virDomainSnapshotState for switch statements'
004/18:[0017] [FC] 'snapshot: Give virDomainSnapshotDefFormat its own flags'
005/18:[0003] [FC] 'snapshot: Refactor virDomainSnapshotDefFormat'
006/18:[0029] [FC] 'snapshot: Add virDomainSnapshotObjListFormat'
007/18:[down] 'domain: Add struct for future domain format parameters'
008/18:[down] 'snapshot: Avoid latent use-after-free when cleaning snapshots'
009/18:[0071] [FC] 'domain: Expand virDomainDefFormatInternal with snapshots'
010/18:[down] 'snapshot: Split out virDomainSnapshotRedefineValidate helper'
011/18:[down] 'snapshot: Add virDomainSnapshotObjListParse'
012/18:[0005] [FC] 'domain: Add VIR_DOMAIN_XML_SNAPSHOTS flag'
013/18:[0002] [FC] 'snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE_LIST flag'
014/18:[0018] [FC] 'virsh: Expose bulk snapshot dumpxml/redefine'
015/18:[0010] [FC] 'test: Implement bulk snapshot operations'
016/18:[down] 'qemu: Factor out qemuDomainSnapshotValidate() helper'
017/18:[down] 'qemu: Const-correct snapshot directory name'
018/18:[0033] [FC] 'qemu: Implement bulk snapshot operations'
Eric Blake (18):
qemu: Refactor snapshot check for _LIVE vs. _REDEFINE
snapshot: Rework virDomainSnapshotState enum
qemu: Use virDomainSnapshotState for switch statements
snapshot: Give virDomainSnapshotDefFormat its own flags
snapshot: Refactor virDomainSnapshotDefFormat
snapshot: Add virDomainSnapshotObjListFormat
domain: Add struct for future domain format parameters
snapshot: Avoid latent use-after-free when cleaning snapshots
domain: Expand virDomainDefFormatInternal with snapshots
snapshot: Split out virDomainSnapshotRedefineValidate helper
snapshot: Add virDomainSnapshotObjListParse
domain: Add VIR_DOMAIN_XML_SNAPSHOTS flag
snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE_LIST flag
virsh: Expose bulk snapshot dumpxml/redefine
test: Implement bulk snapshot operations
qemu: Factor out qemuDomainSnapshotValidate() helper
qemu: Const-correct snapshot directory name
qemu: Implement bulk snapshot operations
include/libvirt/libvirt-domain-snapshot.h | 3 +
include/libvirt/libvirt-domain.h | 1 +
src/conf/domain_conf.h | 21 +-
src/conf/snapshot_conf.h | 47 +-
src/qemu/qemu_domain.h | 2 +-
src/conf/domain_conf.c | 69 ++-
src/conf/snapshot_conf.c | 513 ++++++++++++++++------
src/esx/esx_driver.c | 1 -
src/libvirt-domain-snapshot.c | 23 +-
src/libvirt-domain.c | 8 +-
src/libvirt_private.syms | 3 +
src/network/bridge_driver.c | 2 +-
src/qemu/qemu_domain.c | 47 +-
src/qemu/qemu_driver.c | 234 ++++++----
src/test/test_driver.c | 52 ++-
src/vbox/vbox_common.c | 13 +-
src/vz/vz_driver.c | 3 +-
tests/domainsnapshotxml2xmltest.c | 16 +-
tools/virsh-domain.c | 7 +
tools/virsh-snapshot.c | 14 +
tools/virsh.pod | 18 +-
21 files changed, 790 insertions(+), 307 deletions(-)
--
2.20.1