Re: [libvirt] [PATCH] esx: Warn if the ESX server is in maintenance mode

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

 



On Tue, Jan 05, 2010 at 03:00:06AM +0100, Matthias Bolte wrote:
> ---
>  src/esx/esx_driver.c |   38 +++++++++++++++++++++++++++-----------
>  1 files changed, 27 insertions(+), 11 deletions(-)
> 
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index f86654a..ddda66e 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -401,6 +401,32 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
>          }
>      }
>  
> +    /* Query the host for maintenance mode and vCenter IP address */
> +    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
> +                                           "runtime.inMaintenanceMode\0"
> +                                           "summary.managementServerIp\0") < 0 ||
> +        esxVI_LookupHostSystemByIp(conn, priv->host, hostIpAddress,
> +                                   propertyNameList, &hostSystem) < 0) {
> +        goto failure;
> +    }
> +
> +    /* Warn if host is in maintenance mode */
> +    for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
> +         dynamicProperty = dynamicProperty->_next) {
> +        if (STREQ(dynamicProperty->name, "runtime.inMaintenanceMode")) {
> +            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
> +                                         esxVI_Type_Boolean) < 0) {
> +                goto failure;
> +            }
> +
> +            if (dynamicProperty->val->boolean == esxVI_Boolean_True) {
> +                VIR_WARN0("The server is in maintenance mode");
> +            }
> +
> +            break;
> +        }
> +    }
> +
>      /* Login to vCenter */
>      if (vCenter != NULL) {
>          VIR_FREE(url);
> @@ -415,17 +441,9 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
>          }
>  
>          /* Lookup the vCenter from the ESX host */
> -        if (esxVI_String_AppendValueToList
> -              (conn, &propertyNameList, "summary.managementServerIp") < 0 ||
> -            esxVI_LookupHostSystemByIp(conn, priv->host, hostIpAddress,
> -                                       propertyNameList, &hostSystem) < 0) {
> -            goto failure;
> -        }
> -
>          for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
>               dynamicProperty = dynamicProperty->_next) {
> -            if (STREQ(dynamicProperty->name,
> -                      "summary.managementServerIp")) {
> +            if (STREQ(dynamicProperty->name, "summary.managementServerIp")) {
>                  if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
>                                               esxVI_Type_String) < 0) {
>                      goto failure;
> @@ -461,8 +479,6 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
>                  }
>  
>                  break;
> -            } else {
> -                VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
>              }
>          }
>  

  Looks like the fix for the problem Rich reported, ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]