On Fri, Oct 18, 2019 at 06:11:08PM +0200, Peter Krempa wrote:
Separate out individual steps of creating a checkpoint from qemuCheckpointCreateXML into separate functions. This makes the function more readable and understandable and also some of the new functions will be reusable when we will be creating a checkpoint along with a backup in the upcoming patches. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_checkpoint.c | 160 ++++++++++++++++++++++++------------- src/qemu/qemu_checkpoint.h | 8 ++ 2 files changed, 111 insertions(+), 57 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 54719e7f5c..946ae78368 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -348,6 +348,90 @@ qemuCheckpointAddActions(virDomainObjPtr vm, } +static virDomainMomentObjPtr +qemuCheckpointRedefine(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainCheckpointDefPtr *def, + bool *update_current) +{ + virDomainMomentObjPtr chk = NULL; + + if (virDomainCheckpointRedefinePrep(vm, def, &chk, driver->xmlopt, + update_current) < 0) + return NULL; + + /* XXX Should we validate that the redefined checkpoint even + * makes sense, such as checking that qemu-img recognizes the + * checkpoint bitmap name in at least one of the domain's disks? */ + + if (chk) + return chk; + + chk = virDomainCheckpointAssignDef(vm->checkpoints, *def); + *def = NULL; + return chk; +} + + +int +qemuCheckpointCreateCommon(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virCapsPtr caps, + virDomainCheckpointDefPtr *def, + virJSONValuePtr *actions, + virDomainMomentObjPtr *chk) +{ + g_autoptr(virJSONValue) tmpactions = NULL; + virDomainMomentObjPtr parent; + + if (qemuCheckpointPrepare(driver, caps, vm, *def) < 0) + return -1; + + if ((parent = virDomainCheckpointGetCurrent(vm->checkpoints))) { + if (VIR_STRDUP((*def)->parent.parent_name, parent->def->name) < 0) + return -1;
g_strdup
+ } +
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Jano
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list