From patchwork Tue Sep 20 14:19: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: 115550 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 39C80B70FF for ; Wed, 21 Sep 2011 00:20:50 +1000 (EST) Received: from localhost ([::1]:57265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61Be-0004oq-SV for incoming@patchwork.ozlabs.org; Tue, 20 Sep 2011 10:20:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:39191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61BH-0004Yv-A5 for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R61BE-0008BF-HS for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61BE-0008Az-AV for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:12 -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 p8KEKBuo015072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Sep 2011 10:20:11 -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 p8KEJv9d015328; Tue, 20 Sep 2011 10:20:10 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 20 Sep 2011 16:19:38 +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 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 | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/migration.c b/migration.c index 9d877a0..15a363d 100644 --- a/migration.c +++ b/migration.c @@ -317,6 +317,17 @@ 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; + } + notifier_list_notify(&migration_state_notifiers, NULL); +} + static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; @@ -371,12 +382,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; - notifier_list_notify(&migration_state_notifiers, NULL); - } + migrate_fd_completed(s); } if (s->get_status(s) != MIG_STATE_COMPLETED) { if (old_vm_running) {