[Libvir] Re: [PATCH] Python bindings now generate exceptions for libvirt errors (third version)
veillard at redhat.com
Wed Mar 28 09:31:29 UTC 2007
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
> 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.
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list