]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: De-duplicate @virtualMachine check in esxDomainLookupByName
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Jul 2018 14:55:01 +0000 (16:55 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Jul 2018 21:24:06 +0000 (23:24 +0200)
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@redhat.com>
src/esx/esx_driver.c

index e906d11fa914d317a74e57451800a1c838ab4c2f..01bcc9996279bb92c0b92f42c57e11f53ba00050 100644 (file)
@@ -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;
     }