[libvirt] [PATCH] Print hex values with '0x' prefix and octal with '0' in debug messages

Daniel P. Berrange berrange at redhat.com
Mon Sep 25 11:32:38 UTC 2017


On Mon, Sep 25, 2017 at 01:27:24PM +0200, Ján Tomko wrote:
> On Mon, Sep 25, 2017 at 11:45:51AM +0100, Daniel P. Berrange wrote:
> > Seeing a log message saying 'flags=93' is ambiguous & confusing unless
> > you happen to know that libvirt always prints flags as hex.  Change our
> > debug messages so that they always add a '0x' prefix when printing flags,
> > and '0' prefix when printing mode. A few other misc places gain a '0x'
> > prefix in error messages too.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> 
> ACK
> 
> On top of these, the flagx= typo in virNodeAllocPages might deserve to
> be included in this patch. Not sure about virAdmServerSetThreadPoolParameters
> which is the only one using hex format for nparams:
> 
> src/libvirt-admin.c=826=virAdmServerSetThreadPoolParameters(virAdmServerPtr srv,
> --
> src/libvirt-admin.c:831:    VIR_DEBUG("srv=%p, params=%p, nparams=%x, flags=0x%x",
> src/libvirt-admin.c-832-              srv, params, nparams, flags);

Yeah, nparams should definitely be %d

> --
> src/libvirt-domain.c=11901=virDomainSetGuestVcpus(virDomainPtr domain,
> --
> src/libvirt-domain.c:11906:    VIR_DOMAIN_DEBUG(domain, "cpumap='%s' state=%x flags=0x%x",
> src/libvirt-domain.c-11907-                     NULLSTR(cpumap), state, flags);

Heh, 'state' is just a boolean  0 or 1, so should relaly just be %d


> --
> src/libvirt-host.c=1448=virNodeAllocPages(virConnectPtr conn,
> --
> src/libvirt-host.c-1456-    VIR_DEBUG("conn=%p npages=%u pageSizes=%p pageCounts=%p "
> src/libvirt-host.c:1457:              "startCell=%d cellCount=%u flagx=%x",
> src/libvirt-host.c-1458-              conn, npages, pageSizes, pageCounts, startCell,
> src/libvirt-host.c-1459-              cellCount, flags);

Ok, I'll squash these 3 changes in.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list