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

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

 



On Mon, Jul 23, 2007 at 05:11:09PM +0100, Richard W.M. Jones wrote:
> This is my test case:
> 
> ------------------------------------------
> #!/usr/bin/python
> 
> import libvirt
> 
> def get_dom():
>     conn = libvirt.open ("xen");
>     dom = conn.lookupByName ("debian32fv");
>     return dom
> 
> dom = get_dom()
> print "name = %s\n" % dom.name()
> ------------------------------------------
>
> I would say that it's working as intended.

In this case yes, but if you add one further line at the end of
this example

   conn2  = dom.get_connection()

And then have python garbage collect 'dom' and the original 'conn'
you're not safe because 'conn2' didn't increment the reference
count:

/*
 * 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.
 */

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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