From patchwork Fri Jul 15 16:44:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 9232311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA78260865 for ; Fri, 15 Jul 2016 16:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC1332621F for ; Fri, 15 Jul 2016 16:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0D4A27F86; Fri, 15 Jul 2016 16:46:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_HK_NAME_DR autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E4702621F for ; Fri, 15 Jul 2016 16:46:12 +0000 (UTC) Received: from localhost ([::1]:33816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO6Ff-0000Aq-Ir for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jul 2016 12:46:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO6EP-00080D-Fm for qemu-devel@nongnu.org; Fri, 15 Jul 2016 12:44:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bO6EL-0007lm-98 for qemu-devel@nongnu.org; Fri, 15 Jul 2016 12:44:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO6EL-0007le-2x for qemu-devel@nongnu.org; Fri, 15 Jul 2016 12:44:49 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A500142584 for ; Fri, 15 Jul 2016 16:44:48 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-116-73.ams2.redhat.com [10.36.116.73]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6FGilps006675; Fri, 15 Jul 2016 12:44:47 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, amit.shah@redhat.com, quintela@redhat.com Date: Fri, 15 Jul 2016 17:44:46 +0100 Message-Id: <1468601086-32117-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 15 Jul 2016 16:44:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] migration: set state to post-migrate on failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Dr. David Alan Gilbert" If a migration fails/is cancelled during the postcopy stage we currently end up with the runstate as finish-migrate, where it should be post-migrate. There's a small window in precopy where I think the same thing can happen, but I've never seen it. It rarely matters; the only postcopy case is if you restart a migration, which again is a case that rarely matters in postcopy because it's only safe to restart the migration if you know the destination hasn't been running (which you might if you started the destination with -S and hadn't got around to 'c' ing it before the postcopy failed). Even then it's a small window but potentially you could hit if there's a problem loading the devices on the destination. This corresponds to: https://bugzilla.redhat.com/show_bug.cgi?id=1355683 Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Amit Shah --- migration/migration.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index c4e0193..955d5ee 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1837,6 +1837,10 @@ static void *migration_thread(void *opaque) } else { if (old_vm_running && !entered_postcopy) { vm_start(); + } else { + if (runstate_check(RUN_STATE_FINISH_MIGRATE)) { + runstate_set(RUN_STATE_POSTMIGRATE); + } } } qemu_bh_schedule(s->cleanup_bh);