于 2011年01月04日 23:30, Daniel P. Berrange 写道:
On Fri, Dec 24, 2010 at 10:31:20AM +0800, Osier Yang wrote:
> Add VM name/UUID in log for domain related APIs.
> Format: "param0=%p, param1=%p, (VM: %s)"
>
> * src/libvirt.c
> ---
> src/libvirt.c | 293 +++++++++++++++++++++++++++++++++++++++++++--------------
> 1 files changed, 220 insertions(+), 73 deletions(-)
>
> diff --git a/src/libvirt.c b/src/libvirt.c
> index ee2495a..cd1cf6e 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -1961,7 +1961,9 @@ error:
> virConnectPtr
> 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. Logging the name alone is also potentially misleading, since
most of the API impls use the UUID and ignore the name.
hmm, yes, thanks for the reviewing, will make a v3 patch.
Regards
Osier