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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/10/12 Jiri Denemark <jdenemar@xxxxxxxxxx>:
> ---
> 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.

> diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
> index 39b55f8..7665a76 100644
> --- a/src/hyperv/hyperv_driver.c
> +++ b/src/hyperv/hyperv_driver.c
> @@ -1119,6 +1119,23 @@ hypervIsSecure(virConnectPtr conn)
>
>
>  static int
> +hypervIsAlive(virConnectPtr conn)
> +{
> +    hypervPrivate *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->client)
> +        return 1;
> +    else
> +        return 0;
> +}

This one is okay as is, I don't have a better suggestion at hand right now.

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]