[PULL,54/65] migration: Remove MigrationState parameter from migration_is_idle()

Submitted by Juan Quintela on April 21, 2017, 11:56 a.m.

Details

Message ID 20170421115646.15544-55-quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela April 21, 2017, 11:56 a.m.
Only user don't have a MigrationState handly.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/migration/migration.h | 2 +-
 migration/migration.c         | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/migration/migration.h b/include/migration/migration.h
index b84ec3d..ba1a16c 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -234,7 +234,7 @@  void remove_migration_state_change_notifier(Notifier *notify);
 MigrationState *migrate_init(const MigrationParams *params);
 bool migration_is_blocked(Error **errp);
 bool migration_in_setup(MigrationState *);
-bool migration_is_idle(MigrationState *s);
+bool migration_is_idle(void);
 bool migration_has_finished(MigrationState *);
 bool migration_has_failed(MigrationState *);
 /* True if outgoing migration has entered postcopy phase */
diff --git a/migration/migration.c b/migration/migration.c
index 156daf9..a92d7f7 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1075,11 +1075,9 @@  bool migration_in_postcopy_after_devices(MigrationState *s)
     return migration_in_postcopy() && s->postcopy_after_devices;
 }
 
-bool migration_is_idle(MigrationState *s)
+bool migration_is_idle(void)
 {
-    if (!s) {
-        s = migrate_get_current();
-    }
+    MigrationState *s = migrate_get_current();
 
     switch (s->state) {
     case MIGRATION_STATUS_NONE:
@@ -1144,7 +1142,7 @@  int migrate_add_blocker(Error *reason, Error **errp)
         return -EACCES;
     }
 
-    if (migration_is_idle(NULL)) {
+    if (migration_is_idle()) {
         migration_blockers = g_slist_prepend(migration_blockers, reason);
         return 0;
     }