From patchwork Tue May 17 12:55:55 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: 623045 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 3r8HSx06t6z9t4b for ; Tue, 17 May 2016 22:58:41 +1000 (AEST) Received: from localhost ([::1]:50147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2ea6-0000ji-Qd for incoming@patchwork.ozlabs.org; Tue, 17 May 2016 08:58:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2eXo-00042t-Pv for qemu-devel@nongnu.org; Tue, 17 May 2016 08:56:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2eXh-0005M7-IA for qemu-devel@nongnu.org; Tue, 17 May 2016 08:56:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2eXh-0005Lv-74 for qemu-devel@nongnu.org; Tue, 17 May 2016 08:56:09 -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 A1A8C800A8; Tue, 17 May 2016 12:56:08 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-116-80.ams2.redhat.com [10.36.116.80]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4HCttrD024523; Tue, 17 May 2016 08:56:07 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com, amit.shah@redhat.com Date: Tue, 17 May 2016 13:55:55 +0100 Message-Id: <1463489755-30703-7-git-send-email-dgilbert@redhat.com> In-Reply-To: <1463489755-30703-1-git-send-email-dgilbert@redhat.com> References: <1463489755-30703-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.28]); Tue, 17 May 2016 12:56:08 +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 v4 6/6] Postcopy: Check for support when setting the capability 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: , Cc: aarcange@redhat.com, den@openvz.org, marcel.a@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" Knowing whether the destination host supports migration with postcopy can be tricky. The destination doesn't need the capability set, however if we set it then use the opportunity to do the test and tell the user/management layer early. Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 9d41618..9e4ba8c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -675,6 +675,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, { MigrationState *s = migrate_get_current(); MigrationCapabilityStatusList *cap; + bool old_postcopy_cap = migrate_postcopy_ram(); if (migration_is_setup_or_active(s->state)) { error_setg(errp, QERR_MIGRATION_ACTIVE); @@ -697,6 +698,19 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM] = false; } + /* This check is reasonably expensive, so only when it's being + * set the first time, also it's only the destination that needs + * special support. + */ + if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) && + !postcopy_ram_supported_by_host()) { + /* postcopy_ram_supported_by_host will have emitted a more + * detailed message + */ + error_report("Postcopy is not supported"); + s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM] = + false; + } } }