From: Matthias Bolte Date: Sun, 18 Apr 2010 16:07:13 +0000 (+0200) Subject: esx: Fix FindByIp response handling X-Git-Tag: v0.8.1~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a056d064887a7b7a613c5504927590c953ac807;p=thirdparty%2Flibvirt.git 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. --- diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 37270fea0a..c6854f155e 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -1968,6 +1968,13 @@ esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress, 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, "HostSystem", propertyNameList, esxVI_Boolean_False, hostSystem) < 0) {