From 7a056d064887a7b7a613c5504927590c953ac807 Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Sun, 18 Apr 2010 18:07:13 +0200 Subject: [PATCH] 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. --- src/esx/esx_vi.c | 7 +++++++ 1 file changed, 7 insertions(+) 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) {