From patchwork Fri Sep 23 12:50:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 116101 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 28E9DB6F69 for ; Sat, 24 Sep 2011 00:39:39 +1000 (EST) Received: from localhost ([::1]:37728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75Ea-00073O-P4 for incoming@patchwork.ozlabs.org; Fri, 23 Sep 2011 08:52:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75Dr-0005Gq-TY for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:51:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R75Dq-0003JJ-M8 for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:51:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75Dq-0003JA-EL for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:51:18 -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 p8NCpHkW031495 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 23 Sep 2011 08:51:17 -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 p8NCpBpe018512; Fri, 23 Sep 2011 08:51:16 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 23 Sep 2011 14:50:38 +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 02/11] migration: simplify state assignmente 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 Once there, make sure that if we already know that there is one error, just call migration_fd_cleanup() with the ERROR state. Signed-off-by: Juan Quintela --- migration.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/migration.c b/migration.c index 7dd8f4e..531fe83 100644 --- a/migration.c +++ b/migration.c @@ -371,7 +371,6 @@ void migrate_fd_put_ready(void *opaque) DPRINTF("iterate\n"); if (qemu_savevm_state_iterate(s->mon, s->file) == 1) { - int state; int old_vm_running = runstate_is_running(); DPRINTF("done iterating\n"); @@ -381,20 +380,18 @@ void migrate_fd_put_ready(void *opaque) if (old_vm_running) { vm_start(); } - state = MIG_STATE_ERROR; - } else { - state = MIG_STATE_COMPLETED; + s->state = MIG_STATE_ERROR; } if (migrate_fd_cleanup(s) < 0) { if (old_vm_running) { vm_start(); } - state = MIG_STATE_ERROR; + s->state = MIG_STATE_ERROR; } - if (state == MIG_STATE_COMPLETED) { + if (s->state == MIG_STATE_ACTIVE) { + s->state = MIG_STATE_COMPLETED; runstate_set(RSTATE_POST_MIGRATE); } - s->state = state; notifier_list_notify(&migration_state_notifiers, NULL); } }