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

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

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> 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, ...

Looks good, indeed.
ACK

> Index: src/libvirt.c
> ===================================================================
...
> +    /* If not global error was set, copy any error set

s/not/no/

--
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]