[libvirt] Having some issue with : virConnectRef

Chris Lalancette clalance at redhat.com
Mon Dec 14 08:50:46 UTC 2009

On 12/14/2009 07:18 AM, anuj rampal wrote:
> Hi,
> Im trying to call libvirt functions from a widows machine.
> The client version i'm using is 0.6.1.
> My application is a multi-Threaded application.
> This is the way my application works:
> 1. I connect to Libvirt using "virConnectOpen". (this done only once
> when my application starts).
> 2. For funther interaction with libvirt i just call "virConnectRef" and
> then i call some other function like "virNodeGetInfo".
> 3. Then i call "virConnectClose".
> Now my understanding is for every "virConnectRef" call there has to be a
> corrosponding "virConnectClose".
> In my application call to number of calls to "virConnectClose" is always
> equal to "virConnectRef".
> and "virConnectClose" corrosponding to "virConnectOpen" is called when
> the application is closed.
> So connection to libvirt should always be there till the time my
> application is running.
> But what is happening is, even if i call "virConnectRef" twice, a single
> call to "virConnectClose" closes the connection with libvirt.
> Is there anything that im doing wrong here...??

Connection reference counting was pretty broken prior to 0.7.1, so that's
probably your problem.  I would try again with a newer libvirt, and see
if it fixes your issue.

Chris Lalancette

More information about the libvir-list mailing list