Commit 62c9467d authored by Peter Krempa's avatar Peter Krempa Committed by David Gibson
Browse files

qapi: Report support for -device cpu hotplug in query-machines



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: default avatarPeter Krempa <pkrempa@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent d29f0861
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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:
+1 −0
Original line number Diff line number Diff line
@@ -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;