esx: Fix FindByIp response handling

FindByIp may return nothing if there is no host or virtual machine
with the given IP address. Handle that case properly.
This commit is contained in:
Matthias Bolte 2010-04-18 18:07:13 +02:00
parent 1d8099f4b6
commit 7a056d0648

View File

@ -1968,6 +1968,13 @@ esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress,
goto failure; goto failure;
} }
if (managedObjectReference == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Could not find host system with IP address '%s'"),
ipAddress);
goto failure;
}
if (esxVI_LookupObjectContentByType(ctx, managedObjectReference, if (esxVI_LookupObjectContentByType(ctx, managedObjectReference,
"HostSystem", propertyNameList, "HostSystem", propertyNameList,
esxVI_Boolean_False, hostSystem) < 0) { esxVI_Boolean_False, hostSystem) < 0) {