From patchwork Wed Feb 23 00:44:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 84036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DD0A8B710F for ; Wed, 23 Feb 2011 12:12:54 +1100 (EST) Received: from localhost ([127.0.0.1]:53849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ps3Hf-0007KU-Sw for incoming@patchwork.ozlabs.org; Tue, 22 Feb 2011 20:12:51 -0500 Received: from [140.186.70.92] (port=36747 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ps2qu-00032t-OL for qemu-devel@nongnu.org; Tue, 22 Feb 2011 19:45:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ps2qt-0005Mo-Hw for qemu-devel@nongnu.org; Tue, 22 Feb 2011 19:45:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ps2qt-0005Me-8B for qemu-devel@nongnu.org; Tue, 22 Feb 2011 19:45:11 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1N0jA0j001932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Feb 2011 19:45:10 -0500 Received: from trasno.mitica (ovpn-113-108.phx2.redhat.com [10.3.113.108]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1N0ig3D026523; Tue, 22 Feb 2011 19:45:09 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 23 Feb 2011 01:44:35 +0100 Message-Id: <04af1ac60cffc5b9bf4d3e0cfded8f8bd2978699.1298421307.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 21/22] migration: Export a function that tells if the migration has finished correctly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This will allows us to hide the status values. Signed-off-by: Juan Quintela --- migration.c | 4 ++-- migration.h | 2 +- ui/spice-core.c | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/migration.c b/migration.c index 312a029..383ebaf 100644 --- a/migration.c +++ b/migration.c @@ -335,9 +335,9 @@ void remove_migration_state_change_notifier(Notifier *notify) notifier_list_remove(&migration_state_notifiers, notify); } -int get_migration_state(void) +bool migration_has_finished(void) { - return current_migration.state; + return current_migration.state == MIG_STATE_COMPLETED; } void migrate_fd_connect(MigrationState *s) diff --git a/migration.h b/migration.h index 6477b51..9457807 100644 --- a/migration.h +++ b/migration.h @@ -82,6 +82,6 @@ void migrate_fd_connect(MigrationState *s); void add_migration_state_change_notifier(Notifier *notify); void remove_migration_state_change_notifier(Notifier *notify); -int get_migration_state(void); +bool migration_has_finished(void); #endif diff --git a/ui/spice-core.c b/ui/spice-core.c index 1aa1a5e..997603d 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -422,9 +422,7 @@ void do_info_spice(Monitor *mon, QObject **ret_data) static void migration_state_notifier(Notifier *notifier) { - int state = get_migration_state(); - - if (state == MIG_STATE_COMPLETED) { + if (migration_has_finished()) { #if SPICE_SERVER_VERSION >= 0x000701 /* 0.7.1 */ spice_server_migrate_switch(spice_server); #endif