[libvirt] [PATCH v3 10/13] Implement virConnectIsAlive in all drivers

Jiri Denemark jdenemar at redhat.com
Thu Oct 27 16:37:04 UTC 2011


On Tue, Oct 18, 2011 at 19:10:10 +0200, Matthias Bolte wrote:
> 2011/10/18 Matthias Bolte <matthias.bolte at googlemail.com>:
> > 2011/10/12 Jiri Denemark <jdenemar at redhat.com>:
> >> --- a/src/esx/esx_driver.c
> >> +++ b/src/esx/esx_driver.c
> >> @@ -4166,6 +4166,23 @@ esxIsSecure(virConnectPtr conn)
> >>
> >>
> >>  static int
> >> +esxIsAlive(virConnectPtr conn)
> >> +{
> >> +    esxPrivate *priv = conn->privateData;
> >> +
> >> +    /* XXX we should be able to do something better than this is simple, safe,
> >> +     * and good enough for now. In worst case, the function will return true
> >> +     * even though the connection is not alive.
> >> +     */
> >> +    if (priv->host)
> >> +        return 1;
> >> +    else
> >> +        return 0;
> >> +}
> >
> > This one is not correct. In case of a vpx:// connection priv->host is
> > NULL. You should use priv->primary here.

OK, I used that instead (see v4), thanks.

> > If this function is allowed to do active probing you can probably call
> > esxVI_EnsureSession. If esxVI_EnsureSession fails the connection has
> > died in the meantime or the credentials have changed since the last
> > login. Basically if esxVI_EnsureSession fails we cannot do any vSphere
> > API calls anymore.

The main problem with esxVI_EnsureSession is that it tries to reconnect if it
is not connected (if I understood it correctly), which is not what we want
from esxIsAlive.

> Also ESX has some kind of heartbeat support. I'll put this on my list
> of things to look at.

That would be great.

Jirka




More information about the libvir-list mailing list