0a122b
From 7861f4a9c8f7125b758e9be430b195527db83430 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <7861f4a9c8f7125b758e9be430b195527db83430.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:53:17 +0100
0a122b
Subject: [PATCH 41/46] migration: fix spice migration
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-42-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55722
0a122b
O-Subject: [RHEL7.0 PATCH 41/42] migration: fix spice migration
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit 02edd2e7665bceb307bedd8afe625c0f7e8d7cfa
0a122b
Author: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
Date:   Mon Jul 29 15:01:58 2013 +0200
0a122b
0a122b
    migration: fix spice migration
0a122b
0a122b
    Commit 29ae8a4133082e16970c9d4be09f4b6a15034617 ("rdma: introduce
0a122b
    MIG_STATE_NONE and change MIG_STATE_SETUP state transition") changed the
0a122b
    state transitions during migration setup.
0a122b
0a122b
    Spice used to be notified with MIG_STATE_ACTIVE and it detected this
0a122b
    using migration_is_active().  Spice is now notified with
0a122b
    MIG_STATE_SETUP and migration_is_active() no longer works.
0a122b
0a122b
    Replace migration_is_active() with migration_in_setup() to fix spice
0a122b
    migration.
0a122b
0a122b
    Cc: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Reviewed-by: Kevin Wolf <kwolf@redhat.com>
0a122b
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
---
0a122b
 hw/block/virtio-blk.c         |    2 +-
0a122b
 include/migration/migration.h |    2 +-
0a122b
 migration.c                   |    4 ++--
0a122b
 ui/spice-core.c               |    2 +-
0a122b
 4 files changed, 5 insertions(+), 5 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hw/block/virtio-blk.c         | 2 +-
0a122b
 include/migration/migration.h | 2 +-
0a122b
 migration.c                   | 4 ++--
0a122b
 ui/spice-core.c               | 2 +-
0a122b
 4 files changed, 5 insertions(+), 5 deletions(-)
0a122b
0a122b
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
0a122b
index 9fe622d..49a23c3 100644
0a122b
--- a/hw/block/virtio-blk.c
0a122b
+++ b/hw/block/virtio-blk.c
0a122b
@@ -658,7 +658,7 @@ static void virtio_blk_migration_state_changed(Notifier *notifier, void *data)
0a122b
                                   migration_state_notifier);
0a122b
     MigrationState *mig = data;
0a122b
 
0a122b
-    if (migration_is_active(mig)) {
0a122b
+    if (migration_in_setup(mig)) {
0a122b
         if (!s->dataplane) {
0a122b
             return;
0a122b
         }
0a122b
diff --git a/include/migration/migration.h b/include/migration/migration.h
0a122b
index 08c772d..140e6b4 100644
0a122b
--- a/include/migration/migration.h
0a122b
+++ b/include/migration/migration.h
0a122b
@@ -90,7 +90,7 @@ int migrate_fd_close(MigrationState *s);
0a122b
 
0a122b
 void add_migration_state_change_notifier(Notifier *notify);
0a122b
 void remove_migration_state_change_notifier(Notifier *notify);
0a122b
-bool migration_is_active(MigrationState *);
0a122b
+bool migration_in_setup(MigrationState *);
0a122b
 bool migration_has_finished(MigrationState *);
0a122b
 bool migration_has_failed(MigrationState *);
0a122b
 MigrationState *migrate_get_current(void);
0a122b
diff --git a/migration.c b/migration.c
0a122b
index c0202b4..13fc59b 100644
0a122b
--- a/migration.c
0a122b
+++ b/migration.c
0a122b
@@ -339,9 +339,9 @@ void remove_migration_state_change_notifier(Notifier *notify)
0a122b
     notifier_remove(notify);
0a122b
 }
0a122b
 
0a122b
-bool migration_is_active(MigrationState *s)
0a122b
+bool migration_in_setup(MigrationState *s)
0a122b
 {
0a122b
-    return s->state == MIG_STATE_ACTIVE;
0a122b
+    return s->state == MIG_STATE_SETUP;
0a122b
 }
0a122b
 
0a122b
 bool migration_has_finished(MigrationState *s)
0a122b
diff --git a/ui/spice-core.c b/ui/spice-core.c
0a122b
index c8337ab..d67449e 100644
0a122b
--- a/ui/spice-core.c
0a122b
+++ b/ui/spice-core.c
0a122b
@@ -561,7 +561,7 @@ static void migration_state_notifier(Notifier *notifier, void *data)
0a122b
 {
0a122b
     MigrationState *s = data;
0a122b
 
0a122b
-    if (migration_is_active(s)) {
0a122b
+    if (migration_in_setup(s)) {
0a122b
         spice_server_migrate_start(spice_server);
0a122b
     } else if (migration_has_finished(s)) {
0a122b
         spice_server_migrate_end(spice_server, true);
0a122b
-- 
0a122b
1.7.11.7
0a122b