Patchwork migration: allow setting MIG_STATE_CANCEL even if s->state != MIG_STATE_ACTIVE.

login
register
mail settings
Submitter Yoshiaki Tamura
Date Feb. 24, 2011, 9:53 a.m.
Message ID <1298541230-28832-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp>
Download mbox | patch
Permalink /patch/84374/
State New
Headers show

Comments

Yoshiaki Tamura - Feb. 24, 2011, 9:53 a.m.
After migration failure, even a user commands migrate_cancel, it keeps
saying:

Migration status: failed

Move checking s->state is MIG_STATE_ACTIVE, to allow setting
MIG_STATE_CANCEL even if s->state != MIG_STATE_ACTIVE.  With this
patch the message above would be:

Migration status: cancelled

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

Patch

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