This is a respin of patch 4/20 in my larger series:
https://www.redhat.com/archives/libvir-list/2019-March/msg00386.html
As John pointed out, my v4/v5 posting had a LOT of duplicate code,
including lots of poorly commented code managing a potential tree of
checkpoints (even if the more immediate use tends to be a linear chain
than a full-blown tree), all because I had copied-and-pasted from
snapshot code. Copy-and-paste is technical debt; better is to get rid
of the debt by refactoring the code for easy reuse.
Here's as far as I got today, but hopefully reviewers agree that this
glimpse of where things are headed is worthwhile, and I can start
pushing these patches while continuing my cleanup work on the rest of
the incremental backup stuff. Pre-series, virDomainSnapshotList()
code in snapshot_conf.h can only compute a list of
virDomainSnapshotPtrs; once this series is applied, that function will
instead be changed to compute a list of virDomainMomentPtrs (which is
then trivially cast to virDomainSnapshotPtr or virDomainCheckpointPtr
as needed), so that all the code related to maintaining relationships
between points in time can be shared rather than duplicated between
snapshots and checkpoints.
Eric Blake (8):
snapshot: Split domain forward typedefs into new file
snapshot: Sort virconftypes.h
snapshot: Break out virDomainSnapshotObj into its own file
snapshot: Export two functions prior to file split
snapshot: Break out virDomainSnapshotObjList into its own file
snapshot: Use accessors for virDomainSnapshot members
snapshot: Create virDomainMoment base class
backup: Introduce virDomainCheckpointPtr
include/libvirt/virterror.h | 6 +-
src/util/virerror.c | 12 +-
include/libvirt/libvirt.h | 6 +-
src/conf/domain_conf.h | 220 +---------
src/conf/snapshot_conf.h | 74 +---
src/conf/virconftypes.h | 281 +++++++++++++
src/conf/virdomainsnapshotobj.h | 50 +++
src/conf/virdomainsnapshotobjlist.h | 74 ++++
src/datatypes.h | 79 +++-
src/conf/Makefile.inc.am | 5 +
src/conf/domain_conf.c | 1 +
src/conf/snapshot_conf.c | 608 +---------------------------
src/conf/virdomainobjlist.c | 1 +
src/conf/virdomainsnapshotobj.c | 123 ++++++
src/conf/virdomainsnapshotobjlist.c | 553 +++++++++++++++++++++++++
src/datatypes.c | 132 ++++--
src/esx/esx_driver.c | 66 +--
src/libvirt-domain-snapshot.c | 26 +-
src/libvirt_private.syms | 38 +-
src/qemu/qemu_command.c | 1 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_driver.c | 41 +-
src/qemu/qemu_migration.c | 1 +
src/remote/remote_daemon_dispatch.c | 4 +-
src/remote/remote_driver.c | 4 +-
src/rpc/gendispatch.pl | 2 +-
src/test/test_driver.c | 21 +-
src/vbox/vbox_common.c | 56 +--
src/vz/vz_driver.c | 52 +--
29 files changed, 1450 insertions(+), 1088 deletions(-)
create mode 100644 src/conf/virconftypes.h
create mode 100644 src/conf/virdomainsnapshotobj.h
create mode 100644 src/conf/virdomainsnapshotobjlist.h
create mode 100644 src/conf/virdomainsnapshotobj.c
create mode 100644 src/conf/virdomainsnapshotobjlist.c
--
2.20.1