checkpoint: Introduce VIR_DOMAIN_CHECKPOINT_REDEFINE_VALIDATE flag

Introduce a flag which will allow users to perform hypervisor-specific
validation when redefining the checkpoint metadata. This will allow
checking metadata which is stored e.g. in disk images when populating
the libvirt metadata.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-11-03 12:28:46 +01:00
parent e33e89d839
commit 9b54eb84c8
2 changed files with 11 additions and 0 deletions

View File

@ -57,6 +57,8 @@ typedef enum {
quiesce all mounted
file systems within
the domain */
VIR_DOMAIN_CHECKPOINT_REDEFINE_VALIDATE = (1 << 2), /* validate disk data state
when redefining a checkpoint */
} virDomainCheckpointCreateFlags;
/* Create a checkpoint using the current VM state. */

View File

@ -125,6 +125,11 @@ virDomainCheckpointGetConnect(virDomainCheckpointPtr checkpoint)
* has a way to resupply correct defaults). Not all hypervisors support
* this flag.
*
* If @flags includes VIR_DOMAIN_CHECKPOINT_REDEFINE_VALIDATE along with
* VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE the state of the metadata related
* to the disk state of the redefined checkpoint is validated. Note that
* hypervisors may require that the @domain is running to perform validation.
*
* If @flags includes VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE, then the
* libvirt will attempt to use guest agent to freeze and thaw all file
* systems in use within domain OS. However, if the guest agent is not
@ -155,6 +160,10 @@ virDomainCheckpointCreateXML(virDomainPtr domain,
VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE,
error);
VIR_REQUIRE_FLAG_GOTO(VIR_DOMAIN_CHECKPOINT_REDEFINE_VALIDATE,
VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE,
error);
if (conn->driver->domainCheckpointCreateXML) {
virDomainCheckpointPtr ret;
ret = conn->driver->domainCheckpointCreateXML(domain, xmlDesc, flags);