Skip to content

Commit

Permalink
qapi: add query-cpu-definitions command (v2)
Browse files Browse the repository at this point in the history
This command attempts to map to the behavior of -cpu ?.  Unfortunately, the
output of this command differs wildly across targets.

To accommodate this, we use a weak symbol to implement a default version of the
command that fails with a QERR_NOT_SUPPORTED error code.  Targets can then
override and implement this command if it makes sense for them.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
  • Loading branch information
Anthony Liguori authored and Luiz Capitulino committed Aug 13, 2012
1 parent 6ee373a commit e4e31c6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
23 changes: 23 additions & 0 deletions qapi-schema.json
Expand Up @@ -2222,3 +2222,26 @@
# Since: 1.2.0
##
{ 'command': 'query-machines', 'returns': ['MachineInfo'] }

##
# @CpuDefinitionInfo:
#
# Virtual CPU definition.
#
# @name: the name of the CPU definition
#
# Since: 1.2.0
##
{ 'type': 'CpuDefinitionInfo',
'data': { 'name': 'str' } }

##
# @query-cpu-definitions:
#
# Return a list of supported virtual CPU definitions
#
# Returns: a list of CpuDefInfo
#
# Since: 1.2.0
##
{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
6 changes: 6 additions & 0 deletions qmp-commands.hx
Expand Up @@ -2230,3 +2230,9 @@ EQMP
.mhandler.cmd_new = qmp_marshal_input_query_machines,
},

{
.name = "query-cpu-definitions",
.args_type = "",
.mhandler.cmd_new = qmp_marshal_input_query_cpu_definitions,
},

6 changes: 6 additions & 0 deletions qmp.c
Expand Up @@ -467,3 +467,9 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,

return prop_list;
}

CpuDefinitionInfoList GCC_WEAK *qmp_query_cpu_definitions(Error **errp)
{
error_set(errp, QERR_NOT_SUPPORTED);
return NULL;
}

0 comments on commit e4e31c6

Please sign in to comment.