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 modified src/hash.c to add a little bit of debug of the state of
conn->uses in virGetConnect, virFreeConnect, virGetDomain,
virFreeDomain. When running the program I see:
------------------------------------------
libvirt: virInitialize ()
libvirt: virInitialize ()
libvirt: virInitialize ()
libvirt: virInitialize ()
libvirt: virInitialize ()
libvirt: virInitialize ()
libvirt: virInitialize ()
libvirt: virInitialize ()
libvirt: virConnectOpen (name=xen)
conn(0x6748c0) uses = 1
libvirt: do_open: proceeding with name=xen:///
libvirt: do_open: trying driver 0 (Test) ...
libvirt: do_open: driver 0 returned DECLINED
libvirt: do_open: trying driver 1 (QEMU) ...
libvirt: do_open: driver 1 returned DECLINED
libvirt: do_open: trying driver 2 (Xen) ...
libvirt: do_open: driver 2 returned SUCCESS
libvir: Remote error : Connection refused
libvir: warning : Failed to find the network: Is the daemon running ?
libvirt: virDomainLookupByName (conn=0x6748c0, name=debian32fv)
new domain: conn(0x6748c0) uses = 2
libvirt: virConnectClose (conn=0x6748c0)
conn(0x6748c0) uses = 1
libvirt: virDomainGetName (domain=0x679e20)
name = debian32fv
libvirt: virDomainFree (domain=0x679e20)
free domain: conn(0x6748c0) uses = 0
------------------------------------------
I would say that it's working as intended.
Rich.
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list