From nobody Thu May 2 20:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568295093; cv=none; d=zoho.com; s=zohoarc; b=W1mNEaecNrqfYU9Xu7dA+xGD6pmbFXi1xHMw/bJmNIkY3h5VKkcFV1NFXc21jYa/U6QpImChlATAsmJhIfMSj0X6cFWuXkwrQlhk0MUJ2octLvWiyIas5foSa9CZTMrkfCi0oXLJc62f4akeVWpTeQ28U1b6ngNK6Rze2h7Z5Ss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568295093; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=P7H6YL6YMalHtyNXds2EKDh6ValicDFCA1dcLthdUi8=; b=UFjTbMQ4Kp3aqM/qi/ZU7m4ynp9mk4e4zDJ5DytGaeD9Ont7GIag0/Q/MWsKUVh95wYn3Moi63mLreeaDGjCnbgwRhtq+xFT95XbGGZ0SZ9+geqateG/wpt6H+RvwyGEmMPoa7COxU4QnCngDk9rk9/HvHUmuPruTSn1u/wlS6Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568295093583711.8653808244048; Thu, 12 Sep 2019 06:31:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6CC8C81DE0; Thu, 12 Sep 2019 13:31:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46B8D194B9; Thu, 12 Sep 2019 13:31:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CEA8124F30; Thu, 12 Sep 2019 13:31:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8CDVUBL012747 for ; Thu, 12 Sep 2019 09:31:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2783B5D9E2; Thu, 12 Sep 2019 13:31:30 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4A715D9E5 for ; Thu, 12 Sep 2019 13:31:26 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 12 Sep 2019 15:31:24 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu_capabilities: Put only unique FW images into domcaps X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Sep 2019 13:31:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In the domain capabilities XML there are FW image paths printed. There are two sources for the image paths (in order of preference): 1) firmware descriptor files - as returned by qemuFirmwareGetSupported() 2) a compile time list of FW:NRAM pairs which can be overridden in qemu.conf If either of those contains a duplicate FW image path (which is a valid use case) it is printed twice in the capabilities XML. While it's technically not a bug, it doesn't look good. Signed-off-by: Michal Privoznik Reviewed-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9b19930964..489a6872c4 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5136,12 +5136,22 @@ virQEMUCapsFillDomainLoaderCaps(virDomainCapsLoader= Ptr capsLoader, =20 for (i =3D 0; i < nfirmwares; i++) { const char *filename =3D firmwares[i]->name; + size_t j; =20 if (!virFileExists(filename)) { VIR_DEBUG("loader filename=3D%s does not exist", filename); continue; } =20 + /* Put only unique FW images onto the list */ + for (j =3D 0; j < capsLoader->values.nvalues; j++) { + if (STREQ(filename, capsLoader->values.values[j])) + break; + } + + if (j !=3D capsLoader->values.nvalues) + continue; + if (VIR_STRDUP(capsLoader->values.values[capsLoader->values.nvalue= s], filename) < 0) return -1; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list