> - I want to close all libvirt connections at the end, but closing
the
> connections does not close the ssh - nc connections libvirt opens in the
> background to talk to the hypervisor. I have to manually delete all
> domain
> objects as well to get the pending ssh - nc connections closed. I can
> keep
> on using the domain object, even if I closed the connection before.
> Is this behaviour intended?
This behavior is intended. Connection and domain objects are
refcounted. If you open a connection conn it starts with a refcount of
1. When you request a domain object using conn, then the refcount of
that connection is increased by 1. Upon destruction of the domain
object the refcount of conn is decreased again by 1.
Now if you call close on conn or get rid of the python reference by
assigning None to conn, then the connection is not closed immediately,
only the refcount is decreased by 1. The connection gets closed when
its refcount reaches zero. This happens if you close the connection
_and_ free all domain, network, interface objects etc. that you
requested using that connection.
Thx. If you know how it works, it's ok :)
What about the other issue?
> - if the hypervisor is not running,
libvirt.open("xen+ssh://host")
> doesn't
> time out put keeps trying to connect to host on port 8000.
> I've tried with the following test program:
>
> try:
> Â conn = libvirt.open("xen+ssh://host")
> except:
> Â print "failed"
> Â sys.exit(1)
>
> However: after aborting the program with Ctrl-C I get the exception.
>
K. Haselhorst