From patchwork Mon Jun 27 05:29:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 640790 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 3rdHYJ2SdSz9syB for ; Mon, 27 Jun 2016 15:29:08 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=E0TPOk5q; dkim-atps=neutral Received: from localhost ([::1]:56531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHP6Y-00056V-0b for incoming@patchwork.ozlabs.org; Mon, 27 Jun 2016 01:29:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHP5M-0004EX-TF for qemu-devel@nongnu.org; Mon, 27 Jun 2016 01:27:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHP5L-0008Ex-14 for qemu-devel@nongnu.org; Mon, 27 Jun 2016 01:27:51 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:55673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHP5K-0008ES-Ev; Mon, 27 Jun 2016 01:27:50 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3rdHWk4kWZz9t1K; Mon, 27 Jun 2016 15:27:46 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1467005266; bh=6alkcW/R4A2EyMvTNJifLCakOwhr+FosWdUhcbktv3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0TPOk5q+EHzHXgDXnh/UMf3UDbwZlG4MBu0fmfq9RlDO1j6tnk/6HK/g4LcIF2Li TOjcamO2U8s8AynJVbeaA8NhDUb0X03BvHrkheOg/INC55iq/2p2/olc8X8S6MIE3T phqwDyEhlkwFCUxnLP9pcbCVS6VC5txIJAkbHbZ8= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 27 Jun 2016 15:29:31 +1000 Message-Id: <1467005372-23288-4-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1467005372-23288-1-git-send-email-david@gibson.dropbear.id.au> References: <1467005372-23288-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 3/4] 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: pkrempa@redhat.com, qemu-devel@nongnu.org, agraf@suse.de, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, imammedo@redhat.com, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Krempa 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 Signed-off-by: David Gibson --- 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 84b6708..a075759 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;