From patchwork Thu Jun 23 21:23:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krempa X-Patchwork-Id: 9196039 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 42CA86077D for ; Thu, 23 Jun 2016 21:24:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31AF42846C for ; Thu, 23 Jun 2016 21:24:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2692728477; Thu, 23 Jun 2016 21:24:02 +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 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 F3AD22846C for ; Thu, 23 Jun 2016 21:24:00 +0000 (UTC) Received: from localhost ([::1]:39527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGC6S-0007Se-28 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 23 Jun 2016 17:24:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGC60-0007Qu-7H for qemu-devel@nongnu.org; Thu, 23 Jun 2016 17:23:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGC5t-0004W9-22 for qemu-devel@nongnu.org; Thu, 23 Jun 2016 17:23:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGC5s-0004W4-SV for qemu-devel@nongnu.org; Thu, 23 Jun 2016 17:23:24 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 6D8EB7F6B4 for ; Thu, 23 Jun 2016 21:23:24 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-199.brq.redhat.com [10.34.129.199]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5NLNLip031633; Thu, 23 Jun 2016 17:23:23 -0400 From: Peter Krempa To: qemu-devel@nongnu.org Date: Thu, 23 Jun 2016 23:23:33 +0200 Message-Id: <7f98e40b05dd13db79c9bc46479739c3138e858e.1466716710.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 23 Jun 2016 21:23:24 +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 v2 1/2] qapi: Report support for -device cpu hotplug in query-machines 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: Igor Mammedov , Peter Krempa , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP For management apps it's very useful to know whether the selected machine type supports cpu hotplug via the new -device approach. Using the presence of 'query-hotpluggable-cpus' alone is not enough as a witness. Add a property to 'MachineInfo' called 'hotpluggable-cpus' that will report the presence of this feature. Example of output: { "hotpluggable-cpus": false, "name": "mac99", "cpu-max": 1 }, { "hotpluggable-cpus": true, "name": "pseries-2.7", "is-default": true, "cpu-max": 255, "alias": "pseries" }, Signed-off-by: Peter Krempa Reviewed-by: Eric Blake Reviewed-by: Igor Mammedov --- qapi-schema.json | 5 ++++- vl.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qapi-schema.json b/qapi-schema.json index 0964eec..24ede28 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -2986,11 +2986,14 @@ # @cpu-max: maximum number of CPUs supported by the machine type # (since 1.5.0) # +# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0) +# # Since: 1.2.0 ## { 'struct': 'MachineInfo', 'data': { 'name': 'str', '*alias': 'str', - '*is-default': 'bool', 'cpu-max': 'int' } } + '*is-default': 'bool', 'cpu-max': 'int', + 'hotpluggable-cpus': 'bool'} } ## # @query-machines: diff --git a/vl.c b/vl.c index c85833a..4c1f9ae 100644 --- a/vl.c +++ b/vl.c @@ -1524,6 +1524,7 @@ MachineInfoList *qmp_query_machines(Error **errp) info->name = g_strdup(mc->name); info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; + info->hotpluggable_cpus = !!mc->query_hotpluggable_cpus; entry = g_malloc0(sizeof(*entry)); entry->value = info;