diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 43ff7ea048..0bdfc5a8be 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -3014,17 +3014,8 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name, break; } - if (!(*virtualMachine)) { - if (occurrence == esxVI_Occurrence_OptionalItem) { - result = 0; - - goto cleanup; - } else { - virReportError(VIR_ERR_NO_DOMAIN, - _("Could not find domain with name '%s'"), name); - goto cleanup; - } - } + if (!(*virtualMachine) && occurrence != esxVI_Occurrence_OptionalItem) + goto cleanup; result = 0;