[libvirt] [Qemu-devel] [PATCHv2] Don't log an internal error when the guest hasn't updated balloon stats

Markus Armbruster armbru at redhat.com
Fri May 16 05:59:06 UTC 2014


Copying Luiz...

Eric Blake <eblake at redhat.com> writes:

> 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")) {

You snipped so much of the diff that I have trouble finding the place
this applies.

> 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.

Is "no stats yet" really an error?  Libvirt has done nothing wrong, and
I'd argue the guest hasn't done anything wrong, either.  Should we
simply return an empty result?  Like "cat" on a file that hasn't gotten
its data, yet.




More information about the libvir-list mailing list