]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: Report error in esxVI_LookupVirtualMachineByName
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Jul 2018 14:51:31 +0000 (16:51 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Jul 2018 21:24:06 +0000 (23:24 +0200)
When reviewing 00d9edfe2f39f60b40 I've changed proposed patch and
made it to not report error if no domain is found. This is wrong
and the original patch was okay. Thing is, both callers pass
occurrence = OptionalItem so no error message overwriting is done
as I thought initially.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/esx/esx_vi.c

index 0bdfc5a8bec6175a70bf7a5429a59bcf418fc71e..25fbdc7e4434c1a218d6edaec3c8763113cd92a7 100644 (file)
@@ -3014,8 +3014,11 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name,
         break;
     }
 
-    if (!(*virtualMachine) && occurrence != esxVI_Occurrence_OptionalItem)
+    if (!(*virtualMachine) && occurrence != esxVI_Occurrence_OptionalItem) {
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("Could not find domain with name '%s'"), name);
         goto cleanup;
+    }
 
     result = 0;