[PATCH 3/9] qemuSnapshotPrepare: Prohibit 'manual' disk snapshot mode with VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag

Peter Krempa via Devel posted 9 patches 3 days, 3 hours ago
[PATCH 3/9] qemuSnapshotPrepare: Prohibit 'manual' disk snapshot mode with VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag
Posted by Peter Krempa via Devel 3 days, 3 hours ago
From: Peter Krempa <pkrempa@redhat.com>

If the snapshot has a disk using 'manual' snapshot mode we keep the VM
paused until the user resumes it (presumably after they've done steps to
take the disk snapshot).

Since quiescing is done via the guest agent this means it will not be
possible while the VM is paused.

Rather than trying to implement complex recovery from this state prevent
the use of VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE for the snapshot. The user
still can call virDomainFSFreeze/virDomainFSThaw manually.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_snapshot.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index bf25c70826..5b0b52e2ba 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1075,6 +1075,12 @@ qemuSnapshotPrepare(virDomainObj *vm,
         }
     }

+    if (*has_manual && (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE)) {
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                           _("'manual' disk snapshot mode requires explicit quiescing (VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE is not supported)"));
+            return -1;
+    }
+
     /* Alter flags to let later users know what we learned.  */
     if (external && !active)
         *flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY;
-- 
2.52.0