summary refs log tree commit diff stats
path: root/migration/savevm.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-11-23 13:50:00 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-11-23 13:50:00 +0000
commit54c85bebb59f73aa87b5db59a00a16a500a3d642 (patch)
tree45920c25f9f05f778ffe6ddd27f8768cb845f4da /migration/savevm.c
parent1b89975d420c4c6c2967730ea20f0fd0ce211c1f (diff)
parentacab30b85db0885ab161aff4c83c550628f6d8ca (diff)
downloadfocaccia-qemu-54c85bebb59f73aa87b5db59a00a16a500a3d642.tar.gz
focaccia-qemu-54c85bebb59f73aa87b5db59a00a16a500a3d642.zip
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20171122' into staging
migration/next for 20171122

# gpg: Signature made Wed 22 Nov 2017 08:43:13 GMT
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* remotes/juanquintela/tags/migration/20171122:
  migration/ram.c: do not set 'postcopy_running' in POSTCOPY_INCOMING_END
  migration, xen: Fix block image lock issue on live migration

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r--migration/savevm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index 192f2d82cd..b7908f62be 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2242,13 +2242,20 @@ int save_snapshot(const char *name, Error **errp)
     return ret;
 }
 
-void qmp_xen_save_devices_state(const char *filename, Error **errp)
+void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
+                                Error **errp)
 {
     QEMUFile *f;
     QIOChannelFile *ioc;
     int saved_vm_running;
     int ret;
 
+    if (!has_live) {
+        /* live default to true so old version of Xen tool stack can have a
+         * successfull live migration */
+        live = true;
+    }
+
     saved_vm_running = runstate_is_running();
     vm_stop(RUN_STATE_SAVE_VM);
     global_state_store_running();
@@ -2263,6 +2270,20 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
     qemu_fclose(f);
     if (ret < 0) {
         error_setg(errp, QERR_IO_ERROR);
+    } else {
+        /* libxl calls the QMP command "stop" before calling
+         * "xen-save-devices-state" and in case of migration failure, libxl
+         * would call "cont".
+         * So call bdrv_inactivate_all (release locks) here to let the other
+         * side of the migration take controle of the images.
+         */
+        if (live && !saved_vm_running) {
+            ret = bdrv_inactivate_all();
+            if (ret) {
+                error_setg(errp, "%s: bdrv_inactivate_all() failed (%d)",
+                           __func__, ret);
+            }
+        }
     }
 
  the_end: