[Libvir] problem with virConnectClose in libvirt 0.1.5

After closing libvirt with virConnectClose, it's possible to open libvirt again in the same program with virConnectOpen but following operations on domains systematically fail. In example: conn = virConnectOpen(NULL); dom = virDomainLookupByID(conn, id); virDomainFree(dom); virConnectClose(conn); ... conn = virConnectOpen(NULL); dom = virDomainLookupByID(conn, id); ==> ERROR The second virDomainLookupByID call fails because of the do_connect() function in xend_internal.c source file. In this function, the connect() API returns ENOENT on the second virDomainLookupByID() call. ENOENT return code isn't documented in the man of connect API ! I suppose that some cleaning are missing when virConnectClose is called or in the opposite, too cleaning is done. Regards.

On Wed, Sep 20, 2006 at 05:50:59PM +0200, Philippe Berthault wrote:
After closing libvirt with virConnectClose, it's possible to open libvirt again in the same program with virConnectOpen but following operations on domains systematically fail.
In example:
conn = virConnectOpen(NULL); dom = virDomainLookupByID(conn, id); virDomainFree(dom); virConnectClose(conn); ... conn = virConnectOpen(NULL); dom = virDomainLookupByID(conn, id); ==> ERROR
The second virDomainLookupByID call fails because of the do_connect() function in xend_internal.c source file. In this function, the connect() API returns ENOENT on the second virDomainLookupByID() call.
ENOENT return code isn't documented in the man of connect API !
I suppose that some cleaning are missing when virConnectClose is called or in the opposite, too cleaning is done.
Okay I reproduced this, (as user i.e. using the proxy) I will chase it down should be easy, probably the file descriptor is not reset on Close. And I will ad a python test for it, thanks for raising this, did you got the problem as root ? It seems to work for me as root, i.e. being a problem when reconnecting with the proxy. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Wed, Sep 20, 2006 at 05:50:59PM +0200, Philippe Berthault wrote:
After closing libvirt with virConnectClose, it's possible to open libvirt again in the same program with virConnectOpen but following operations on domains systematically fail.
Okay, I found it ... You could get this only if connecting though the xend http interface and as non-root (i.e. not using the proxy), basically xenDaemonGetVersion() was used to test the connection when trying to reach the daemon, unfortunately it cached the version value in a global variable, which means on reconnection it would go ahead using a connection method believeing it worked while it didn't. I just removed caching in xenDaemonGetVersion(), it's wrong anyway at best this should be cached on the driver, certainly not global. Fixed in CVS, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (2)
-
Daniel Veillard
-
Philippe Berthault