From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457139765189.21226868782696; Thu, 20 Sep 2018 08:25:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D14093082A3D; Thu, 20 Sep 2018 15:25:37 +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 5F0DB45B29; Thu, 20 Sep 2018 15:25:37 +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 A594A4BB7F; Thu, 20 Sep 2018 15:25:35 +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 w8KFPYa3022156 for ; Thu, 20 Sep 2018 11:25:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id B3E192010D02; Thu, 20 Sep 2018 15:25:34 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 379422010D04 for ; Thu, 20 Sep 2018 15:25:34 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:19 +0200 Message-Id: <20180920152529.25973-2-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 01/11] qemu: Move comments to virQEMUCapsGuestIsNative() 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 20 Sep 2018 15:25:38 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function performing the checks, rather than its callers, should contain comments explaining the rationale behind said checks. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 04c2adcfb5..e14da5acab 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -631,15 +631,19 @@ bool virQEMUCapsGuestIsNative(virArch host, virArch guest) { + /* host & guest arches match */ if (host =3D=3D guest) return true; =20 + /* hostarch is x86_64 and guest arch is i686 (needs -cpu qemu32) */ if (host =3D=3D VIR_ARCH_X86_64 && guest =3D=3D VIR_ARCH_I686) return true; =20 + /* hostarch is aarch64 and guest arch is armv7l (needs -cpu aarch64=3D= off) */ if (host =3D=3D VIR_ARCH_AARCH64 && guest =3D=3D VIR_ARCH_ARMV7L) return true; =20 + /* hostarch and guestarch are both ppc64 */ if (ARCH_IS_PPC64(host) && ARCH_IS_PPC64(guest)) return true; =20 @@ -753,12 +757,6 @@ virQEMUCapsInitGuest(virCapsPtr caps, } } =20 - /* qemu-kvm/kvm binaries can only be used if - * - host & guest arches match - * - hostarch is x86_64 and guest arch is i686 (needs -cpu qemu32) - * - hostarch is aarch64 and guest arch is armv7l (needs -cpu aarch64= =3Doff) - * - hostarch and guestarch are both ppc64* - */ if (virQEMUCapsGuestIsNative(hostarch, guestarch)) { const char *kvmbins[] =3D { "/usr/libexec/qemu-kvm", /* RHEL */ --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457152405807.6871604364657; Thu, 20 Sep 2018 08:25:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49F2C74F17; Thu, 20 Sep 2018 15:25:50 +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 0ECF27D65A; Thu, 20 Sep 2018 15:25:50 +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 A38B6181A12F; Thu, 20 Sep 2018 15:25:49 +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 w8KFPZ8b022165 for ; Thu, 20 Sep 2018 11:25:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id DEF802010D02; Thu, 20 Sep 2018 15:25:35 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 110432010D0D for ; Thu, 20 Sep 2018 15:25:34 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:20 +0200 Message-Id: <20180920152529.25973-3-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 02/11] qemu: Don't duplicate binary name in capabilities 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 20 Sep 2018 15:25:51 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" virCapabilitiesAddGuestDomain() takes an optional binary name: this is intended for cases where a certain domain type can't use the default one registered for the guest architecture, but has to use a special binary instead. The current code, however, will pass 'binary' again when 'kvmbin' is not defined, which is unnecessary as 'binary' has been registered as default earlier, and will result in capabilities output such as /usr/bin/qemu-system-x86_64 /usr/bin/qemu-system-x86_64 with the second element providing no additional information. Change it so that, when 'kvmbin' is not defined, NULL is passed and so the default emulator will be used instead. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 2 +- tests/qemucaps2xmloutdata/caps_1.5.3.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_1.6.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_1.7.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.1.1.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.10.0.aarch64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.10.0.ppc64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.10.0.s390x.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.10.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.11.0.s390x.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.11.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.12.0.aarch64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.12.0.ppc64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.12.0.s390x.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.12.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.4.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.5.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.6.0.aarch64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.6.0.ppc64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.6.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.7.0.s390x.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.7.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.8.0.s390x.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.8.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.9.0.ppc64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.9.0.s390x.xml | 4 +--- tests/qemucaps2xmloutdata/caps_2.9.0.x86_64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_3.0.0.ppc64.xml | 4 +--- tests/qemucaps2xmloutdata/caps_3.0.0.x86_64.xml | 4 +--- 29 files changed, 29 insertions(+), 85 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e14da5acab..88f5b1f34e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -885,7 +885,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, =20 if ((dom =3D virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, - kvmbin ? kvmbin : binary, + kvmbin ? kvmbin : NULL, NULL, nmachines, machines)) =3D=3D NULL) { diff --git a/tests/qemucaps2xmloutdata/caps_1.5.3.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_1.5.3.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_1.5.3.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_1.5.3.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_1.6.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_1.6.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_1.6.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_1.6.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_1.7.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_1.7.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_1.7.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_1.7.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.1.1.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_2.1.1.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.1.1.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.1.1.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.10.0.aarch64.xml b/tests/qemu= caps2xmloutdata/caps_2.10.0.aarch64.xml index a879d67df3..f6572c8ecd 100644 --- a/tests/qemucaps2xmloutdata/caps_2.10.0.aarch64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.10.0.aarch64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-aarch64 - - /usr/bin/qemu-system-aarch64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.10.0.ppc64.xml b/tests/qemuca= ps2xmloutdata/caps_2.10.0.ppc64.xml index 74eaf3ba0e..85623f3980 100644 --- a/tests/qemucaps2xmloutdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.10.0.ppc64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-ppc64 - - /usr/bin/qemu-system-ppc64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.10.0.s390x.xml b/tests/qemuca= ps2xmloutdata/caps_2.10.0.s390x.xml index 20ef995d62..bb82a15040 100644 --- a/tests/qemucaps2xmloutdata/caps_2.10.0.s390x.xml +++ b/tests/qemucaps2xmloutdata/caps_2.10.0.s390x.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-s390x - - /usr/bin/qemu-system-s390x - + diff --git a/tests/qemucaps2xmloutdata/caps_2.10.0.x86_64.xml b/tests/qemuc= aps2xmloutdata/caps_2.10.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.10.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.11.0.s390x.xml b/tests/qemuca= ps2xmloutdata/caps_2.11.0.s390x.xml index 20ef995d62..bb82a15040 100644 --- a/tests/qemucaps2xmloutdata/caps_2.11.0.s390x.xml +++ b/tests/qemucaps2xmloutdata/caps_2.11.0.s390x.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-s390x - - /usr/bin/qemu-system-s390x - + diff --git a/tests/qemucaps2xmloutdata/caps_2.11.0.x86_64.xml b/tests/qemuc= aps2xmloutdata/caps_2.11.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.11.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.11.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.12.0.aarch64.xml b/tests/qemu= caps2xmloutdata/caps_2.12.0.aarch64.xml index a879d67df3..f6572c8ecd 100644 --- a/tests/qemucaps2xmloutdata/caps_2.12.0.aarch64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.12.0.aarch64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-aarch64 - - /usr/bin/qemu-system-aarch64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.12.0.ppc64.xml b/tests/qemuca= ps2xmloutdata/caps_2.12.0.ppc64.xml index 74eaf3ba0e..85623f3980 100644 --- a/tests/qemucaps2xmloutdata/caps_2.12.0.ppc64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.12.0.ppc64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-ppc64 - - /usr/bin/qemu-system-ppc64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.12.0.s390x.xml b/tests/qemuca= ps2xmloutdata/caps_2.12.0.s390x.xml index 20ef995d62..bb82a15040 100644 --- a/tests/qemucaps2xmloutdata/caps_2.12.0.s390x.xml +++ b/tests/qemucaps2xmloutdata/caps_2.12.0.s390x.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-s390x - - /usr/bin/qemu-system-s390x - + diff --git a/tests/qemucaps2xmloutdata/caps_2.12.0.x86_64.xml b/tests/qemuc= aps2xmloutdata/caps_2.12.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.12.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.4.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_2.4.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.4.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.4.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.5.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_2.5.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.5.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.5.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.6.0.aarch64.xml b/tests/qemuc= aps2xmloutdata/caps_2.6.0.aarch64.xml index a879d67df3..f6572c8ecd 100644 --- a/tests/qemucaps2xmloutdata/caps_2.6.0.aarch64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.6.0.aarch64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-aarch64 - - /usr/bin/qemu-system-aarch64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.6.0.ppc64.xml b/tests/qemucap= s2xmloutdata/caps_2.6.0.ppc64.xml index 74eaf3ba0e..85623f3980 100644 --- a/tests/qemucaps2xmloutdata/caps_2.6.0.ppc64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.6.0.ppc64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-ppc64 - - /usr/bin/qemu-system-ppc64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.6.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_2.6.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.6.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.6.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.7.0.s390x.xml b/tests/qemucap= s2xmloutdata/caps_2.7.0.s390x.xml index 20ef995d62..bb82a15040 100644 --- a/tests/qemucaps2xmloutdata/caps_2.7.0.s390x.xml +++ b/tests/qemucaps2xmloutdata/caps_2.7.0.s390x.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-s390x - - /usr/bin/qemu-system-s390x - + diff --git a/tests/qemucaps2xmloutdata/caps_2.7.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_2.7.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.7.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.7.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.8.0.s390x.xml b/tests/qemucap= s2xmloutdata/caps_2.8.0.s390x.xml index 20ef995d62..bb82a15040 100644 --- a/tests/qemucaps2xmloutdata/caps_2.8.0.s390x.xml +++ b/tests/qemucaps2xmloutdata/caps_2.8.0.s390x.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-s390x - - /usr/bin/qemu-system-s390x - + diff --git a/tests/qemucaps2xmloutdata/caps_2.8.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_2.8.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.8.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.8.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.9.0.ppc64.xml b/tests/qemucap= s2xmloutdata/caps_2.9.0.ppc64.xml index 74eaf3ba0e..85623f3980 100644 --- a/tests/qemucaps2xmloutdata/caps_2.9.0.ppc64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.9.0.ppc64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-ppc64 - - /usr/bin/qemu-system-ppc64 - + diff --git a/tests/qemucaps2xmloutdata/caps_2.9.0.s390x.xml b/tests/qemucap= s2xmloutdata/caps_2.9.0.s390x.xml index 20ef995d62..bb82a15040 100644 --- a/tests/qemucaps2xmloutdata/caps_2.9.0.s390x.xml +++ b/tests/qemucaps2xmloutdata/caps_2.9.0.s390x.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-s390x - - /usr/bin/qemu-system-s390x - + diff --git a/tests/qemucaps2xmloutdata/caps_2.9.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_2.9.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_2.9.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemucaps2xmloutdata/caps_3.0.0.ppc64.xml b/tests/qemucap= s2xmloutdata/caps_3.0.0.ppc64.xml index 74eaf3ba0e..85623f3980 100644 --- a/tests/qemucaps2xmloutdata/caps_3.0.0.ppc64.xml +++ b/tests/qemucaps2xmloutdata/caps_3.0.0.ppc64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-ppc64 - - /usr/bin/qemu-system-ppc64 - + diff --git a/tests/qemucaps2xmloutdata/caps_3.0.0.x86_64.xml b/tests/qemuca= ps2xmloutdata/caps_3.0.0.x86_64.xml index b58f54fefd..d41693a001 100644 --- a/tests/qemucaps2xmloutdata/caps_3.0.0.x86_64.xml +++ b/tests/qemucaps2xmloutdata/caps_3.0.0.x86_64.xml @@ -14,9 +14,7 @@ 64 /usr/bin/qemu-system-x86_64 - - /usr/bin/qemu-system-x86_64 - + --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457154442548.6863537930514; Thu, 20 Sep 2018 08:25:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62F6631500B2; Thu, 20 Sep 2018 15:25:52 +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 210EA84EE; Thu, 20 Sep 2018 15:25:52 +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 CAE70181A130; Thu, 20 Sep 2018 15:25:51 +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 w8KFPaHk022175 for ; Thu, 20 Sep 2018 11:25:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id B54EE2010D04; Thu, 20 Sep 2018 15:25:36 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 393042010D02 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:21 +0200 Message-Id: <20180920152529.25973-4-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 03/11] qemu: Move armv7l-on-aarch64 special case 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.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 20 Sep 2018 15:25:53 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When running an armv7l guest on an aarch64 hosts, the qemu-system-aarch64 binary should be our first choice instead of qemu-system-arm since the former can take advantage of KVM acceleration. Move the special case to virQEMUCapsFindBinaryForArch() so that it's handled along with all other cases rather than on its own later on. Doing so will also make further refactoring easier. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 88f5b1f34e..09d4af70ec 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -708,6 +708,15 @@ virQEMUCapsFindBinaryForArch(virArch hostarch, const char *archstr; virArch target; =20 + /* armv7l guests can only take advantage of KVM on aarch64 hosts by + * using the qemu-system-aarch64 binary, so look for that one first + * to avoid using qemu-system-arm (and thus TCG) instead */ + if (hostarch =3D=3D VIR_ARCH_AARCH64 && guestarch =3D=3D VIR_ARCH_ARMV= 7L) { + archstr =3D virQEMUCapsArchToString(hostarch); + if ((ret =3D virQEMUCapsFindBinary("qemu-system-%s", archstr)) != =3D NULL) + goto out; + } + /* First attempt: try the guest architecture as it is */ archstr =3D virQEMUCapsArchToString(guestarch); if ((ret =3D virQEMUCapsFindBinary("qemu-system-%s", archstr)) !=3D NU= LL) @@ -762,24 +771,9 @@ virQEMUCapsInitGuest(virCapsPtr caps, "/usr/libexec/qemu-kvm", /* RHEL */ "qemu-kvm", /* Fedora */ "kvm", /* Debian/Ubuntu */ - NULL, }; =20 - /* x86 32-on-64 can be used with qemu-system-i386 and - * qemu-system-x86_64, so if we don't find a specific kvm binary, - * we can just fall back to the host arch native binary and - * everything works fine. - * - * arm is different in that 32-on-64 _only_ works with - * qemu-system-aarch64. So we have to add it to the kvmbins list - */ - if (hostarch =3D=3D VIR_ARCH_AARCH64 && guestarch =3D=3D VIR_ARCH_= ARMV7L) - kvmbins[3] =3D "qemu-system-aarch64"; - for (i =3D 0; i < ARRAY_CARDINALITY(kvmbins); ++i) { - if (!kvmbins[i]) - continue; - kvmbin =3D virFindFileInPath(kvmbins[i]); =20 if (!kvmbin) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 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 From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457156853756.520205123609; Thu, 20 Sep 2018 08:25:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE694307D86D; Thu, 20 Sep 2018 15:25:54 +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 A875C308BDAE; Thu, 20 Sep 2018 15:25:54 +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 4CDBD4A463; Thu, 20 Sep 2018 15:25:54 +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 w8KFPcDb022187 for ; Thu, 20 Sep 2018 11:25:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64BB82010D02; Thu, 20 Sep 2018 15:25:38 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DCDBC2010D0D for ; Thu, 20 Sep 2018 15:25:37 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:23 +0200 Message-Id: <20180920152529.25973-6-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 05/11] qemu: Expect a single binary in virQEMUCapsInitGuest() 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 20 Sep 2018 15:25:55 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We're only ever passing a single binary when calling this function, so we can remove all code dealing with the possibility of a second binary being specified. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 19 ++++--------------- src/qemu/qemu_capabilities.h | 2 -- tests/qemucaps2xmltest.c | 2 -- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 647fde4b6b..aa2de9018c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -789,7 +789,6 @@ virQEMUCapsInitGuest(virCapsPtr caps, =20 ret =3D virQEMUCapsInitGuestFromBinary(caps, binary, qemubinCaps, - NULL, NULL, guestarch); =20 VIR_FREE(binary); @@ -802,8 +801,6 @@ int virQEMUCapsInitGuestFromBinary(virCapsPtr caps, const char *binary, virQEMUCapsPtr qemubinCaps, - const char *kvmbin, - virQEMUCapsPtr kvmbinCaps, virArch guestarch) { virCapsGuestPtr guest; @@ -816,8 +813,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, if (!binary) return 0; =20 - if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KVM) || - kvmbin) + if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KVM)) haskvm =3D true; =20 if (virQEMUCapsGetMachineTypesCaps(qemubinCaps, &nmachines, &machines)= < 0) @@ -863,21 +859,14 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, if (haskvm) { virCapsGuestDomainPtr dom; =20 - if (kvmbin && - virQEMUCapsGetMachineTypesCaps(kvmbinCaps, &nmachines, &machin= es) < 0) - goto cleanup; - if ((dom =3D virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, - kvmbin ? kvmbin : NULL, NULL, - nmachines, - machines)) =3D=3D NULL) { + NULL, + 0, + NULL)) =3D=3D NULL) { goto cleanup; } - - machines =3D NULL; - nmachines =3D 0; } =20 if ((ARCH_IS_X86(guestarch) || guestarch =3D=3D VIR_ARCH_AARCH64) && diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index e671f74ebb..94b3bbb2f6 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -612,8 +612,6 @@ const char *virQEMUCapsGetPreferredMachine(virQEMUCapsP= tr qemuCaps); int virQEMUCapsInitGuestFromBinary(virCapsPtr caps, const char *binary, virQEMUCapsPtr qemubinCaps, - const char *kvmbin, - virQEMUCapsPtr kvmbinCaps, virArch guestarch); =20 int virQEMUCapsFillDomainCaps(virCapsPtr caps, diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index e765a03b73..883909a973 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -106,8 +106,6 @@ testGetCaps(char *capsData, const testQemuData *data) if (virQEMUCapsInitGuestFromBinary(caps, binary, qemuCaps, - NULL, - NULL, arch) < 0) { fprintf(stderr, "failed to create the capabilities from qemu"); goto error; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457162249691.9606892443002; Thu, 20 Sep 2018 08:26:02 -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 6D468A6E1E; Thu, 20 Sep 2018 15:26:00 +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 3200D16ECB; Thu, 20 Sep 2018 15:26:00 +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 C24244A46F; Thu, 20 Sep 2018 15:25:59 +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 w8KFPdjt022194 for ; Thu, 20 Sep 2018 11:25:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C3682010D02; Thu, 20 Sep 2018 15:25:39 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B33832010D0D for ; Thu, 20 Sep 2018 15:25:38 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:24 +0200 Message-Id: <20180920152529.25973-7-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 06/11] qemu: Remove unnecessary variables 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 20 Sep 2018 15:26:01 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index aa2de9018c..01be627af0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -804,7 +804,6 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, virArch guestarch) { virCapsGuestPtr guest; - bool haskvm =3D false; virCapsGuestMachinePtr *machines =3D NULL; size_t nmachines =3D 0; int ret =3D -1; @@ -813,9 +812,6 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, if (!binary) return 0; =20 - if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KVM)) - haskvm =3D true; - if (virQEMUCapsGetMachineTypesCaps(qemubinCaps, &nmachines, &machines)= < 0) goto cleanup; =20 @@ -856,15 +852,13 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, NULL) =3D=3D NULL) goto cleanup; =20 - if (haskvm) { - virCapsGuestDomainPtr dom; - - if ((dom =3D virCapabilitiesAddGuestDomain(guest, - VIR_DOMAIN_VIRT_KVM, - NULL, - NULL, - 0, - NULL)) =3D=3D NULL) { + if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KVM)) { + if (virCapabilitiesAddGuestDomain(guest, + VIR_DOMAIN_VIRT_KVM, + NULL, + NULL, + 0, + NULL) =3D=3D NULL) { goto cleanup; } } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457167099469.028650623829; Thu, 20 Sep 2018 08:26:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3130932B695; Thu, 20 Sep 2018 15:26:05 +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 EB177308BDAE; Thu, 20 Sep 2018 15:26:04 +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 8E8E34A471; Thu, 20 Sep 2018 15:26:04 +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 w8KFPeIk022205 for ; Thu, 20 Sep 2018 11:25:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 123752010D04; Thu, 20 Sep 2018 15:25:40 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AFAC2010D02 for ; Thu, 20 Sep 2018 15:25:39 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:25 +0200 Message-Id: <20180920152529.25973-8-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 07/11] qemu: Don't look for "qemu-kvm" and "kvm" binaries 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 20 Sep 2018 15:26:06 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Both Fedora's qemu-kvm and Debian's/Ubuntu's kvm are nothing more than paper-thin wrappers around the native QEMU binary, so we gain nothing by looking for them. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 01be627af0..fd8badc60b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -767,8 +767,6 @@ virQEMUCapsInitGuest(virCapsPtr caps, if (virQEMUCapsGuestIsNative(hostarch, guestarch) && !binary) { const char *kvmbins[] =3D { "/usr/libexec/qemu-kvm", /* RHEL */ - "qemu-kvm", /* Fedora */ - "kvm", /* Debian/Ubuntu */ }; =20 for (i =3D 0; i < ARRAY_CARDINALITY(kvmbins); ++i) { --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457254330116.15346540478856; Thu, 20 Sep 2018 08:27:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FF6FC049ADF; Thu, 20 Sep 2018 15:27:32 +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 0EDE3100034A; Thu, 20 Sep 2018 15:27:32 +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 AC68F181A12D; Thu, 20 Sep 2018 15:27:31 +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 w8KFPeN4022216 for ; Thu, 20 Sep 2018 11:25:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id DFB302010D02; Thu, 20 Sep 2018 15:25:40 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6399B2010D0D for ; Thu, 20 Sep 2018 15:25:40 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:26 +0200 Message-Id: <20180920152529.25973-9-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 08/11] qemu: Simplify QEMU binary search 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 20 Sep 2018 15:27:33 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that we have reduced the number of sensible options down to either the native QEMU binary or RHEL's qemu-kvm, we can make virQEMUCapsInitGuest() a bit simpler. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index fd8badc60b..72fa19a2b7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -746,7 +746,6 @@ virQEMUCapsInitGuest(virCapsPtr caps, virArch hostarch, virArch guestarch) { - size_t i; char *binary =3D NULL; virQEMUCapsPtr qemubinCaps =3D NULL; int ret =3D -1; @@ -756,6 +755,13 @@ virQEMUCapsInitGuest(virCapsPtr caps, */ binary =3D virQEMUCapsFindBinaryForArch(hostarch, guestarch); =20 + /* RHEL doesn't follow the usual naming for QEMU binaries and ships + * a single binary named qemu-kvm outside of $PATH instead */ + if (virQEMUCapsGuestIsNative(hostarch, guestarch) && !binary) { + if (VIR_STRDUP(binary, "/usr/libexec/qemu-kvm") < 0) + return -1; + } + /* Ignore binary if extracting version info fails */ if (binary) { if (!(qemubinCaps =3D virQEMUCapsCacheLookup(cache, binary))) { @@ -764,27 +770,6 @@ virQEMUCapsInitGuest(virCapsPtr caps, } } =20 - if (virQEMUCapsGuestIsNative(hostarch, guestarch) && !binary) { - const char *kvmbins[] =3D { - "/usr/libexec/qemu-kvm", /* RHEL */ - }; - - for (i =3D 0; i < ARRAY_CARDINALITY(kvmbins); ++i) { - binary =3D virFindFileInPath(kvmbins[i]); - - if (!binary) - continue; - - if (!(qemubinCaps =3D virQEMUCapsCacheLookup(cache, binary))) { - virResetLastError(); - VIR_FREE(binary); - continue; - } - - break; - } - } - ret =3D virQEMUCapsInitGuestFromBinary(caps, binary, qemubinCaps, guestarch); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153745725894324.34711147470398; Thu, 20 Sep 2018 08:27:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3A7C3082126; Thu, 20 Sep 2018 15:27:36 +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 8E135309138F; Thu, 20 Sep 2018 15:27:36 +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 42B6A4A460; Thu, 20 Sep 2018 15:27:36 +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 w8KFPhxr022231 for ; Thu, 20 Sep 2018 11:25:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id A56C82010D6D; Thu, 20 Sep 2018 15:25:43 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 278C32010D0D for ; Thu, 20 Sep 2018 15:25:41 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:27 +0200 Message-Id: <20180920152529.25973-10-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 09/11] qemu: Rename qemubinCaps => qemuCaps 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.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 20 Sep 2018 15:27:37 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The latter is used throughout libvirt, so use it here as well for consistency. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 16 ++++++++-------- src/qemu/qemu_capabilities.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 72fa19a2b7..b78b935404 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -747,7 +747,7 @@ virQEMUCapsInitGuest(virCapsPtr caps, virArch guestarch) { char *binary =3D NULL; - virQEMUCapsPtr qemubinCaps =3D NULL; + virQEMUCapsPtr qemuCaps =3D NULL; int ret =3D -1; =20 /* Check for existence of base emulator, or alternate base @@ -764,18 +764,18 @@ virQEMUCapsInitGuest(virCapsPtr caps, =20 /* Ignore binary if extracting version info fails */ if (binary) { - if (!(qemubinCaps =3D virQEMUCapsCacheLookup(cache, binary))) { + if (!(qemuCaps =3D virQEMUCapsCacheLookup(cache, binary))) { virResetLastError(); VIR_FREE(binary); } } =20 ret =3D virQEMUCapsInitGuestFromBinary(caps, - binary, qemubinCaps, + binary, qemuCaps, guestarch); =20 VIR_FREE(binary); - virObjectUnref(qemubinCaps); + virObjectUnref(qemuCaps); =20 return ret; } @@ -783,7 +783,7 @@ virQEMUCapsInitGuest(virCapsPtr caps, int virQEMUCapsInitGuestFromBinary(virCapsPtr caps, const char *binary, - virQEMUCapsPtr qemubinCaps, + virQEMUCapsPtr qemuCaps, virArch guestarch) { virCapsGuestPtr guest; @@ -795,7 +795,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, if (!binary) return 0; =20 - if (virQEMUCapsGetMachineTypesCaps(qemubinCaps, &nmachines, &machines)= < 0) + if (virQEMUCapsGetMachineTypesCaps(qemuCaps, &nmachines, &machines) < = 0) goto cleanup; =20 /* We register kvm as the base emulator too, since we can @@ -820,7 +820,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, if (!virCapabilitiesAddGuestFeature(guest, "deviceboot", true, false)) goto cleanup; =20 - if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_DISK_SNAPSHOT)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISK_SNAPSHOT)) hasdisksnapshot =3D true; =20 if (!virCapabilitiesAddGuestFeature(guest, "disksnapshot", hasdisksnap= shot, @@ -835,7 +835,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, NULL) =3D=3D NULL) goto cleanup; =20 - if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KVM)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, NULL, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 94b3bbb2f6..253f19c2db 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -611,7 +611,7 @@ const char *virQEMUCapsGetPreferredMachine(virQEMUCapsP= tr qemuCaps); =20 int virQEMUCapsInitGuestFromBinary(virCapsPtr caps, const char *binary, - virQEMUCapsPtr qemubinCaps, + virQEMUCapsPtr qemuCaps, virArch guestarch); =20 int virQEMUCapsFillDomainCaps(virCapsPtr caps, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457263661541.0882516823916; Thu, 20 Sep 2018 08:27:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2955330024F1; Thu, 20 Sep 2018 15:27:41 +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 D66947E6B5; Thu, 20 Sep 2018 15:27:40 +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 8BE334A46C; Thu, 20 Sep 2018 15:27:40 +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 w8KFPiq9022241 for ; Thu, 20 Sep 2018 11:25:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7C2922010D04; Thu, 20 Sep 2018 15:25:44 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3F082010D02 for ; Thu, 20 Sep 2018 15:25:43 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:28 +0200 Message-Id: <20180920152529.25973-11-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 10/11] qemu: Refactor virQEMUCapsCacheLookupByArch() 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.79 on 10.5.11.16 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:27:42 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The new implementation contains less duplicated code and is easier to extend. This commit is best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b78b935404..b621f39a82 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4752,26 +4752,27 @@ virQEMUCapsCacheLookupByArch(virFileCachePtr cache, virArch arch) { virQEMUCapsPtr ret =3D NULL; - virArch target; - struct virQEMUCapsSearchData data =3D { .arch =3D arch }; - - ret =3D virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch, &data); - if (!ret) { - /* If the first attempt at finding capabilities has failed, try - * again using the QEMU target as lookup key instead */ - target =3D virQEMUCapsFindTarget(virArchFromHost(), data.arch); - if (target !=3D data.arch) { - data.arch =3D target; - ret =3D virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch= , &data); - } - } + virArch archs[] =3D { + arch, + virQEMUCapsFindTarget(virArchFromHost(), arch), + }; + size_t j; =20 - if (!ret) { - virReportError(VIR_ERR_INVALID_ARG, - _("unable to find any emulator to serve '%s' " - "architecture"), virArchToString(arch)); + for (j =3D 0; j < ARRAY_CARDINALITY(archs); j++) { + struct virQEMUCapsSearchData data =3D { + .arch =3D archs[j], + }; + + ret =3D virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch, &d= ata); + if (ret) + goto done; } =20 + virReportError(VIR_ERR_INVALID_ARG, + _("unable to find any emulator to serve '%s' " + "architecture"), virArchToString(arch)); + + done: VIR_DEBUG("Returning caps %p for arch %s", ret, virArchToString(arch)); =20 return ret; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:39:30 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537457172056840.3165367812072; Thu, 20 Sep 2018 08:26:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E72F23091D70; Thu, 20 Sep 2018 15:26:09 +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 8B8407ED92; Thu, 20 Sep 2018 15:26:09 +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 25721181A13B; Thu, 20 Sep 2018 15:26:09 +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 w8KFPjVZ022257 for ; Thu, 20 Sep 2018 11:25:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 52A852010D04; Thu, 20 Sep 2018 15:25:45 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CBDDF2010D02 for ; Thu, 20 Sep 2018 15:25:44 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:25:29 +0200 Message-Id: <20180920152529.25973-12-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 11/11] qemu: Prefer qemu-system-* binaries 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.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 20 Sep 2018 15:26:10 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We already prefer them in capabilities, and domcapabilities should be consistent with that. This commit is best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b621f39a82..77013a818e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -583,6 +583,7 @@ struct _virQEMUCaps { =20 struct virQEMUCapsSearchData { virArch arch; + const char *binaryFilter; }; =20 =20 @@ -4743,7 +4744,15 @@ virQEMUCapsCompareArch(const void *payload, struct virQEMUCapsSearchData *data =3D (struct virQEMUCapsSearchData *= )opaque; const virQEMUCaps *qemuCaps =3D payload; =20 - return qemuCaps->arch =3D=3D data->arch; + if (qemuCaps->arch !=3D data->arch) + return false; + + if (data->binaryFilter && + !strstr(qemuCaps->binary, data->binaryFilter)) { + return false; + } + + return true; } =20 =20 @@ -4752,20 +4761,28 @@ virQEMUCapsCacheLookupByArch(virFileCachePtr cache, virArch arch) { virQEMUCapsPtr ret =3D NULL; + const char *binaryFilters[] =3D { + "qemu-system-", + NULL, + }; virArch archs[] =3D { arch, virQEMUCapsFindTarget(virArchFromHost(), arch), }; + size_t i; size_t j; =20 - for (j =3D 0; j < ARRAY_CARDINALITY(archs); j++) { - struct virQEMUCapsSearchData data =3D { - .arch =3D archs[j], - }; + for (i =3D 0; i < ARRAY_CARDINALITY(binaryFilters); i++) { + for (j =3D 0; j < ARRAY_CARDINALITY(archs); j++) { + struct virQEMUCapsSearchData data =3D { + .arch =3D archs[j], + .binaryFilter =3D binaryFilters[i], + }; =20 - ret =3D virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch, &d= ata); - if (ret) - goto done; + ret =3D virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch= , &data); + if (ret) + goto done; + } } =20 virReportError(VIR_ERR_INVALID_ARG, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list