From patchwork Wed Oct 21 17:52:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 534079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0B30D141308 for ; Thu, 22 Oct 2015 08:06:54 +1100 (AEDT) Received: from localhost ([::1]:53310 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zoxpl-0003Ip-V5 for incoming@patchwork.ozlabs.org; Wed, 21 Oct 2015 14:09:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoxbX-0006BX-TO for qemu-devel@nongnu.org; Wed, 21 Oct 2015 13:55:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoxbS-0006l9-Sd for qemu-devel@nongnu.org; Wed, 21 Oct 2015 13:55:15 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:43695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoxbS-0006ko-Lx for qemu-devel@nongnu.org; Wed, 21 Oct 2015 13:55:10 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Oct 2015 11:55:10 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 21 Oct 2015 11:55:07 -0600 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: mdroth@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-stable@nongnu.org Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id A334119D8062; Wed, 21 Oct 2015 11:43:12 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9LHt2Fr56754358; Wed, 21 Oct 2015 10:55:02 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9LHt1kO012555; Wed, 21 Oct 2015 11:55:02 -0600 Received: from localhost ([9.80.97.229]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t9LHt0Pk012356; Wed, 21 Oct 2015 11:55:00 -0600 From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 21 Oct 2015 12:52:09 -0500 Message-Id: <1445449930-23525-40-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445449930-23525-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1445449930-23525-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15102117-0005-0000-0000-0000192F64B9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.110.150 Cc: Michael Roth , qemu-stable@nongnu.org, "Dr. David Alan Gilbert" Subject: [Qemu-devel] [PATCH 39/40] Migration: Generate the completed event only when we complete 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 From: "Dr. David Alan Gilbert" The current migration-completed event is generated a bit too early, which means that an eager libvirt that's ready to go as soon as it sees the event ends up racing with the actual end of migration. This corresponds to RH bug: https://bugzilla.redhat.com/show_bug.cgi?id=1271145 Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Reviewed-by: Amit Shah xSigned-off-by: Juan Quintela (cherry picked from commit ed1f3e0090069dcb9458aa9e450df12bf8eba0b0) Signed-off-by: Michael Roth --- migration/migration.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 662e77e..c4a7d0b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -286,12 +286,12 @@ static void process_incoming_migration_co(void *opaque) migrate_decompress_threads_join(); exit(EXIT_FAILURE); } - migrate_generate_event(MIGRATION_STATUS_COMPLETED); qemu_announce_self(); /* Make sure all file formats flush their mutable metadata */ bdrv_invalidate_cache_all(&local_err); if (local_err) { + migrate_generate_event(MIGRATION_STATUS_FAILED); error_report_err(local_err); migrate_decompress_threads_join(); exit(EXIT_FAILURE); @@ -312,6 +312,12 @@ static void process_incoming_migration_co(void *opaque) runstate_set(global_state_get_runstate()); } migrate_decompress_threads_join(); + /* + * This must happen after any state changes since as soon as an external + * observer sees this event they might start to prod at the VM assuming + * it's ready to use. + */ + migrate_generate_event(MIGRATION_STATUS_COMPLETED); } void process_incoming_migration(QEMUFile *f)