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

Matthias Bolte matthias.bolte at googlemail.com
Tue Oct 18 17:10:10 UTC 2011


2011/10/18 Matthias Bolte <matthias.bolte at googlemail.com>:
> 2011/10/12 Jiri Denemark <jdenemar at redhat.com>:
>> ---
>> Notes:
>>    Version 3:
>>    - no changes
>>
>>    Version 2:
>>    - new patch
>>
>>  src/esx/esx_driver.c       |   18 ++++++++++++++++++
>>  src/hyperv/hyperv_driver.c |   18 ++++++++++++++++++
>>  src/libxl/libxl_driver.c   |    8 ++++++++
>>  src/lxc/lxc_driver.c       |    7 +++++++
>>  src/openvz/openvz_driver.c |    7 +++++++
>>  src/phyp/phyp_driver.c     |   18 ++++++++++++++++++
>>  src/qemu/qemu_driver.c     |    6 ++++++
>>  src/remote/remote_driver.c |   18 ++++++++++++++++++
>>  src/rpc/virnetclient.c     |   14 ++++++++++++++
>>  src/rpc/virnetclient.h     |    1 +
>>  src/test/test_driver.c     |    6 ++++++
>>  src/uml/uml_driver.c       |    7 +++++++
>>  src/vbox/vbox_tmpl.c       |    6 ++++++
>>  src/vmware/vmware_driver.c |    7 +++++++
>>  src/xen/xen_driver.c       |    8 ++++++++
>>  src/xenapi/xenapi_driver.c |   12 ++++++++++++
>>  16 files changed, 161 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
>> index 5dc7d78..837f37e 100644
>> --- 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.
>
> 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.

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

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list