On 25.01.2013 14:05, Peter Krempa wrote:
On 01/25/13 13:20, Michal Privoznik wrote:
> With our code, we fail to query for tray-open attribute currently.
> That's because in HMP it is 'tray-open' and in QMP it's
'tray_open'.
> It always has been. However, we got it exactly the opposite.
> ---
> src/qemu/qemu_monitor_json.c | 2 +-
> src/qemu/qemu_monitor_text.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index de5f115..0aa3bcb 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -1588,7 +1588,7 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon,
> /* Don't check for success here, because 'tray-open' is
1: ^^
> presented iff
> * medium is ejected.
> */
> - ignore_value(virJSONValueObjectGetBoolean(dev, "tray-open",
> + ignore_value(virJSONValueObjectGetBoolean(dev, "tray_open",
> &info->tray_open));
Indeed. The returned value is with the underscore, while the
documentation uses the dash.
>
> /* Missing io-status indicates no error */
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 6506f9d..bc0a11d 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> + } else if (STRPREFIX(p, "tray-open=")) {
This too matches the reality.
ACK. I think it would be worth notifying the qemu folks as the docs are
mistaken.
Peter
Thanks. I've pushed this one since this is pure bug fix unrelated to the
latter patch of mine. I've sent patch to qemu devel list as well:
http://lists.nongnu.org/archive/html/qemu-devel/2013-01/msg04804.html
And I've updated the forgot comment [1] as well.
Michal