From patchwork Fri Sep 23 12:56:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 116099 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 30B9A1007D3 for ; Sat, 24 Sep 2011 00:33:54 +1000 (EST) Received: from localhost ([::1]:49643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75Ku-0002k8-VZ for incoming@patchwork.ozlabs.org; Fri, 23 Sep 2011 08:58:36 -0400 Received: from eggs.gnu.org ([140.186.70.92]:33732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KE-00019u-De for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R75KC-0004qA-3S for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KB-0004pu-SR for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:52 -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 p8NCvpFp020413 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 23 Sep 2011 08:57:51 -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 p8NCvZlj021572; Fri, 23 Sep 2011 08:57:50 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 23 Sep 2011 14:56:58 +0200 Message-Id: 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 09/23] migration: Refactor and simplify error checking in migrate_fd_put_ready 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 Signed-off-by: Juan Quintela --- migration.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/migration.c b/migration.c index abb99ea..740483d 100644 --- a/migration.c +++ b/migration.c @@ -373,23 +373,22 @@ static void migrate_fd_put_ready(void *opaque) DPRINTF("done iterating\n"); vm_stop(RSTATE_PRE_MIGRATE); - if ((qemu_savevm_state_complete(s->mon, s->file)) < 0) { - if (old_vm_running) { - vm_start(); + 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); } - s->state = MIG_STATE_ERROR; } - if (migrate_fd_cleanup(s) < 0) { + if (s->get_status(s) != MIG_STATE_COMPLETED) { if (old_vm_running) { vm_start(); } - s->state = MIG_STATE_ERROR; } - if (s->state == MIG_STATE_ACTIVE) { - s->state = MIG_STATE_COMPLETED; - runstate_set(RSTATE_POST_MIGRATE); - } - notifier_list_notify(&migration_state_notifiers, NULL); } }