From nobody Fri Dec 19 15:50:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1742992822; cv=none; d=zohomail.com; s=zohoarc; b=fCEulO5qHUtv23F5rqjduxKd922unt7jljVjbVj0Fng1khwPWYqaBLpYgAvOtz0lmGmuu8oMYZL5rUN/xUeq7XhaxLUVwu8SHQyr89AEUgLH78gP+bRBUEJ8tDbSDGyhEc2BPiwoUysYFzWuCS+Qv/RTouiW3LjDfXfOuDKy7H8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742992822; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=qpbQDYLGRSHyVCm5OWB2VEK+PSYJvR9KFGuffFY8T2Q=; b=QioUI42zs4D3VkjqcXPBTpaBF12/lGtOHkqHqcntQtFnHFRBfmJoj8xitHkknSWNYBScsz66t2BJOeq4pIeA/sPWPhoG8oLvFUZsMH5TLI+unUFeSbdwe+lt0m9pawjPOW/zqHW667Gq1W+n0HGATAqdcDTxmC8jUBnt68EVbwQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1742992822567161.2809873858008; Wed, 26 Mar 2025 05:40:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D3EF414A3; Wed, 26 Mar 2025 08:40:21 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D14FA1465; Wed, 26 Mar 2025 08:40:04 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 02086141A; Wed, 26 Mar 2025 08:40:02 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E082A1412 for ; Wed, 26 Mar 2025 08:40:00 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-553-vG6efPFNMS-h4AwOWboyaQ-1; Wed, 26 Mar 2025 08:39:59 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 40E8219560BC for ; Wed, 26 Mar 2025 12:39:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.8]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 75FC2180A803 for ; Wed, 26 Mar 2025 12:39:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742992800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wV91X3MoltUzDNM8ytewAjl53OiBh9qxMjEZvA05ZUI=; b=A74MTIjd69CTtv01oHP0WzFpoSeOfVZ/q7h+3fyF9ZMaD5GooU1vP1XKFRysDr/3+BJ3Jn BTbCXAPyU9/6170XDMl053FSFzUPxTFIXNha0baExTuVJ6KGMNeV4+nx3TCKNp9WYQ8xKi rAQc154Bneqt4hdKvoqcL67TZGKo5Tc= X-MC-Unique: vG6efPFNMS-h4AwOWboyaQ-1 X-Mimecast-MFC-AGG-ID: vG6efPFNMS-h4AwOWboyaQ_1742992798 To: devel@lists.libvirt.org Subject: [PATCH] esxConnectListAllDomains: Don't propagate failure to lookup a single domain Date: Wed, 26 Mar 2025 13:39:55 +0100 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: s6hfblOQxqmIP_yVHjH7d6jNQUhTS0_AY99m4Ta6uIs_1742992798 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ERNOC5VNEPKGKI4TNQBA6PCOEXM7B3MS X-Message-ID-Hash: ERNOC5VNEPKGKI4TNQBA6PCOEXM7B3MS X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1742992825977019000 Content-Type: text/plain; charset="utf-8" From: Peter Krempa In esxConnectListAllDomains if the lookup of the VM name and UUID fails for a single VM (possible e.g. with broken storage) the whole API would return failure even when there are working VMs. Rework the lookup so that if a subset fails we ignore the failure on those. We report an error only if lookup of all of the objects failed. Failure is reported from the last one. Resolves: https://issues.redhat.com/browse/RHEL-80606 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/esx/esx_driver.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 554fb3e18f..d869481698 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -4792,18 +4792,21 @@ esxConnectListAllDomains(virConnectPtr conn, virtualMachine =3D virtualMachine->_next) { g_autofree char *name =3D NULL; - if (needIdentity) { - if (esxVI_GetVirtualMachineIdentity(virtualMachine, &id, - &name, uuid) < 0) { + /* If the lookup of the required properties fails for some of the = machines + * in the list it's preferrable to return the valid objects instea= d of + * failing outright */ + if ((needIdentity && esxVI_GetVirtualMachineIdentity(virtualMachin= e, &id, &name, uuid) < 0) || + (needPowerState && esxVI_GetVirtualMachinePowerState(virtualMa= chine, &powerState) < 0)) { + + /* Raise error from last lookup if we didn't successfuly fetch= any + * domain objecst yet */ + if (count =3D=3D 0 && !virtualMachine->_next) goto cleanup; - } - } - if (needPowerState) { - if (esxVI_GetVirtualMachinePowerState(virtualMachine, - &powerState) < 0) { - goto cleanup; - } + /* failure to fetch information of a single VM must not interr= upt + * the lookup of the rest */ + virResetLastError(); + continue; } /* filter by active state */ --=20 2.49.0