[RFC PATCH 08/16] qemu: checkpoint: Introduce helper to find checkpoint disk definition in parents
Eric Blake
eblake at redhat.com
Fri Jan 24 18:55:20 UTC 2020
On 1/9/20 12:21 PM, Peter Krempa wrote:
> The algorithm is used in two places to find the parent checkpoint object
> which contains given disk and then uses data from the disk. Additionally
> the code is written in a very non-obvious way. Factor out the lookup of
> the disk into a function which also simplifies the callers.
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
> src/qemu/qemu_checkpoint.c | 129 ++++++++++++++++++++-----------------
> 1 file changed, 71 insertions(+), 58 deletions(-)
>
Thank you. I noticed the repetition when I was preparing my v10 of
incremental backup, but did not manage to factor it out cleanly like this.
>
> +/**
> + * qemuCheckpointFindActiveDiskInParent:
> + * @vm: domain object
> + * @from: starting moment object
> + * @diskname: name (target) of the disk to find
> + *
> + * Find the first checkpoint starting from @from continuing through parents
> + * of the checkpoint which describes disk @diskname. Return the pointer to the
> + * definition of the disk.
> + */
> +static virDomainCheckpointDiskDef *
> +qemuCheckpointFindActiveDiskInParent(virDomainObjPtr vm,
> + virDomainMomentObjPtr from,
> + const char *diskname)
> +{
Reviewed-by: Eric Blake <eblake at redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the libvir-list
mailing list