From patchwork Wed Feb 23 00:44:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 84022 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 AE3F9B7111 for ; Wed, 23 Feb 2011 11:51:26 +1100 (EST) Received: from localhost ([127.0.0.1]:35302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ps2wa-0005YH-31 for incoming@patchwork.ozlabs.org; Tue, 22 Feb 2011 19:51:04 -0500 Received: from [140.186.70.92] (port=36602 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ps2qf-0002rG-Me for qemu-devel@nongnu.org; Tue, 22 Feb 2011 19:44:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ps2qe-0005J4-AR for qemu-devel@nongnu.org; Tue, 22 Feb 2011 19:44:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ps2qe-0005Iv-27 for qemu-devel@nongnu.org; Tue, 22 Feb 2011 19:44:56 -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 p1N0itBJ025916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Feb 2011 19:44:55 -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 p1N0ig31026523; Tue, 22 Feb 2011 19:44:54 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 23 Feb 2011 01:44:23 +0100 Message-Id: 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 09/22] migration: Introduce MIG_STATE_NONE 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 Use MIG_STATE_ACTIVE only when migration has really started Signed-off-by: Juan Quintela --- migration.c | 6 +++++- migration.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/migration.c b/migration.c index 55f58c8..f015e02 100644 --- a/migration.c +++ b/migration.c @@ -238,6 +238,9 @@ void do_info_migrate(Monitor *mon, QObject **ret_data) MigrationState *s = current_migration; switch (s->get_status(current_migration)) { + case MIG_STATE_NONE: + /* no migration has happened ever */ + break; case MIG_STATE_ACTIVE: qdict = qdict_new(); qdict_put(qdict, "status", qstring_from_str("active")); @@ -465,6 +468,7 @@ void migrate_fd_connect(MigrationState *s) { int ret; + s->state = MIG_STATE_ACTIVE; s->file = qemu_fopen_ops_buffered(s, s->bandwidth_limit, migrate_fd_put_buffer, @@ -495,7 +499,7 @@ static MigrationState *migrate_create_state(Monitor *mon, int64_t bandwidth_limi s->shared = inc; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; - s->state = MIG_STATE_ACTIVE; + s->state = MIG_STATE_NONE; if (!detach) { migrate_fd_monitor_suspend(s, mon); diff --git a/migration.h b/migration.h index 7d28dd3..3df2293 100644 --- a/migration.h +++ b/migration.h @@ -19,9 +19,10 @@ #include "notify.h" #define MIG_STATE_ERROR -1 -#define MIG_STATE_COMPLETED 0 +#define MIG_STATE_NONE 0 #define MIG_STATE_CANCELLED 1 #define MIG_STATE_ACTIVE 2 +#define MIG_STATE_COMPLETED 3 typedef struct MigrationState MigrationState;