]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
checkpoint: Introduce VIR_DOMAIN_CHECKPOINT_REDEFINE_VALIDATE flag
authorPeter Krempa <pkrempa@redhat.com>
Tue, 3 Nov 2020 11:28:46 +0000 (12:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 9 Nov 2020 11:25:49 +0000 (12:25 +0100)
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>
include/libvirt/libvirt-domain-checkpoint.h
src/libvirt-domain-checkpoint.c

index f4bd92e81c0d3b458ef0aa9bed4aef62f506928b..58932c8a6a99e4903a70e094fc4f0307cc115844 100644 (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. */
index e9af8e4cf044993b5d41e45cebe6276b6efcddb5..e0c2527ccb4dc380a4a12a277dd12ea696c4c742 100644 (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);