The function call esxVI_LookupVirtualMachineByName(occurrence =
OptionalItem) and then checks if @virtualMachine is NULL. If it
is an error is reported. The same result can be achieved by
setting occurrence to RequiredItem.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/esx/esx_driver.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index e906d11fa9..01bcc99962 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1577,12 +1577,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
"config.uuid\0") < 0 ||
esxVI_LookupVirtualMachineByName(priv->primary, name, propertyNameList,
&virtualMachine,
- esxVI_Occurrence_OptionalItem) < 0) {
- goto cleanup;
- }
-
- if (!virtualMachine) {
- virReportError(VIR_ERR_NO_DOMAIN, _("No domain with name
'%s'"), name);
+ esxVI_Occurrence_RequiredItem) < 0) {
goto cleanup;
}
--
2.16.4