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

[Libvir] Re: [PATCH] Python bindings now generate exceptions for libvirt errors (third version)



On Wed, Mar 28, 2007 at 10:23:06AM +0100, Richard W.M. Jones wrote:
> Third version of this patch, which should allow virt-manager to start up 
> correctly*.
> 
> virt-manager relies on virDomainGetID returning -1 in the case when a 
> domain is inactive.  On further investigation it turns out that 
> virDomainGetID and virDomainGetName can never fail**, since all they do 

  they fail if the pointer is wrong, which is a very possible case from 
a C API point of view.

> is read fields from the domain pointer that you pass.  It was also 
> claimed that virDomainGetUUID was also error-free, but that's actually 
> not the case.
> 
> So this patch disables exceptions in those two functions only.

  If you are 100% sure you can't pass a wrong pointer though the 
python binding then okay.

> Note that the documentation for virDomainGetID is wrong.

  I don't see the error

> ** Well, they can fail in the case where you've corrupted memory and 
> your virDomainPtr isn't really a virDomainPtr, but at that point all 
> bets are off anyway ...

  Disagreeing, passing a NULL pointer can happen if the user code made
a mistake, or relied on libvirt to catch it up.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/


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