On Fri, May 06, 2011 at 05:43:41PM +0100, Richard W.M. Jones wrote:
I can set the global error handling function (virSetErrorFunc). That
doesn't seem to be a good idea from a library. Looking at the code,
it doesn't appear that the internal virErrorHandler is thread-local,
so I can't set it and restore it around the function call.
I can set the error handling function _after_ I've got a connection
object (virConnSetErrorFunc). That doesn't help with making the
initial connection.
libguestfs itself has the same problem with the guestfs_create call,
so I'm not going to point any fingers :-) However it seems like a
shortcoming of the libvirt API.
Am I missing something here?
Not really. I really consider the default error printing function
itself to be a flawed idea as a library shouldn't print to stderr
by default. I'm really torn on whether we can change it though,
since although most apps disable it, some may be relying on it.
Perhaps adding a flag to virConnectOpenAuth(), VIR_CONNECT_NOP_ERROR_FUNC
but not sure how practical that is to actually implement in our internal
error handling infrastructure.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|