qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Ján Tomko" <jtomko@redhat.com>,
	libvir-list@redhat.com,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [libvirt] [PATCHv2] Don't log an internal error when the guest hasn't updated balloon stats
Date: Thu, 15 May 2014 15:19:47 -0600	[thread overview]
Message-ID: <53752F73.3030506@redhat.com> (raw)
In-Reply-To: <d98650b5d89fc5a82ab02e5cafc04a66478052d5.1400138404.git.jtomko@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2107 bytes --]

On 05/15/2014 01:22 AM, Ján Tomko wrote:
> If virDomainMemoryStats is called too soon after domain startup,
> QEMU returns:
> "error":{"class":"GenericError","desc":"guest hasn't updated any stats yet"}
> when we try to query balloon stats.
> 
> Check for this reply and log it as OPERATION_INVALID instead of
> INTERNAL_ERROR. This means the daemon only logs it at the debug level,
> without polluting system logs.
> 
> Reported by Laszlo Pal:
> https://www.redhat.com/archives/libvirt-users/2014-May/msg00023.html
> ---
> v1: https://www.redhat.com/archives/libvir-list/2014-May/msg00420.html
> v2:
>   return 0 in this case - even though balloon stats are not yet available,
>     we can still return 'rss' in qemuDomainMemoryStats
>   jump to cleanup if CheckError returns < 0
> 
>  src/qemu/qemu_monitor_json.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)

> +    if ((data = virJSONValueObjectGet(reply, "error"))) {
> +        const char *klass = virJSONValueObjectGetString(data, "class");
> +        const char *desc = virJSONValueObjectGetString(data, "desc");
>  
> -    if (ret < 0)
> +        if (STREQ_NULLABLE(klass, "GenericError") &&
> +            STREQ_NULLABLE(desc, "guest hasn't updated any stats yet")) {

Adding qemu.  Uggh - the qemu documentation of QMP states:

- The "desc" member is a human-readable error message. Clients should
  not attempt to parse this message.

because the contents of that field are NOT guaranteed to be stable.
We're stuck parsing that field for old versions of qemu, but this is one
case where upstream qemu (for future versions) should change the "class"
member of that particular error case to a distinct value other than
GenericError so that it is trivially obvious when this particular
condition has occurred, since it is a case where libvirt wants to treat
it as a non-error.

reluctant ACK, while hoping that we can do something more reliable in
the future.

-- 
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: 604 bytes --]

       reply	other threads:[~2014-05-15 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d98650b5d89fc5a82ab02e5cafc04a66478052d5.1400138404.git.jtomko@redhat.com>
2014-05-15 21:19 ` Eric Blake [this message]
2014-05-16  5:59   ` [Qemu-devel] [libvirt] [PATCHv2] Don't log an internal error when the guest hasn't updated balloon stats Markus Armbruster
2014-05-16  6:11     ` Eric Blake
2014-05-16 13:13       ` Luiz Capitulino
2014-05-19  6:46         ` Ján Tomko
2014-05-22 12:54   ` Ján Tomko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53752F73.3030506@redhat.com \
    --to=eblake@redhat.com \
    --cc=jtomko@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).