From patchwork Tue Sep 20 14:19:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 115567 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 07E59B6F84 for ; Wed, 21 Sep 2011 01:02:28 +1000 (EST) Received: from localhost ([::1]:59605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61C7-00060o-Mu for incoming@patchwork.ozlabs.org; Tue, 20 Sep 2011 10:21:07 -0400 Received: from eggs.gnu.org ([140.186.70.92]:39218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61BJ-0004hF-Pt for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R61BE-0008B4-1a for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61BD-0008Au-FG for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:11 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8KEKAx6009362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Sep 2011 10:20:10 -0400 Received: from trasno.mitica (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8KEJv9c015328; Tue, 20 Sep 2011 10:20:09 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 20 Sep 2011 16:19:37 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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 | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/migration.c b/migration.c index 59e8f06..9d877a0 100644 --- a/migration.c +++ b/migration.c @@ -368,22 +368,21 @@ static void migrate_fd_put_ready(void *opaque) DPRINTF("done iterating\n"); vm_stop(VMSTOP_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; + 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; - } - notifier_list_notify(&migration_state_notifiers, NULL); } }