[libvirt] [PATCH] [v2] API: Improve log for domain related APIs

Eric Blake eblake at redhat.com
Tue Jan 4 15:51:11 UTC 2011


On 01/04/2011 08:30 AM, Daniel P. Berrange wrote:
>>  virDomainGetConnect (virDomainPtr dom)
>>  {
>> -    DEBUG("dom=%p", dom);
>> +    const char *name = virDomainGetName(dom);
>> +
>> +    DEBUG("dom=%p, (VM: %s)", dom, NULLSTR(name));
> 
> Calling virDomainGetName() which is also a public API will pollute
> the logs with messages about virDomainGetName being invoked, every
> time.

So my fear about potential deadlock from invoking one public API from
within another was not quite right, but I was on the right track of
being worried about the use of a public API for debug purposes, because
it does introduce log pollution.  If this is the only problem, then a
possible solution would be to use a private API for getting the name for
logging purposes.

> Logging the name alone is also potentially misleading, since
> most of the API impls use the UUID and ignore the name.

Then maybe the patch should be altered to output both name and UUID
(probably by introducing a helper function, which when given a
virDomainPtr outputs all three pieces of debug information rather than
the current %p).  I like the idea behind the patch, but only if we can
come up with the correct way of getting the extra information when
debugging is enabled, and without adding extra time when debugging is
off.  I'm not even sure what the right internal APIs for the job would
be, or if they even exist yet.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110104/5303283e/attachment-0001.sig>


More information about the libvir-list mailing list