Hi, everyone.
Please take a look at pull backup API and its qemu implementation. There is no any
documentation inside yet so I put it here.
Backup is described in xml like next:
<domainbackup>
<address type="ip" host="0.0.0.0" port="7000"/>
<disks>
<disk name='sda'>
<source file="/root/backup.hdd"/>
</disk>
<disk name='sdb' present='no'/>
</disks>
</domainbackup>
<disks>, <disk>, <source> elements and 'present' attribute are
optional. The
export address is bare minimum to export all non read only disks with
inserted media. This xml description is close to what we have for snapshots.
Implementation depends on experimental qemu command 'x-blockdev-del' and
'blockdev-add' which is still described as work-in-progress even it has
no 'x-' prefix.
I failed to find the information whether client reading disks being backed up
is able to detect all failures in the process or not so some efforts
are done to track back up blockjobs failures and report them on pull
backup stop. At the same time other clean up errors on stop are ignored
so that client can know the essence was the backup operation successful
or not.
There is a work in progress to provide dirty bitmap information thru
nbd to be able to make incremental backups in pull backup scheme.
Thus the design should be future proof in this aspect. I see next
changes to xml description:
<domainbackup>
<address type="ip" host="0.0.0.0" port="7000"/>
<branch name="backup1"/>
<disks>
<disk name='sda' type='incremental'>
<source file="/root/backup.hdd"/>
<bitmap granularity='32Kib'/>
</disk>
</disks>
</domainbackup>
Branch name essentially becames dirty backup name in terms of qemu.
This option makes possible to have independent branches of
incremental backups with possibly different schedule and granularity.
Stop operation in case of incremental backups should be specified
further to finish/cancel the operation - we have flags for that.
Nikolay Shirokovskiy (3):
qemu: store guest visible disk size from qemu monitor block info
qemu: special error code in case of no job on cancel block job
introduce pull backup
examples/object-events/event-test.c | 3 +
include/libvirt/libvirt-domain-backup.h | 45 +++
include/libvirt/libvirt-domain.h | 3 +
include/libvirt/libvirt.h | 1 +
include/libvirt/virterror.h | 1 +
po/POTFILES.in | 2 +
src/Makefile.am | 3 +
src/access/viraccessperm.c | 3 +-
src/access/viraccessperm.h | 6 +
src/conf/backup_conf.c | 295 ++++++++++++++
src/conf/backup_conf.h | 85 ++++
src/conf/domain_conf.c | 2 +-
src/driver-hypervisor.h | 11 +
src/libvirt-domain-backup.c | 86 ++++
src/libvirt_private.syms | 6 +
src/libvirt_public.syms | 2 +
src/qemu/qemu_blockjob.c | 2 +
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_domain.h | 5 +
src/qemu/qemu_driver.c | 684 ++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.c | 37 ++
src/qemu/qemu_monitor.h | 12 +
src/qemu/qemu_monitor_json.c | 133 ++++++-
src/qemu/qemu_monitor_json.h | 16 +
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 33 +-
src/util/virerror.c | 1 +
tests/qemumonitorjsontest.c | 36 ++
tools/Makefile.am | 1 +
tools/virsh-backup.c | 150 +++++++
tools/virsh-backup.h | 28 ++
tools/virsh-domain.c | 3 +-
tools/virsh.c | 2 +
tools/virsh.h | 1 +
34 files changed, 1693 insertions(+), 8 deletions(-)
create mode 100644 include/libvirt/libvirt-domain-backup.h
create mode 100644 src/conf/backup_conf.c
create mode 100644 src/conf/backup_conf.h
create mode 100644 src/libvirt-domain-backup.c
create mode 100644 tools/virsh-backup.c
create mode 100644 tools/virsh-backup.h
--
1.8.3.1