monitor: introduce query-command-line-options
PATCH v5 1/1 monitor: introduce query-command-line-options
Libvirt has no way to probe if an option or property is supported, This patch introduces a new qmp command to query command line option information. hmp command isn't added because it's not needed.
---
V3: fix json schema and comments (Eric)
V4: fix descriptions, rename command, check enum type, cleanup
(Luiz, Eric)
V5: fix typo, cleanup (Osier)
--- qapi-schema.json | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 47 ++++++++++++++++++++++++++++++++++++++ util/qemu-config.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+)
qapi-schema.json +66 -0
@@ -3505,3 +3505,69 @@ '*asl_compiler_rev': 'uint32', '*file': 'str', '*data': 'str' }} + +## +# @CommandLineParameterType: +# +# Possible types for an option parameter. +# +# @string: accepts a character string +# +# @boolean: accepts "on" or "off" +# +# @number: accepts a number +# +# @size: accepts a number followed by an optional postfix (K)ilo, +# (M)ega, (G)iga, (T)era +# +# Since 1.5 +## +{ 'enum': 'CommandLineParameterType', + 'data': ['string', 'boolean', 'number', 'size'] } + +## +# @CommandLineParameterInfo: +# +# Details about a single parameter of a command line option. +# +# @name: parameter name +# +# @type: parameter @CommandLineParameterType +# +# @help: #optional human readable text string, not suitable for parsing. +# +# Since 1.5 +## +{ 'type': 'CommandLineParameterInfo', + 'data': { 'name': 'str', + 'type': 'CommandLineParameterType', + '*help': 'str' } } + +## +# @CommandLineOptionInfo: +# +# Details about a command line option, including its list of parameters details +# +# @option: option name +# +# @parameters: an array of @CommandLineParameterInfo +# +# Since 1.5 +## +{ 'type': 'CommandLineOptionInfo', + 'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } } + +## +# @query-command-line-options: +# +# Query command line option schema. +# +# @option: #optional option name +# +# Returns: list of @CommandLineOptionInfo for all options (or for the given +# @option). Returns an error if the given @option doesn't exist. +# +# Since 1.5 +## +{'command': 'query-command-line-options', 'data': { '*option': 'str' }, + 'returns': ['CommandLineOptionInfo'] }
qmp-commands.hx +47 -0
53 lines not on this page · raw message
util/qemu-config.c +67 -0
79 lines not on this page · raw message
Signature · 1 line
1.8.1.4
Quoted 8 lines · On Thu, 25 Apr 2013 17:50:35 +0800 Amos Kong <[email protected]> wrote:
Libvirt has no way to probe if an option or property is supported, This patch introduces a new qmp command to query command line option information. hmp command isn't added because it's not needed.
Signed-off-by Amos Kong <[email protected]>CC Luiz Capitulino <[email protected]>CC Osier Yang <[email protected]>CC Anthony Liguori <[email protected]>
This version looks good to me, but it has two small problems.
First, some options like -drive, -net, -netdev and -device have an empty QemuOptsList, meaning that option validation is not done upfront.
The other problem is that we're returning some options which seem to be created at run-time and I honestly have never heard of them, like tmpdev and acpi.
I think there are two possible fixes for both issues:
1. Do nothing, accept patch as is and fix things in 1.6
2. Don't return an option when 'desc' is NULL
I'm willing to do 1, as those options don't return any options anyway and I don't believe any client will mess with them (worst case the client will pass an option qemu doesn't accept and will refuse to run).
I have one more comment below, but case we accept to do 1 I can fix it myself.
Quoted 74 lines
---
V3: fix json schema and comments (Eric)
V4: fix descriptions, rename command, check enum type, cleanup
(Luiz, Eric)
V5: fix typo, cleanup (Osier)--- qapi-schema.json | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 47 ++++++++++++++++++++++++++++++++++++++ util/qemu-config.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+)qapi-schema.json +55
-0@@ -3505,3 +3505,69 @@ '*asl_compiler_rev': 'uint32', '*file': 'str', '*data': 'str' }} + +## +# @CommandLineParameterType: +# +# Possible types for an option parameter. +# +# @string: accepts a character string +# +# @boolean: accepts "on" or "off" +# +# @number: accepts a number +# +# @size: accepts a number followed by an optional postfix (K)ilo, +# (M)ega, (G)iga, (T)era +# +# Since 1.5 +## +{ 'enum': 'CommandLineParameterType', + 'data': ['string', 'boolean', 'number', 'size'] } + +## +# @CommandLineParameterInfo: +# +# Details about a single parameter of a command line option. +# +# @name: parameter name +# +# @type: parameter @CommandLineParameterType +# +# @help: #optional human readable text string, not suitable for parsing. +# +# Since 1.5 +## +{ 'type': 'CommandLineParameterInfo', + 'data': { 'name': 'str', + 'type': 'CommandLineParameterType', + '*help': 'str' } } + +## +# @CommandLineOptionInfo: +# +# Details about a command line option, including its list of parameters details +# +# @option: option name +# +# @parameters: an array of @CommandLineParameterInfo +# +# Since 1.5 +## +{ 'type': 'CommandLineOptionInfo', + 'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } } + +## +# @query-command-line-options: +#
qapi-schema.json line 3572
Quoted 10 lines
qapi-schema.json +10
-0+# Query command line option schema. +# +# @option: #optional option name +# +# Returns: list of @CommandLineOptionInfo for all options (or for the given +# @option). Returns an error if the given @option doesn't exist. +# +# Since 1.5 +## +{'command': 'query-command-line-options', 'data': { '*option': 'str' },
I'm not a huge fan of option being optional, I prefer dropping it and making the command simpler. But I won't refuse the patch because of that.
Quoted 126 lines
qapi-schema.json +1
-0+ 'returns': ['CommandLineOptionInfo'] }qmp-commands.hx +47
-0@@ -2416,6 +2416,53 @@ EQMP }, SQMP +query-command-line-options +-------------------------- + +Show command line option schema. + +Return a json-array of command line option schema for all options (or for +the given option), returning an error if the given option doesn't exist. + +Each array entry contains the following: + +- "option": option name (json-string) +- "parameters": a json-array describes all parameters of the option: + - "name": parameter name (json-string) + - "type": parameter type (one of 'string', boolean', 'number', + or 'size') + - "help": human readable description of the parameter + (json-string, optional) + +Example: + +-> { "execute": "query-command-line-options", "arguments": { "option": "option-rom" } } +<- { "return": [ + { + "parameters": [ + { + "name": "romfile", + "type": "string" + }, + { + "name": "bootindex", + "type": "number" + } + ], + "option": "option-rom" + } + ] + } + +EQMP + + { + .name = "query-command-line-options", + .args_type = "option:s?", + .mhandler.cmd_new = qmp_marshal_input_query_command_line_options, + }, + +SQMP query-migrate -------------util/qemu-config.c +52
-0@@ -5,6 +5,7 @@#include "qapi/qmp/qerror.h" #include "hw/qdev.h" #include "qapi/error.h" +#include "qmp-commands.h" static QemuOptsList *vm_config_groups[32 ];@@ -37,6 +38,72 @@ QemuOptsList *qemu_find_opts(const char *group)return ret; } +static CommandLineParameterInfoList *query_option_descs (const QemuOptDesc *desc) +{ +CommandLineParameterInfoList *param_list =NULL , *entry; +CommandLineParameterInfo *info; +int i; + +for (i =0 ; desc[i].name !=NULL ; i++) { + info =g_malloc0 (sizeof (*info)); + info->name =g_strdup (desc[i].name); + +switch (desc[i].type) { +case QEMU_OPT_STRING : + info->type =COMMAND_LINE_PARAMETER_TYPE_STRING ; +break ; +case QEMU_OPT_BOOL : + info->type =COMMAND_LINE_PARAMETER_TYPE_BOOLEAN ; +break ; +case QEMU_OPT_NUMBER : + info->type =COMMAND_LINE_PARAMETER_TYPE_NUMBER ; +break ; +case QEMU_OPT_SIZE : + info->type =COMMAND_LINE_PARAMETER_TYPE_SIZE ; +break ; + } + +if (desc[i].help) { + info->has_help = true; + info->help =g_strdup (desc[i].help); + } + + entry =g_malloc0 (sizeof (*entry)); + entry->value = info; + entry->next = param_list; + param_list = entry; + } + +return param_list; +} + +CommandLineOptionInfoList *qmp_query_command_line_options (bool has_option, +const char *option, +Error **errp) +{ +CommandLineOptionInfoList *conf_list =NULL , *entry; +CommandLineOptionInfo *info; +int i; + +for (i =0 ; vm_config_groups[i] !=NULL ; i++) { +if (!has_option || !strcmp (option, vm_config_groups[i]->name)) { + info =g_malloc0 (sizeof (*info)); + info->option =g_strdup (vm_config_groups[i]->name);
util/qemu-config.c QemuOptsList *qemu_find_opts(const char *group) · line 101
Quoted 10 lines
util/qemu-config.c +10
-0+ info->parameters =query_option_descs (vm_config_groups[i]->desc); + entry =g_malloc0 (sizeof (*entry)); + entry->value = info; + entry->next = conf_list; + conf_list = entry; + } + } + +if (conf_list ==NULL ) { +error_set (errp,QERR_INVALID_OPTION_GROUP , option);
You should be using error_setg() like:
error_setg(errp, "invalid option name: %s", option);
But I can fix that myself in qmp branch.
Quoted 8 lines
util/qemu-config.c +5
-0+ } + +return conf_list; +} +QemuOptsList *qemu_find_opts_err (const char *group,Error **errp) {return find_list (vm_config_groups, group, errp);
Quoted 17 lines · Luiz Capitulino
Quoted 8 lines · On Thu, 25 Apr 2013 17:50:35 +0800 Amos Kong <[email protected]> wrote:
Libvirt has no way to probe if an option or property is supported, This patch introduces a new qmp command to query command line option information. hmp command isn't added because it's not needed.
Signed-off-by Amos Kong <[email protected]>CC Luiz Capitulino <[email protected]>CC Osier Yang <[email protected]>CC Anthony Liguori <[email protected]>This version looks good to me, but it has two small problems.
First, some options like -drive, -net, -netdev and -device have an empty QemuOptsList, meaning that option validation is not done upfront.
Quoted 7 lines
The other problem is that we're returning some options which seem to be created at run-time and I honestly have never heard of them, like tmpdev and acpi.
I think there are two possible fixes for both issues:
1. Do nothing, accept patch as is and fix things in 1.6
I can live with this for 1.5. Initially, libvirt will probably only be querying whether a set of known option names exist, and not looking at the parameter definitions tied to the option nor trying to invoke command line options that libvirt doesn't already know. Put another way, the driving factor to get this into 1.5 is so that libvirt knows whether it can use -mem-merge:
https://www.redhat.com/archives/libvir-list/2013-April/msg01263.html
While I anticipate that future libvirt versions may get fancier and use even more details of option introspection, such as learning whether a parameter was added in a later release, that's not the driving factor right now.
Quoted 2 lines
2. Don't return an option when 'desc' is NULL
That might backfire; it's better to output too much than too little.
Quoted 4 lines
I'm willing to do 1, as those options don't return any options anyway and I don't believe any client will mess with them (worst case the client will pass an option qemu doesn't accept and will refuse to run).
Yep, and libvirt certainly won't be calling 'qemu -tmpdev'.
Quoted 8 lines
I have one more comment below, but case we accept to do 1 I can fix it myself.
Quoted 1 line
+{'command': 'query-command-line-options', 'data': { '*option': 'str' },
I'm not a huge fan of option being optional, I prefer dropping it and making the command simpler. But I won't refuse the patch because of that.
I'm leaving that up to you. I personally like the idea of filtering (I would definitely use it via 'virsh qemu-monitor-command' when doing development work on libvirt), but it's not essential.
Quoted 8 lines
util/qemu-config.c QemuOptsList *qemu_find_opts(const char *group) · line 101
Quoted 2 lines
util/qemu-config.c +2
-0+if (conf_list ==NULL ) { +error_set (errp,QERR_INVALID_OPTION_GROUP , option);You should be using
error_setg()like:
error_setg(errp, "invalid option name: %s", option);But I can fix that myself in qmp branch.
Based on include/qapi/qmp/qerror.h, the message you would be replacing is:
#define QERR_INVALID_OPTION_GROUP \
ERROR_CLASS_GENERIC_ERROR, "There is no option group '%s'"
Yeah, "invalid option name: foo" reads better than "There is no option group 'foo'".
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 7 lines · Luiz Capitulino
Quoted 4 lines · On Thu, 25 Apr 2013 17:50:35 +0800 Amos Kong <[email protected]> wrote:
Libvirt has no way to probe if an option or property is supported, This patch introduces a new qmp command to query command line option information. hmp command isn't added because it's not needed.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Amos Kong <[email protected]>CC Luiz Capitulino <[email protected]>CC Osier Yang <[email protected]>CC Anthony Liguori <[email protected]>This version looks good to me, but it has two small problems.
First, some options like -drive, -net, -netdev and -device have an empty QemuOptsList, meaning that option validation is not done upfront.
Not sure if there is work of libvirt which is blocked by -net, -netdev, and -device, but I have one which needs to probe the properties of -drive.
https://bugzilla.redhat.com/show_bug.cgi?id=821045
Quoted 7 lines
The other problem is that we're returning some options which seem to be created at run-time and I honestly have never heard of them, like tmpdev and acpi.
I think there are two possible fixes for both issues:
Quoted 7 lines
1. Do nothing, accept patch as is and fix things in 1.6
2. Don't return an option when 'desc' is NULL
I'm willing to do 1, as those options don't return any options anyway and I don't believe any client will mess with them (worst case the client will pass an option qemu doesn't accept and will refuse to run).
1 sounds better, it doesn't hurt for libvirt to recongnize the empty result, and it may even better because at least we known the option is supported, even the result is empty.
For the "-drive" properties probing, not sure if we can wait till 1.6.
Quoted 240 lines
I have one more comment below, but case we accept to do 1 I can fix it myself.
Quoted 74 lines
---
V3: fix json schema and comments (Eric)
V4: fix descriptions, rename command, check enum type, cleanup
(Luiz, Eric)
V5: fix typo, cleanup (Osier)--- qapi-schema.json | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 47 ++++++++++++++++++++++++++++++++++++++ util/qemu-config.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+)qapi-schema.json +55
-0@@ -3505,3 +3505,69 @@ '*asl_compiler_rev': 'uint32', '*file': 'str', '*data': 'str' }} + +## +# @CommandLineParameterType: +# +# Possible types for an option parameter. +# +# @string: accepts a character string +# +# @boolean: accepts "on" or "off" +# +# @number: accepts a number +# +# @size: accepts a number followed by an optional postfix (K)ilo, +# (M)ega, (G)iga, (T)era +# +# Since 1.5 +## +{ 'enum': 'CommandLineParameterType', + 'data': ['string', 'boolean', 'number', 'size'] } + +## +# @CommandLineParameterInfo: +# +# Details about a single parameter of a command line option. +# +# @name: parameter name +# +# @type: parameter @CommandLineParameterType +# +# @help: #optional human readable text string, not suitable for parsing. +# +# Since 1.5 +## +{ 'type': 'CommandLineParameterInfo', + 'data': { 'name': 'str', + 'type': 'CommandLineParameterType', + '*help': 'str' } } + +## +# @CommandLineOptionInfo: +# +# Details about a command line option, including its list of parameters details +# +# @option: option name +# +# @parameters: an array of @CommandLineParameterInfo +# +# Since 1.5 +## +{ 'type': 'CommandLineOptionInfo', + 'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } } + +## +# @query-command-line-options: +#qapi-schema.json line 3572
Quoted 10 lines
qapi-schema.json +10
-0+# Query command line option schema. +# +# @option: #optional option name +# +# Returns: list of @CommandLineOptionInfo for all options (or for the given +# @option). Returns an error if the given @option doesn't exist. +# +# Since 1.5 +## +{'command': 'query-command-line-options', 'data': { '*option': 'str' },I'm not a huge fan of option being optional, I prefer dropping it and making the command simpler. But I won't refuse the patch because of that.
Quoted 126 lines
qapi-schema.json +1
-0+ 'returns': ['CommandLineOptionInfo'] }qmp-commands.hx +47
-0@@ -2416,6 +2416,53 @@ EQMP }, SQMP +query-command-line-options +-------------------------- + +Show command line option schema. + +Return a json-array of command line option schema for all options (or for +the given option), returning an error if the given option doesn't exist. + +Each array entry contains the following: + +- "option": option name (json-string) +- "parameters": a json-array describes all parameters of the option: + - "name": parameter name (json-string) + - "type": parameter type (one of 'string', boolean', 'number', + or 'size') + - "help": human readable description of the parameter + (json-string, optional) + +Example: + +-> { "execute": "query-command-line-options", "arguments": { "option": "option-rom" } } +<- { "return": [ + { + "parameters": [ + { + "name": "romfile", + "type": "string" + }, + { + "name": "bootindex", + "type": "number" + } + ], + "option": "option-rom" + } + ] + } + +EQMP + + { + .name = "query-command-line-options", + .args_type = "option:s?", + .mhandler.cmd_new = qmp_marshal_input_query_command_line_options, + }, + +SQMP query-migrate -------------util/qemu-config.c +52
-0@@ -5,6 +5,7 @@#include "qapi/qmp/qerror.h" #include "hw/qdev.h" #include "qapi/error.h" +#include "qmp-commands.h" static QemuOptsList *vm_config_groups[32 ];@@ -37,6 +38,72 @@ QemuOptsList *qemu_find_opts(const char *group)return ret; } +static CommandLineParameterInfoList *query_option_descs (const QemuOptDesc *desc) +{ +CommandLineParameterInfoList *param_list =NULL , *entry; +CommandLineParameterInfo *info; +int i; + +for (i =0 ; desc[i].name !=NULL ; i++) { + info =g_malloc0 (sizeof (*info)); + info->name =g_strdup (desc[i].name); + +switch (desc[i].type) { +case QEMU_OPT_STRING : + info->type =COMMAND_LINE_PARAMETER_TYPE_STRING ; +break ; +case QEMU_OPT_BOOL : + info->type =COMMAND_LINE_PARAMETER_TYPE_BOOLEAN ; +break ; +case QEMU_OPT_NUMBER : + info->type =COMMAND_LINE_PARAMETER_TYPE_NUMBER ; +break ; +case QEMU_OPT_SIZE : + info->type =COMMAND_LINE_PARAMETER_TYPE_SIZE ; +break ; + } + +if (desc[i].help) { + info->has_help = true; + info->help =g_strdup (desc[i].help); + } + + entry =g_malloc0 (sizeof (*entry)); + entry->value = info; + entry->next = param_list; + param_list = entry; + } + +return param_list; +} + +CommandLineOptionInfoList *qmp_query_command_line_options (bool has_option, +const char *option, +Error **errp) +{ +CommandLineOptionInfoList *conf_list =NULL , *entry; +CommandLineOptionInfo *info; +int i; + +for (i =0 ; vm_config_groups[i] !=NULL ; i++) { +if (!has_option || !strcmp (option, vm_config_groups[i]->name)) { + info =g_malloc0 (sizeof (*info)); + info->option =g_strdup (vm_config_groups[i]->name);util/qemu-config.c QemuOptsList *qemu_find_opts(const char *group) · line 101
Quoted 10 lines
util/qemu-config.c +10
-0+ info->parameters =query_option_descs (vm_config_groups[i]->desc); + entry =g_malloc0 (sizeof (*entry)); + entry->value = info; + entry->next = conf_list; + conf_list = entry; + } + } + +if (conf_list ==NULL ) { +error_set (errp,QERR_INVALID_OPTION_GROUP , option);You should be using
error_setg()like:error_setg(errp, "invalid option name: %s", option);But I can fix that myself in qmp branch.
Quoted 8 lines
util/qemu-config.c +5
-0+ } + +return conf_list; +} +QemuOptsList *qemu_find_opts_err (const char *group,Error **errp) {return find_list (vm_config_groups, group, errp);
Quoted 7 lines · Osier Yang
Quoted 2 lines
First, some options like -drive, -net, -netdev and -device have an empty QemuOptsList, meaning that option validation is not done upfront.
Not sure if there is work of libvirt which is blocked by -net, -netdev, and -device, but I have one which needs to probe the properties of -drive.
That BZ is not public; but the gist of it talked about whether a future RHEL should support Paolo's work on providing thin-provisioning options as a parameter to -drive, and as far as I can see, that didn't land in upstream 1.5.
I'm fairly certain that since we plan adding even more -drive capabilities than just Paolo's provisioning options in the 1.6 timeframe (such as a QMP setting of backing file parameters, including fd passing of a backing file during hotplug/snapshot/drive-mirror...), that we are safe in suspecting that distros will either rebase to 1.6, or take on the burden of backporting the parts of 1.6 that make sense for the features they want to support on whatever earlier qemu version they branch from. That means distros will be smart about backporting enough to give libvirt enough to go on for using those features as part of the distro's value-added premise. (ie. if your BZ is about a feature that doesn't land in 1.5, then you can assume that even if RHEL decides to base on 1.5 instead of 1.6, there will be enough of 1.6 backported to make use of your feature easy to probe for. Of course, all bets are off when guessing on a public list what Red Hat will actually use as their baseline for a future RHEL release, or whether the BZ will even be accepted - but then again, that's a problem for downstream to worry about, and shouldn't affect what we put into 1.5 upstream).
And I just realized: this patch is queued to go into 1.5, and if I read it correctly, then once applied, -drive will no longer be empty in query-command-line-options output:
https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg04810.html
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 13 lines · Amos Kong
Libvirt has no way to probe if an option or property is supported, This patch introduces a new qmp command to query command line option information. hmp command isn't added because it's not needed.
Signed-off-by Amos Kong <[email protected]>CC Luiz Capitulino <[email protected]>CC Osier Yang <[email protected]>CC Anthony Liguori <[email protected]>---
V3: fix json schema and comments (Eric)
V4: fix descriptions, rename command, check enum type, cleanup
(Luiz, Eric)
V5: fix typo, cleanup (Osier)
Quoted 5 lines
--- qapi-schema.json | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 47 ++++++++++++++++++++++++++++++++++++++ util/qemu-config.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+)
Only minor typo fixups below; I'm assuming Luiz can fix them up while putting on the QMP pull request, without needing to see a v6.
qapi-schema.json line 3520
Quoted 12 lines
qapi-schema.json +12
-0+## +# @CommandLineParameterType: +# +# Possible types for an option parameter. +# +# @string: accepts a character string +# +# @boolean: accepts "on" or "off" +# +# @number: accepts a number +# +# @size: accepts a number followed by an optional postfix (K)ilo,
s/postfix/suffix/
qapi-schema.json line 3549
Quoted 5 lines
qapi-schema.json +5
-0+ +## +# @CommandLineOptionInfo: +# +# Details about a command line option, including its list of parameters details
s/parameters/parameter/
Quoted 4 lines
qapi-schema.json +4
-0+## +# @query-command-line-options: +# +# Query command line option schema.
qapi-schema.json line 3573
Quoted 10 lines
qapi-schema.json +10
-0+# +# @option: #optional option name +# +# Returns: list of @CommandLineOptionInfo for all options (or for the given +# @option). Returns an error if the given @option doesn't exist. +# +# Since 1.5 +## +{'command': 'query-command-line-options', 'data': { '*option': 'str' }, + 'returns': ['CommandLineOptionInfo'] }
Libvirt probably won't use the optional 'option' argument. I don't care whether you leave it in or Luiz takes filtering out for the 1.5 release.
Quoted 12 lines
qmp-commands.hx +4
-0@@ -2416,6 +2416,53 @@ EQMP }, SQMP +query-command-line-options +-------------------------- + +Show command line option schema.
qmp-commands.hx EQMP · line 2432
Quoted 10 lines
qmp-commands.hx +10
-0+ +Return a json-array of command line option schema for all options (or for +the given option), returning an error if the given option doesn't exist. + +Each array entry contains the following: + +- "option": option name (json-string) +- "parameters": a json-array describes all parameters of the option: + - "name": parameter name (json-string) + - "type": parameter type (one of 'string', boolean', 'number',
s/boolean'/'boolean'/
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Luiz Capitulino
AppliedQuoted 20 lines · On Thu, 25 Apr 2013 07:57:11 -0600 Eric Blake <[email protected]> wrote:
Quoted 13 lines · Amos Kong
Libvirt has no way to probe if an option or property is supported, This patch introduces a new qmp command to query command line option information. hmp command isn't added because it's not needed.
Signed-off-by Amos Kong <[email protected]>CC Luiz Capitulino <[email protected]>CC Osier Yang <[email protected]>CC Anthony Liguori <[email protected]>---
V3: fix json schema and comments (Eric)
V4: fix descriptions, rename command, check enum type, cleanup
(Luiz, Eric)
V5: fix typo, cleanup (Osier)Quoted 5 lines
--- qapi-schema.json | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 47 ++++++++++++++++++++++++++++++++++++++ util/qemu-config.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+)
Quoted 2 lines
Only minor typo fixups below; I'm assuming Luiz can fix them up while putting on the QMP pull request, without needing to see a v6.
Yes.
Applied to the qmp branch, thanks.
Quoted 69 lines
Reviewed-by Eric Blake <[email protected]>qapi-schema.json line 3520
Quoted 12 lines
qapi-schema.json +12
-0+## +# @CommandLineParameterType: +# +# Possible types for an option parameter. +# +# @string: accepts a character string +# +# @boolean: accepts "on" or "off" +# +# @number: accepts a number +# +# @size: accepts a number followed by an optional postfix (K)ilo,s/postfix/suffix/
qapi-schema.json line 3549
Quoted 5 lines
qapi-schema.json +5
-0+ +## +# @CommandLineOptionInfo: +# +# Details about a command line option, including its list of parameters detailss/parameters/parameter/
Quoted 4 lines
qapi-schema.json +4
-0+## +# @query-command-line-options: +# +# Query command line option schema.qapi-schema.json line 3573
Quoted 10 lines
qapi-schema.json +10
-0+# +# @option: #optional option name +# +# Returns: list of @CommandLineOptionInfo for all options (or for the given +# @option). Returns an error if the given @option doesn't exist. +# +# Since 1.5 +## +{'command': 'query-command-line-options', 'data': { '*option': 'str' }, + 'returns': ['CommandLineOptionInfo'] }Libvirt probably won't use the optional 'option' argument. I don't care whether you leave it in or Luiz takes filtering out for the 1.5 release.
Quoted 12 lines
qmp-commands.hx +4
-0@@ -2416,6 +2416,53 @@ EQMP }, SQMP +query-command-line-options +-------------------------- + +Show command line option schema.qmp-commands.hx EQMP · line 2432
Quoted 10 lines
qmp-commands.hx +10
-0+ +Return a json-array of command line option schema for all options (or for +the given option), returning an error if the given option doesn't exist. + +Each array entry contains the following: + +- "option": option name (json-string) +- "parameters": a json-array describes all parameters of the option: + - "name": parameter name (json-string) + - "type": parameter type (one of 'string', boolean', 'number',s/boolean'/'boolean'/