From nobody Sat Feb 7 10:50:24 2026 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153745715930753.3796726663046; Thu, 20 Sep 2018 08:25:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 014753002899; Thu, 20 Sep 2018 15:25:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 379332010D7B; Thu, 20 Sep 2018 15:25:56 +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 D370D181A13B; Thu, 20 Sep 2018 15:25:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8KFPbwZ022182 for ; Thu, 20 Sep 2018 11:25:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8CB7C2010D04; Thu, 20 Sep 2018 15:25:37 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 121772010D02 for ; Thu, 20 Sep 2018 15:25:36 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:22 +0200 Message-Id: <20180920152529.25973-5-abologna@redhat.com> In-Reply-To: <20180920152529.25973-1-abologna@redhat.com> References: <20180920152529.25973-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/11] qemu: Stop looking after finding the first binary 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: , MIME-Version: 1.0 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.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 20 Sep 2018 15:25:57 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When the guest is native, we are currently looking at potential KVM binaries regardless of whether or not we have already located a QEMU binary suitable to run the guest. This made sense back when KVM support was not part of QEMU proper, but these days the KVM binaries are in most cases just trivial wrapper scripts around the native QEMU binary so it doesn't make sense to poke at them unless they're the only binaries on the system, such as when running on RHEL. This will allow us to simplify both virQEMUCapsInitGuest() and virQEMUCapsInitGuestFromBinary(). Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 09d4af70ec..647fde4b6b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -747,10 +747,8 @@ virQEMUCapsInitGuest(virCapsPtr caps, virArch guestarch) { size_t i; - char *kvmbin =3D NULL; char *binary =3D NULL; virQEMUCapsPtr qemubinCaps =3D NULL; - virQEMUCapsPtr kvmbinCaps =3D NULL; int ret =3D -1; =20 /* Check for existence of base emulator, or alternate base @@ -766,7 +764,7 @@ virQEMUCapsInitGuest(virCapsPtr caps, } } =20 - if (virQEMUCapsGuestIsNative(hostarch, guestarch)) { + if (virQEMUCapsGuestIsNative(hostarch, guestarch) && !binary) { const char *kvmbins[] =3D { "/usr/libexec/qemu-kvm", /* RHEL */ "qemu-kvm", /* Fedora */ @@ -774,36 +772,28 @@ virQEMUCapsInitGuest(virCapsPtr caps, }; =20 for (i =3D 0; i < ARRAY_CARDINALITY(kvmbins); ++i) { - kvmbin =3D virFindFileInPath(kvmbins[i]); + binary =3D virFindFileInPath(kvmbins[i]); =20 - if (!kvmbin) + if (!binary) continue; =20 - if (!(kvmbinCaps =3D virQEMUCapsCacheLookup(cache, kvmbin))) { + if (!(qemubinCaps =3D virQEMUCapsCacheLookup(cache, binary))) { virResetLastError(); - VIR_FREE(kvmbin); + VIR_FREE(binary); continue; } =20 - if (!binary) { - binary =3D kvmbin; - qemubinCaps =3D kvmbinCaps; - kvmbin =3D NULL; - kvmbinCaps =3D NULL; - } break; } } =20 ret =3D virQEMUCapsInitGuestFromBinary(caps, binary, qemubinCaps, - kvmbin, kvmbinCaps, + NULL, NULL, guestarch); =20 VIR_FREE(binary); - VIR_FREE(kvmbin); virObjectUnref(qemubinCaps); - virObjectUnref(kvmbinCaps); =20 return ret; } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list