From patchwork Fri Sep 23 12:56:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 116083 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 16D10B6F84 for ; Sat, 24 Sep 2011 00:12:13 +1000 (EST) Received: from localhost ([::1]:50789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75LD-0003MQ-Lc for incoming@patchwork.ozlabs.org; Fri, 23 Sep 2011 08:58:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]:33739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KF-0001CM-7q for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R75KD-0004qW-S8 for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KD-0004qM-8A for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:53 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8NCvqZw001522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 23 Sep 2011 08:57:52 -0400 Received: from neno.neno (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8NCvZlk021572; Fri, 23 Sep 2011 08:57:51 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 23 Sep 2011 14:56:59 +0200 Message-Id: <958232891ad666aa1376196a734232f313ffa37c.1316782367.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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 10/23] 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 740483d..40fda7d 100644 --- a/migration.c +++ b/migration.c @@ -318,6 +318,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(RSTATE_POST_MIGRATE); + } + notifier_list_notify(&migration_state_notifiers, NULL); +} + static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; @@ -376,13 +388,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(RSTATE_POST_MIGRATE); - notifier_list_notify(&migration_state_notifiers, NULL); - } + migrate_fd_completed(s); } if (s->get_status(s) != MIG_STATE_COMPLETED) { if (old_vm_running) {