From patchwork Wed Feb 23 21:47:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 84280 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 DD847B70AF for ; Thu, 24 Feb 2011 10:49:55 +1100 (EST) Received: from localhost ([127.0.0.1]:59807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsMtn-00027V-VS for incoming@patchwork.ozlabs.org; Wed, 23 Feb 2011 17:09:32 -0500 Received: from [140.186.70.92] (port=35519 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsMZQ-0000Kr-4d for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsMYy-0005C6-9g for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsMYx-0005Bs-Ux for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:00 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLlxvm031952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 23 Feb 2011 16:47:59 -0500 Received: from trasno.mitica (ovpn-113-97.phx2.redhat.com [10.3.113.97]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLlhC3020923; Wed, 23 Feb 2011 16:47:58 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 23 Feb 2011 22:47:20 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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 11/28] migration: Introduce migrate_fd_completed() for consistenncy 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 function is a bit different of the others that change the state, in the sense that if migrate_fd_cleanup() returns an error, it set the status to error, not completed. Signed-off-by: Juan Quintela --- migration.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/migration.c b/migration.c index ed6e626..9be6bb0 100644 --- a/migration.c +++ b/migration.c @@ -318,6 +318,17 @@ void migrate_fd_error(MigrationState *s) migrate_fd_cleanup(s); } +static void migrate_fd_completed(MigrationState *s) +{ + DPRINTF("setting completed state\n"); + if (migrate_fd_cleanup(s) < 0) { + s->state = MIG_STATE_ERROR; + } else { + s->state = MIG_STATE_COMPLETED; + } + notifier_list_notify(&migration_state_notifiers); +} + static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; @@ -371,12 +382,7 @@ static void migrate_fd_put_ready(void *opaque) if (qemu_savevm_state_complete(s->mon, s->file) < 0) { migrate_fd_error(s); } else { - if (migrate_fd_cleanup(s) < 0) { - migrate_fd_error(s); - } else { - s->state = MIG_STATE_COMPLETED; - notifier_list_notify(&migration_state_notifiers); - } + migrate_fd_completed(s); } if (s->get_status(s) != MIG_STATE_COMPLETED) { if (old_vm_running) {