Patchwork Fwd: [PATCH v2] New cpu-max field in query-machines QMP command output

login
register
mail settings
Submitter Michal Novotny
Date April 8, 2013, 4:35 p.m.
Message ID <5162F1CD.1040809@redhat.com>
Download mbox | patch
Permalink /patch/234838/
State New
Headers show

Comments

Michal Novotny - April 8, 2013, 4:35 p.m.
Alter the query-machines QMP command to output information about
maximum number of CPUs for each machine type with default value
set to 1 in case the number of max_cpus is not set.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 qapi-schema.json | 4 +++-
 vl.c             | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index db542f6..689ca8d 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2861,11 +2861,13 @@ 
 #
 # @default: #optional whether the machine is default
 #
+# @cpu-max: maximum number of CPUs supported by the machine type
+#
 # Since: 1.2.0
 ##
 { 'type': 'MachineInfo',
   'data': { 'name': 'str', '*alias': 'str',
-            '*is-default': 'bool' } }
+            '*is-default': 'bool', 'cpu-max': 'int' } }
 
 ##
 # @query-machines:
diff --git a/vl.c b/vl.c
index a8bba04..c05b3d3 100644
--- a/vl.c
+++ b/vl.c
@@ -1617,6 +1617,7 @@  MachineInfoList *qmp_query_machines(Error **errp)
         }
 
         info->name = g_strdup(m->name);
+        info->cpu_max = !m->max_cpus ? 1 : m->max_cpus;
 
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;