From nobody Wed Feb 11 06:14:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1676394532; cv=none; d=zohomail.com; s=zohoarc; b=eow/2cPNI0igPmQOdwTmc5vD8ZoSXE4M3hXNJiNoL8CEC9ZFwrlXtuu7Yvk46e6htEUGhUYxRkpPbH0umDyzFVS452KbYPGVO5p1XxWzy0J9Bj4d6F9WFqvCzLJaWzWkm9nop4ufYIBPIAaDZSddtnIgPfi2Qg199y7jTDuuqOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676394532; 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=xGMVBkcXO/Vfz6dgj9ZoyHyJNApad0bB18+nCoPXEIw=; b=gA4/ztA1fJhdbgwyk07juUuNsE+uaO9zsFddMildJWTUfkyspJ0srCAdCWfQxfTtHBujuzgbvg+7MMxfYUSprrdyXocuOJU/ZWE0aXpzuSbE8FdjD1sT5/NBvhwW/qKHj79wkUoAwCUeDLwGu8DILa+xAVZwRbWoh0H5+MT3fOs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1676394532900552.2082098767286; Tue, 14 Feb 2023 09:08:52 -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-635-c1XKKKWUPoaKJDuWsy2Y9w-1; Tue, 14 Feb 2023 12:08:48 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 506FF803D53; Tue, 14 Feb 2023 17:08:42 +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 3C43B1121318; Tue, 14 Feb 2023 17:08:42 +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 871BA1946A7A; Tue, 14 Feb 2023 17:08:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 588AD19465BC for ; Tue, 14 Feb 2023 17:08:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5C94135453; Tue, 14 Feb 2023 17:08:24 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.8.15]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39E7B440D9 for ; Tue, 14 Feb 2023 17:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676394531; 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=xGMVBkcXO/Vfz6dgj9ZoyHyJNApad0bB18+nCoPXEIw=; b=GwfWKt4lrnqiB7PaPX2/2pafsdvQAFab0C1QWcpGS7/1jDvtn3k9yV49WcHuwIVh5bHXiw yo7FA8q2EXBia42QnOkCbSqeubWS9cOEvgQMqnLkRNJ+61jfPyHnZ0RRDXU1A6HtPh/Df6 23tasqKyu0/GtTF17SIRhwkzjCRX/4g= X-MC-Unique: c1XKKKWUPoaKJDuWsy2Y9w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v5 15/32] qemu: log error output from nbdkit Date: Tue, 14 Feb 2023 11:08:02 -0600 Message-Id: <20230214170819.3143132-16-jjongsma@redhat.com> In-Reply-To: <20230214170819.3143132-1-jjongsma@redhat.com> References: <20230214170819.3143132-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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.3 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: 1676394534375100001 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 | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index 5abccf1536..f2ff9552a3 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -850,15 +850,28 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, int rc; int exitstatus =3D 0; int cmdret =3D 0; - g_autofree char *errbuf =3D NULL; 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 + if (!(logContext =3D qemuLogContextNew(driver, vm, basename))) { + virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); + return -1; + } + + logfd =3D qemuLogContextGetWriteFD(logContext); + VIR_DEBUG("starting nbdkit process for %s", proc->source->nodestorage); - virCommandSetErrorBuffer(cmd, &errbuf); + virCommandSetErrorFD(cmd, &logfd); + virCommandSetOutputFD(cmd, &logfd); virCommandSetPidFile(cmd, proc->pidfile); =20 if (qemuExtDeviceLogCommand(driver, vm, cmd, "nbdkit") < 0) @@ -902,9 +915,16 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, return 0; =20 error: - if (errbuf) - virReportError(VIR_ERR_OPERATION_FAILED, - _("nbdkit failed to start and reported: %s"), errbu= f); + if (qemuLogContextReadFiltered(logContext, &errmsg, 1024) < 0) + VIR_WARN("Unable to read from nbdkit log"); + + if ((uri =3D qemuBlockStorageSourceGetURI(proc->source))) + uristring =3D virURIFormat(uri); + + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to connect to nbdkit for '%s': %s"), + NULLSTR(uristring), NULLSTR(errmsg)); + qemuNbdkitProcessStop(proc); return -1; } --=20 2.39.1