On Wed, Aug 20, 2008 at 02:22:58PM +0100, Richard W.M. Jones wrote:
On Tue, Aug 19, 2008 at 11:35:18AM +0100, Daniel P. Berrange wrote:
> The guarenteed correct solution is actually rather simple
>
> - Always report errors against the virConnect object, even in the driver
> open method
>
> - In the cleanup patch of do_open() in libvirt.c, if no global error is
> set, copy the error from the virConnect object's virError, into the
> global virError.
+1 , although unfortunately this isn't thread-safe. Nothing can be
thread-safe unless we change the API.
Well we're not making it any less thread-safe. You alrady have to use the
virGetLastError() global func - we're simply making sure it actually
records all errors.
To make it thread-safe we'll need to add a real virGetThreadLastError()
API, which is something on my todo list - with that new apps can just
call thevirGetThreadLastError() exclusively and never need to know the
distinction between global/connection errors which causes so much
trouble. I'm fairly sure I can preseve existing semantics at same
time with some suitable internal cleverness.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|