First version of a small patch allowing to gather debug informations
from a running libvirt daemon. Basically one can send signal USR2
to the daemon, the daemon will from that point dump its current internal
state and all verbose debug output to a file /tmp/libvirt_debug_xxxx.
When sending back signal USR2 the file is closed and can be looked at
for analysis, this allow to save extensive debug informations from a
running daemon.
The patch is rather minimal right now, it just applies to
qemud/qemud.c, modifies it to have global variables for error and
information output FILE, an init routing setting them up and hooking
a handler for USR2, the handler, a very minimal state dump. But it
works as is.
Now I would like to extend that debugging to the library itself, so
any app linking to libvirt can be debugged in the same way. I would
also like to add debugging routines for most internal data structures.
I'm still wondering about the best form for those, should they use
a FILE * argument, an fd argument or a virBufferPtr for genericity
(probably the later would make most sense).
#ifdef ENABLE_DEBUG
void virConnectDebug(virBufferPtr buf, virConnectPtr conn);
#endif
and similar for main internal data structures and drivers
The patch is just a work in progress but trying to get early feedback.
Maybe this could be used to get remote introspection capabilities too
but ATM I'm more looking at providing an easy way to get debug
informations on a libvirt program.
Also I'm unclear, do we really want to have all the debug strings
internationalized with _() , that's more work for localization team
and it's unclear this would benefit 'end users'.
Patch and an example of log attached,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/