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