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

Matthias Bolte matthias.bolte at googlemail.com
Fri Jan 8 19:03:52 UTC 2010


2010/1/8 Daniel Veillard <veillard at redhat.com>:
> 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
>

Well, the fix for Richard's problem was to leave maintenance mode :)

Now it should simpler to spot that maintenance mode may be the cause
of such problems.

Thanks, pushed together with the raw-response-dump commit.

Matthias




More information about the libvir-list mailing list