]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: Fix FindByIp response handling
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sun, 18 Apr 2010 16:07:13 +0000 (18:07 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 20 Apr 2010 22:44:18 +0000 (00:44 +0200)
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

index 37270fea0a26279c215aff0c4fe5ff58befbd903..c6854f155ee9a2366dcce1e9769257b61c6030d8 100644 (file)
@@ -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) {