esx_vi.c: Simplify error handling in MachineByName

The same pattern is used in lots of other places.
Also, reporting error message is not desired because all callers
check the return value and report errors on their own.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Marcos Paulo de Souza 2018-07-02 23:20:58 -03:00 committed by Michal Privoznik
parent 7ac08cc929
commit 00d9edfe2f

View File

@ -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;