On Wed, Mar 27, 2019 at 05:10:38AM -0500, Eric Blake wrote:
Introduce a few new public APIs related to incremental backups.
This
builds on the previous notion of a checkpoint (without an existing
checkpoint, the new API is a full backup, differing from
virDomainBlockCopy in the point of time chosen and in operation on
multiple disks at once); and also allows creation of a new checkpoint
at the same time as starting the backup (after all, an incremental
backup is only useful if it covers the state since the previous
backup). Snapshot creation is also a point in time at which creating
a checkpoint atomically can be useful; as checkpoints are independent
objects, it is not worth embedding <domaincheckpoint> inside
<domainsnapshot>, and therefore we need a more powerful version of
virDomainSnapshotCreateXML(), where we borrow from the naming pattern
of virDomainMigrate2() and friends.
A backup job also affects filtering a listing of domains, as well as
adding event reporting for signaling when a push model backup
completes (where the hypervisor creates the backup); note that the
pull model does not have an event (starting the backup lets a third
party access the data, and only the third party knows when it is
finished).
Since multiple backup jobs can be run in parallel in the future (well,
qemu doesn't support it yet, but we don't want to preclude the idea),
virDomainBackupBegin() returns a positive job id, and the id is also
visible in the backup XML. But until a future libvirt release adds a
bunch of APIs related to parallel job management where job ids will
actually matter, the documentation is also clear that job id 0 means
the 'currently running backup job' (provided one exists), for use in
virDomainBackupGetXMLDesc() and virDomainBackupEnd().
The full list of new API:
virDomainBackupBegin;
virDomainBackupEnd;
virDomainBackupGetXMLDesc;
virDomainSnapshotCreateXML2;
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
include/libvirt/libvirt-domain-snapshot.h | 8 +-
include/libvirt/libvirt-domain.h | 41 +++-
src/driver-hypervisor.h | 21 ++
src/qemu/qemu_blockjob.h | 1 +
examples/object-events/event-test.c | 3 +
src/conf/domain_conf.c | 2 +-
src/libvirt-domain-snapshot.c | 89 +++++++++
src/libvirt-domain.c | 221 +++++++++++++++++++++-
src/libvirt_public.syms | 4 +
tools/virsh-domain.c | 8 +-
10 files changed, 391 insertions(+), 7 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|