Re: [libvirt] PATCH: Ensure errors are guarenteed reported in virConnectOpen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 19, 2008 at 11:35:18AM +0100, Daniel P. Berrange wrote:
> The virConnectOpen method is unfortuantely rather special. While there is
> a virConnect object available, the current rule is that drivers must report
> errors against the global error object, because upon failure no virConnect
> object will be returned to the caller. Unforatunately, despite frequent
> cleanups of code getting this wrong, I've just audited the remote driver
> and found another 20 or so places where its wrong. This is clearly not a
> sustainable approach to error reporting.
> 
> 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.
> 
> With this in place we can change all the drivers back to always report
> against the error object, and thus cleanup some disgusting code like
> 
>         __virRaiseError (in_open ? NULL : conn, ...
> 
> To just
> 
>         __virRaiseError (conn, ...

  Okay, make sense, it's better to be more flexible in one location
and simplify code everywhere else.

  +1

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]