diff mbox

[v2] migration: allow setting MIG_STATE_CANCEL even if s->state != MIG_STATE_ACTIVE.

Message ID 1298963289-16034-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp
State New
Headers show

Commit Message

Yoshiaki Tamura March 1, 2011, 7:08 a.m. UTC
After migration failure, even a user commands migrate_cancel, it keeps
saying:

Migration status: failed

This patch checks s->state == MIG_STATE_CANCEL instead of s->state !=
MIG_STATE_ACTIVE.  With this patch the message above would be:

Migration status: cancelled

Please note that the following patches are prerequisite.

http://www.mail-archive.com/qemu-devel@nongnu.org/msg56448.html
http://www.mail-archive.com/qemu-devel@nongnu.org/msg56446.html

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
 migration.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/migration.c b/migration.c
index 14a125f..0e551e2 100644
--- a/migration.c
+++ b/migration.c
@@ -406,16 +406,19 @@  void migrate_fd_cancel(MigrationState *mig_state)
 {
     FdMigrationState *s = migrate_to_fms(mig_state);
 
-    if (s->state != MIG_STATE_ACTIVE)
+    if (s->state == MIG_STATE_CANCELLED) {
         return;
+    }
 
     DPRINTF("cancelling migration\n");
 
     s->state = MIG_STATE_CANCELLED;
     notifier_list_notify(&migration_state_notifiers);
-    qemu_savevm_state_cancel(s->mon, s->file);
 
-    migrate_fd_cleanup(s);
+    if (s->file) {
+        qemu_savevm_state_cancel(s->mon, s->file);
+        migrate_fd_cleanup(s);
+    }
 }
 
 void migrate_fd_release(MigrationState *mig_state)