[PATCH 5/9] checkpoint: Introduce VIR_DOMAIN_CHECKPOINT_REDEFINE_VALIDATE flag

Peter Krempa pkrempa at redhat.com
Wed Nov 4 13:05:03 UTC 2020


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

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 include/libvirt/libvirt-domain-checkpoint.h | 2 ++
 src/libvirt-domain-checkpoint.c             | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/libvirt/libvirt-domain-checkpoint.h b/include/libvirt/libvirt-domain-checkpoint.h
index f4bd92e81c..58932c8a6a 100644
--- a/include/libvirt/libvirt-domain-checkpoint.h
+++ b/include/libvirt/libvirt-domain-checkpoint.h
@@ -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. */
diff --git a/src/libvirt-domain-checkpoint.c b/src/libvirt-domain-checkpoint.c
index e9af8e4cf0..e0c2527ccb 100644
--- a/src/libvirt-domain-checkpoint.c
+++ b/src/libvirt-domain-checkpoint.c
@@ -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);
-- 
2.26.2




More information about the libvir-list mailing list