[PATCH 4/7] snapshot: qemu: Add async job type for snapshots

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

 



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(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 19ba099..a414ece 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -68,6 +68,7 @@ VIR_ENUM_IMPL(qemuDomainAsyncJob, QEMU_ASYNC_JOB_LAST,
               "migration in",
               "save",
               "dump",
+              "snapshot",
 );


@@ -84,6 +85,7 @@ qemuDomainAsyncJobPhaseToString(enum qemuDomainAsyncJob job,
     case QEMU_ASYNC_JOB_DUMP:
     case QEMU_ASYNC_JOB_NONE:
     case QEMU_ASYNC_JOB_LAST:
+    case QEMU_ASYNC_JOB_SNAPSHOT:
         ; /* fall through */
     }

@@ -106,6 +108,7 @@ qemuDomainAsyncJobPhaseFromString(enum qemuDomainAsyncJob job,
     case QEMU_ASYNC_JOB_DUMP:
     case QEMU_ASYNC_JOB_NONE:
     case QEMU_ASYNC_JOB_LAST:
+    case QEMU_ASYNC_JOB_SNAPSHOT:
         ; /* fall through */
     }

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 97e4346..86448d6 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -88,6 +88,7 @@ enum qemuDomainAsyncJob {
     QEMU_ASYNC_JOB_MIGRATION_IN,
     QEMU_ASYNC_JOB_SAVE,
     QEMU_ASYNC_JOB_DUMP,
+    QEMU_ASYNC_JOB_SNAPSHOT,

     QEMU_ASYNC_JOB_LAST
 };
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 31909b7..0168f0e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2972,6 +2972,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 &&
+              reason == VIR_DOMAIN_PAUSED_MIGRATION) ||
+             reason == VIR_DOMAIN_PAUSED_UNKNOWN)) {
+            if (qemuProcessStartCPUs(driver, vm, conn,
+                                     VIR_DOMAIN_RUNNING_UNPAUSED,
+                                     QEMU_ASYNC_JOB_NONE) < 0) {
+                VIR_WARN("Could not resume domain %s after snapshot",
+                         vm->def->name);
+            }
+        }
+        break;
+
     case QEMU_ASYNC_JOB_NONE:
     case QEMU_ASYNC_JOB_LAST:
         break;
-- 
1.7.12

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]