From patchwork Tue Oct 11 10:00:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 118924 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A46D6B6F65 for ; Tue, 11 Oct 2011 21:47:41 +1100 (EST) Received: from localhost ([::1]:48952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDZCZ-0005ZQ-Gq for incoming@patchwork.ozlabs.org; Tue, 11 Oct 2011 06:04:47 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDZCP-0005IT-86 for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:04:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDZCK-0000Pf-As for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:04:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDZCK-0000PO-2J for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:04:32 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9BA4V1O018635 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Oct 2011 06:04:31 -0400 Received: from neno.neno (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9BA1lw7021320; Tue, 11 Oct 2011 06:04:27 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 11 Oct 2011 12:00:44 +0200 Message-Id: <6dd97fa371bd99c6ce5b7d8a25dc694290cf9238.1318326684.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 24/36] migration: Introduce migrate_fd_completed() for consistency X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: 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 | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/migration.c b/migration.c index 432afe6..a8e936e 100644 --- a/migration.c +++ b/migration.c @@ -317,6 +317,18 @@ 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; + runstate_set(RUN_STATE_POSTMIGRATE); + } + notifier_list_notify(&migration_state_notifiers, NULL); +} + static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; @@ -375,13 +387,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; - runstate_set(RUN_STATE_POSTMIGRATE); - notifier_list_notify(&migration_state_notifiers, NULL); - } + migrate_fd_completed(s); } if (s->get_status(s) != MIG_STATE_COMPLETED) { if (old_vm_running) {