* [Qemu-devel] [PATCH v2] qemu-ga: report success-response field in guest-info
@ 2012-08-21 12:03 Michal Privoznik
2012-08-21 12:17 ` [Qemu-devel] For 1.2: " Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Michal Privoznik @ 2012-08-21 12:03 UTC (permalink / raw)
To: qemu-devel
This is a useful hint for users (or libvirt) whether a command returns
anything success and hence wait for reply or not.
---
diff to v1:
-changed condition in qmp_command_reports_success per Paolo's advice
qapi-schema-guest.json | 6 +++++-
qapi/qmp-core.h | 1 +
qapi/qmp-registry.c | 12 ++++++++++++
qga/commands.c | 1 +
4 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/qapi-schema-guest.json b/qapi-schema-guest.json
index d955cf1..2cd5957 100644
--- a/qapi-schema-guest.json
+++ b/qapi-schema-guest.json
@@ -91,10 +91,14 @@
#
# @enabled: whether command is currently enabled by guest admin
#
+# @success-response: whether command report success response or not.
+# See 'uest-shutdown' command for more detailed info.
+#
# Since 1.1.0
##
{ 'type': 'GuestAgentCommandInfo',
- 'data': { 'name': 'str', 'enabled': 'bool' } }
+ 'data': { 'name': 'str', 'enabled': 'bool',
+ 'success-response': 'bool'} }
##
# @GuestAgentInfo
diff --git a/qapi/qmp-core.h b/qapi/qmp-core.h
index 00446cf..271c3f2 100644
--- a/qapi/qmp-core.h
+++ b/qapi/qmp-core.h
@@ -48,6 +48,7 @@ QObject *qmp_dispatch(QObject *request);
void qmp_disable_command(const char *name);
void qmp_enable_command(const char *name);
bool qmp_command_is_enabled(const char *name);
+bool qmp_command_reports_success(const char *name);
char **qmp_get_command_list(void);
QObject *qmp_build_error_object(Error *errp);
diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c
index 5414613..3f7303c 100644
--- a/qapi/qmp-registry.c
+++ b/qapi/qmp-registry.c
@@ -77,6 +77,18 @@ bool qmp_command_is_enabled(const char *name)
return false;
}
+bool qmp_command_reports_success(const char *name) {
+ QmpCommand *cmd;
+
+ QTAILQ_FOREACH(cmd, &qmp_commands, node) {
+ if (strcmp(cmd->name, name) == 0) {
+ return (cmd->options & QCO_NO_SUCCESS_RESP) == 0;
+ }
+ }
+
+ return true;
+}
+
char **qmp_get_command_list(void)
{
QmpCommand *cmd;
diff --git a/qga/commands.c b/qga/commands.c
index 46b0b08..9811221 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -63,6 +63,7 @@ struct GuestAgentInfo *qmp_guest_info(Error **err)
cmd_info = g_malloc0(sizeof(GuestAgentCommandInfo));
cmd_info->name = strdup(*cmd_list);
cmd_info->enabled = qmp_command_is_enabled(cmd_info->name);
+ cmd_info->success_response = qmp_command_reports_success(cmd_info->name);
cmd_info_list = g_malloc0(sizeof(GuestAgentCommandInfoList));
cmd_info_list->value = cmd_info;
--
1.7.8.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] For 1.2: Re: [PATCH v2] qemu-ga: report success-response field in guest-info
2012-08-21 12:03 [Qemu-devel] [PATCH v2] qemu-ga: report success-response field in guest-info Michal Privoznik
@ 2012-08-21 12:17 ` Eric Blake
2012-08-21 12:29 ` Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2012-08-21 12:17 UTC (permalink / raw)
To: Michal Privoznik; +Cc: Anthony Liguori, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]
On 08/21/2012 06:03 AM, Michal Privoznik wrote:
> This is a useful hint for users (or libvirt) whether a command returns
> anything success and hence wait for reply or not.
> ---
> diff to v1:
> -changed condition in qmp_command_reports_success per Paolo's advice
>
> qapi-schema-guest.json | 6 +++++-
> qapi/qmp-core.h | 1 +
> qapi/qmp-registry.c | 12 ++++++++++++
> qga/commands.c | 1 +
> 4 files changed, 19 insertions(+), 1 deletions(-)
Adding 'For 1.2', on the grounds that we changed semantics in 1.2 (1.1
didn't have any commands with success-response marking to begin with),
and therefore it is a usability bug if we don't fix it in time for this
release.
>
> diff --git a/qapi-schema-guest.json b/qapi-schema-guest.json
> index d955cf1..2cd5957 100644
> --- a/qapi-schema-guest.json
> +++ b/qapi-schema-guest.json
> @@ -91,10 +91,14 @@
> #
> # @enabled: whether command is currently enabled by guest admin
> #
> +# @success-response: whether command report success response or not.
> +# See 'uest-shutdown' command for more detailed info.
s/uest/guest/
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] For 1.2: Re: [PATCH v2] qemu-ga: report success-response field in guest-info
2012-08-21 12:17 ` [Qemu-devel] For 1.2: " Eric Blake
@ 2012-08-21 12:29 ` Eric Blake
0 siblings, 0 replies; 3+ messages in thread
From: Eric Blake @ 2012-08-21 12:29 UTC (permalink / raw)
Cc: Michal Privoznik, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 771 bytes --]
On 08/21/2012 06:17 AM, Eric Blake wrote:
> On 08/21/2012 06:03 AM, Michal Privoznik wrote:
>> This is a useful hint for users (or libvirt) whether a command returns
>> anything success and hence wait for reply or not.
>> +++ b/qapi-schema-guest.json
>> @@ -91,10 +91,14 @@
>> #
>> # @enabled: whether command is currently enabled by guest admin
>> #
>> +# @success-response: whether command report success response or not.
This sentence is also awkward. I suggest something like:
true unless the command does not respond on success
>> +# See 'uest-shutdown' command for more detailed info.
>
> s/uest/guest/
>
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-21 12:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-21 12:03 [Qemu-devel] [PATCH v2] qemu-ga: report success-response field in guest-info Michal Privoznik
2012-08-21 12:17 ` [Qemu-devel] For 1.2: " Eric Blake
2012-08-21 12:29 ` Eric Blake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).