From nobody Tue Feb 10 11:55:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1674252250; cv=none; d=zohomail.com; s=zohoarc; b=cW4VePos8oS7GTyn7llS+74mhfvl7HnIVRIY4tE/5sH04789K8wHODclH++CVLqdCcrK3RY1+lYWb7tVPiz3KsC+k5elgO5/aSb/Cmm0Kt07TFE+rN9ei6+BLA+qYCtV2Q6Eh9aBvL7aeKFtzKBjkO2Rikpa7fD86wzZcBqmrP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674252250; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5cBSk54gfYWSGDspoauhdsRoJHPV2mt68SWsFH++0Ak=; b=iBwTdWC5lNDl4MFqG1RZeseOU6sh+mmXAG9KDq3wxlwbbFBnitrhVWlOhiy1K6WzbNjsg30eY/I8wghFcRpzp5e1TKsfJEbmC8CWNpKMMG/VycDm+d7lSnVedZk8nqlHWIH2fqfP8CtRc4rIUUkDTe/IMNeKa0UhAiascEiZHaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674252250291347.9230237286945; Fri, 20 Jan 2023 14:04:10 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-sJHJC7evN5ChJtl3P0Ibhg-1; Fri, 20 Jan 2023 17:03:55 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37DE780B3C8; Fri, 20 Jan 2023 22:03:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F515483EC3; Fri, 20 Jan 2023 22:03:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E9F7C1946588; Fri, 20 Jan 2023 22:03:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 52CA61947063 for ; Fri, 20 Jan 2023 22:03:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4684B14171C2; Fri, 20 Jan 2023 22:03:29 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.18.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 246BA14171C1 for ; Fri, 20 Jan 2023 22:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674252249; h=from:from:sender:sender: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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5cBSk54gfYWSGDspoauhdsRoJHPV2mt68SWsFH++0Ak=; b=GHUS+YrARf0bMUPqfTasMWHFvY+NAw6D8EYn/Loug+rEjzeJU9mjPARYKtMIUqNyyPYqxP Sr7WGkUs1PC0zFim55mmr1llE7r+A+YnE3vtVn3gM9IbTfDPuskRvmN+lp1j7y2yuWN0V6 /S68rfB6AtIrGzDvvPSGUjivdaMQT1Y= X-MC-Unique: sJHJC7evN5ChJtl3P0Ibhg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v4 15/31] qemu: log error output from nbdkit Date: Fri, 20 Jan 2023 16:03:09 -0600 Message-Id: <20230120220325.1015090-16-jjongsma@redhat.com> In-Reply-To: <20230120220325.1015090-1-jjongsma@redhat.com> References: <20230120220325.1015090-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674252251857100001 Content-Type: text/plain; charset="utf-8"; x-default="true" log stderr and stdout from nbdkit into its own log so that nbdkit-related issues can be debugged more easily. Signed-off-by: Jonathon Jongsma Reviewed-by: Peter Krempa --- src/qemu/qemu_nbdkit.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index 34462f784a..7a7b9a6a54 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -848,15 +848,24 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, int rc; int exitstatus =3D 0; int cmdret =3D 0; - VIR_AUTOCLOSE errfd =3D -1; virTimeBackOffVar timebackoff; bool socketCreated =3D false; + g_autofree char *basename =3D g_strdup_printf("%s-nbdkit-%i", vm->def-= >name, proc->source->id); + int logfd =3D -1; + g_autoptr(qemuLogContext) logContext =3D NULL; + g_autofree char *errmsg =3D NULL; + g_autoptr(virURI) uri =3D NULL; + g_autofree char *uristring =3D NULL; =20 if (!(cmd =3D qemuNbdkitProcessBuildCommand(proc))) return -1; =20 + logContext =3D qemuLogContextNew(driver, vm, basename); + logfd =3D qemuLogContextGetWriteFD(logContext); + VIR_DEBUG("starting nbdkit process for %s", proc->source->nodestorage); - virCommandSetErrorFD(cmd, &errfd); + virCommandSetErrorFD(cmd, &logfd); + virCommandSetOutputFD(cmd, &logfd); virCommandSetPidFile(cmd, proc->pidfile); =20 if (qemuExtDeviceLogCommand(driver, vm, cmd, "nbdkit") < 0) @@ -900,12 +909,15 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, return 0; =20 error: - if (errfd > 0) { - g_autofree char *errbuf =3D g_new0(char, 1024); - if (read(errfd, errbuf, 1024) > 0) - virReportError(VIR_ERR_OPERATION_FAILED, - _("nbdkit failed to start and reported: %s"), e= rrbuf); - } + if (qemuLogContextReadFiltered(logContext, &errmsg, 1024) < 0) + VIR_WARN("Unable to read from nbdkit log"); + + uri =3D qemuBlockStorageSourceGetURI(proc->source); + uristring =3D virURIFormat(uri); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to connect to nbdkit for '%s': %s"), + uristring, errmsg); + qemuNbdkitProcessStop(proc); return -1; } --=20 2.39.0