From nobody Sun Feb 8 15:42:22 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 15505671608641016.2563190271097; Tue, 19 Feb 2019 01:06:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F418E5D608; Tue, 19 Feb 2019 09:05:58 +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 C0CB6648DE; Tue, 19 Feb 2019 09:05:58 +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 79EBF181A13D; Tue, 19 Feb 2019 09:05:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1J95LBD016285 for ; Tue, 19 Feb 2019 04:05:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B3AB17DC4; Tue, 19 Feb 2019 09:05:21 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DEEDA17CEC for ; Tue, 19 Feb 2019 09:05:15 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 637F910010C; Tue, 19 Feb 2019 10:05:09 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 19 Feb 2019 10:04:53 +0100 Message-Id: <2cb64fcea247a0acde3699ef805e28284e9c58fd.1550566126.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/20] qemu_capabilities: Log probe failure in virQEMUCapsInitQMPSingle 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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 19 Feb 2019 09:05:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Let's push the call to virQEMUCapsLogProbeFailure down the stack to where the probing failure is detected. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 7: - this patch was originally included in [PATCH 09/33] qemu_process: Expose process exit status code in version 6 with a bunch of other unrelated changes - modified after virQEMUCapsInitQMP was refactored src/qemu/qemu_capabilities.c | 47 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index bb1920146e..264dcae983 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4351,6 +4351,26 @@ virQEMUCapsInitQMPMonitorTCG(virQEMUCapsPtr qemuCaps= ATTRIBUTE_UNUSED, } =20 =20 +#define MESSAGE_ID_CAPS_PROBE_FAILURE "8ae2f3fb-2dbe-498e-8fbd-012d40afa36= 1" + +static void +virQEMUCapsLogProbeFailure(const char *binary) +{ + virLogMetadata meta[] =3D { + { .key =3D "MESSAGE_ID", .s =3D MESSAGE_ID_CAPS_PROBE_FAILURE, .iv= =3D 0 }, + { .key =3D "LIBVIRT_QEMU_BINARY", .s =3D binary, .iv =3D 0 }, + { .key =3D NULL }, + }; + + virLogMessage(&virLogSelf, + VIR_LOG_WARN, + __FILE__, __LINE__, __func__, + meta, + _("Failed to probe capabilities for %s: %s"), + binary, virGetLastErrorMessage()); +} + + static int virQEMUCapsInitQMPSingle(virQEMUCapsPtr qemuCaps, const char *libDir, @@ -4375,6 +4395,9 @@ virQEMUCapsInitQMPSingle(virQEMUCapsPtr qemuCaps, ret =3D virQEMUCapsInitQMPMonitor(qemuCaps, proc->mon); =20 cleanup: + if (ret < 0) + virQEMUCapsLogProbeFailure(qemuCaps->binary); + qemuProcessQMPStop(proc); qemuProcessQMPFree(proc); return ret; @@ -4404,26 +4427,6 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps, } =20 =20 -#define MESSAGE_ID_CAPS_PROBE_FAILURE "8ae2f3fb-2dbe-498e-8fbd-012d40afa36= 1" - -static void -virQEMUCapsLogProbeFailure(const char *binary) -{ - virLogMetadata meta[] =3D { - { .key =3D "MESSAGE_ID", .s =3D MESSAGE_ID_CAPS_PROBE_FAILURE, .iv= =3D 0 }, - { .key =3D "LIBVIRT_QEMU_BINARY", .s =3D binary, .iv =3D 0 }, - { .key =3D NULL }, - }; - - virLogMessage(&virLogSelf, - VIR_LOG_WARN, - __FILE__, __LINE__, __func__, - meta, - _("Failed to probe capabilities for %s: %s"), - binary, virGetLastErrorMessage()); -} - - virQEMUCapsPtr virQEMUCapsNewForBinaryInternal(virArch hostArch, const char *binary, @@ -4462,10 +4465,8 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, goto error; } =20 - if (virQEMUCapsInitQMP(qemuCaps, libDir, runUid, runGid, &qmperr) < 0)= { - virQEMUCapsLogProbeFailure(binary); + if (virQEMUCapsInitQMP(qemuCaps, libDir, runUid, runGid, &qmperr) < 0) goto error; - } =20 qemuCaps->libvirtCtime =3D virGetSelfLastChanged(); qemuCaps->libvirtVersion =3D LIBVIR_VERSION_NUMBER; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list