[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv2 07/20] snapshot: qemu: Add async job type for snapshots



On 11/02/12 18:21, Eric Blake wrote:
On 11/01/2012 10:22 AM, Peter Krempa wrote:
The new external system checkpoints will require an async job while the
snapshot is taken. This patch adds QEMU_ASYNC_JOB_SNAPSHOT to track this
job type.
---
  src/qemu/qemu_domain.c  |  3 +++
  src/qemu/qemu_domain.h  |  1 +
  src/qemu/qemu_process.c | 19 +++++++++++++++++++
  3 files changed, 23 insertions(+)


+++ b/src/qemu/qemu_process.c
@@ -3046,6 +3046,25 @@ qemuProcessRecoverJob(struct qemud_driver *driver,
          }
          break;

+    case QEMU_ASYNC_JOB_SNAPSHOT:
+        qemuDomainObjEnterMonitor(driver, vm);
+        ignore_value(qemuMonitorMigrateCancel(priv->mon));
+        qemuDomainObjExitMonitor(driver, vm);
+         /* resume the domain but only if it was paused as a result of
+          * creating the snapshot. */
+        if (state == VIR_DOMAIN_PAUSED &&
+            ((job->asyncJob == QEMU_ASYNC_JOB_SNAPSHOT &&

In this particular case branch, job->asyncJob is always equal to
QEMU_ASYNC_JOB_SNAPSHOT.

+              reason == VIR_DOMAIN_PAUSED_MIGRATION) ||

Don't you mean VIR_DOMAIN_PAUSED_SNAPSHOT here?

Yes, happens way too often when cutting&pasting :(


I think you can simplify the code by squashing this in for less
redundant code.  ACK with this change:

The simplification makes sense. It's possible we will need to change the code back to a separate branch once we'll be implementing a more elaborate async job recovery for snapshots.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]