From patchwork Mon Apr 14 15:16:03 2014 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: 338989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id C4D5E1400C6 for ; Tue, 15 Apr 2014 01:16:38 +1000 (EST) Received: from localhost ([::1]:43672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZice-0004IZ-BM for incoming@patchwork.ozlabs.org; Mon, 14 Apr 2014 11:16:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZicH-0003ly-79 for qemu-devel@nongnu.org; Mon, 14 Apr 2014 11:16:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZicB-0006S0-2F for qemu-devel@nongnu.org; Mon, 14 Apr 2014 11:16:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZicA-0006Rp-Qv for qemu-devel@nongnu.org; Mon, 14 Apr 2014 11:16:06 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3EFG5Pn007319 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Apr 2014 11:16:05 -0400 Received: from dgilbert-t530.home.treblig.org (vpn1-7-233.ams2.redhat.com [10.36.7.233]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3EFG3Vd031815; Mon, 14 Apr 2014 11:16:04 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Mon, 14 Apr 2014 16:16:03 +0100 Message-Id: <1397488563-14131-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: quintela@redhat.com Subject: [Qemu-devel] [PATCH 1/1] Disallow outward migration while awaiting incoming migration 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" QEMU will assert if you attempt to start an outgoing migration on a QEMU that's sitting waiting for an incoming migration (started with -incoming), so disallow it with a proper error. (This is a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1086987 ) Signed-off-by: Dr. David Alan Gilbert --- include/qapi/qmp/qerror.h | 3 +++ migration.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index da75abf..03103cc 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -167,6 +167,9 @@ void qerror_report_err(Error *err); #define QERR_MIGRATION_NOT_SUPPORTED \ ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'" +#define QERR_MIGRATION_ON_INCOMING \ + ERROR_CLASS_GENERIC_ERROR, "Guest is waiting for an incoming migration" + #define QERR_MISSING_PARAMETER \ ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing" diff --git a/migration.c b/migration.c index bd1fb91..e99b5fa 100644 --- a/migration.c +++ b/migration.c @@ -419,6 +419,11 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, return; } + if (runstate_check(RUN_STATE_INMIGRATE)) { + error_set(errp, QERR_MIGRATION_ON_INCOMING); + return; + } + if (qemu_savevm_state_blocked(errp)) { return; }