From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCPrU-0006dF-9L for qemu-devel@nongnu.org; Mon, 13 Jun 2016 07:17:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCPrS-0008FN-B3 for qemu-devel@nongnu.org; Mon, 13 Jun 2016 07:16:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCPrS-0008FF-4v for qemu-devel@nongnu.org; Mon, 13 Jun 2016 07:16:54 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (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 D15F080E47 for ; Mon, 13 Jun 2016 11:16:53 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" Date: Mon, 13 Jun 2016 12:16:45 +0100 Message-Id: <1465816605-29488-7-git-send-email-dgilbert@redhat.com> In-Reply-To: <1465816605-29488-1-git-send-email-dgilbert@redhat.com> References: <1465816605-29488-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH v6 6/6] Postcopy: Check for support when setting the capability List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, quintela@redhat.com 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 7bc406a..253395c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -720,6 +720,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); @@ -742,6 +743,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; + } } } -- 2.7.4