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

[libvirt] [RFC v1 5/6] managedsave: move the domain xml handling forward to stop CPU



we should save the XML information to image head before we
hotunplug the ephemeral devices. so here we handle XML
ahead.

Signed-off-by: Chen Fan <chen fan fnst cn fujitsu com>
---
 src/qemu/qemu_driver.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b3263ac..86d93d2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3179,26 +3179,6 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
 
     priv->job.current->type = VIR_DOMAIN_JOB_UNBOUNDED;
 
-    /* Pause */
-    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
-        was_running = true;
-        if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE,
-                                QEMU_ASYNC_JOB_SAVE) < 0)
-            goto endjob;
-
-        if (!virDomainObjIsActive(vm)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("guest unexpectedly quit"));
-            goto endjob;
-        }
-    }
-
-   /* libvirt.c already guaranteed these two flags are exclusive.  */
-    if (flags & VIR_DOMAIN_SAVE_RUNNING)
-        was_running = true;
-    else if (flags & VIR_DOMAIN_SAVE_PAUSED)
-        was_running = false;
-
     /* Get XML for the domain.  Restore needs only the inactive xml,
      * including secure.  We should get the same result whether xmlin
      * is NULL or whether it was the live xml of the domain moments
@@ -3225,6 +3205,26 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
         goto endjob;
     }
 
+    /* Pause */
+    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
+        was_running = true;
+        if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE,
+                                QEMU_ASYNC_JOB_SAVE) < 0)
+            goto endjob;
+
+        if (!virDomainObjIsActive(vm)) {
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("guest unexpectedly quit"));
+            goto endjob;
+        }
+    }
+
+   /* libvirt.c already guaranteed these two flags are exclusive.  */
+    if (flags & VIR_DOMAIN_SAVE_RUNNING)
+        was_running = true;
+    else if (flags & VIR_DOMAIN_SAVE_PAUSED)
+        was_running = false;
+
     ret = qemuDomainSaveMemory(driver, vm, path, xml, compressed,
                                was_running, flags, QEMU_ASYNC_JOB_SAVE);
     if (ret < 0)
-- 
1.9.3


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