[libvirt] [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 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 37270fe..c6854f1 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) { -- 1.6.3.3

On 04/18/2010 02:32 PM, Matthias Bolte wrote:
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 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 37270fe..c6854f1 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; + }
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2010/4/20 Eric Blake <eblake@redhat.com>:
On 04/18/2010 02:32 PM, Matthias Bolte wrote:
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 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 37270fe..c6854f1 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; + }
ACK.
Thanks, pushed. Matthias
participants (2)
-
Eric Blake
-
Matthias Bolte