[Libvir] [PATCH] Python bindings: Use virDomain/NetworkGetConnect instead of storing connection in domain/network object

Daniel Veillard veillard at redhat.com
Tue Jul 24 14:45:36 UTC 2007


On Tue, Jul 24, 2007 at 03:19:23PM +0100, Richard W.M. Jones wrote:
> It doesn't seem like changing virDomainGetConnect to play with reference 
> counts will fix this.  The damage was done when virConnectClose was 
> called, which happened much earlier.  The only solution is to keep the 
> relation that domain contains a connection explicit in the Python code. 
>  Same probably applies to OCaml bindings too.
> 
> >/*
> > * virDomainGetConnect:
> > * @dom: pointer to a domain
> > *
> > * Provides the connection pointer associated with a domain.  The
> > * reference counter on the connection is not increased by this
> > * call.
> > */
> 
> For this reason also I suggest that we remove virDomainGetConnect and 
> virNetworkGetConnect calls entirely, to prevent anyone from thinking 
> they can use them in a safe way.  Patch is attached, and yes I know in 
> this case it breaks strict ABI compatibility.

  I still find them useful in the context of C coding as you can
get the connextion without having to carry it in all the calls (assuming
you understand the reference counting associated to connections, this
allow for simpler/cleaner code).

Daniel


-- 
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 mailing list