From nobody Mon Feb 9 03:29:11 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=1676554384; cv=none; d=zohomail.com; s=zohoarc; b=PxJxzV2TtF4GyKt3+MQnT0xxLfGS3n8loYJNizzMQgBrwbbnMPc+kgZwznkU73CXSHADKR1NQY3B0MvviA/L6q3adDl7ix6dLqj9cx1BSgwRd2Nih6lPB2fiUiE9wmM/ONC474gjMyXaiFQ7JFwkJkU6BQIK+Wi2GxQApiBUF70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676554384; h=Content-Type:Content-Transfer-Encoding:Cc: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=Y1qbgY17azwIvSZN0bSZAnn5wZELMXL8gKpQu+DXsoQ=; b=GJYAm6FnKe42hqY6C5XDDmqXuubCLqGIwHmV8EvQz98mQkFjwsU5DKAF7yaJDCKsm6fP7jEmJYsDn6REbQp7gknTA1QQxUXS0wZHTc1rTAq8HnbQfz/uVd4TZUMFTz8mWuF0va9mqaLi2AzJl/sWbtadN/2KzfbxybrS6rrxuNE= 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 1676554384602979.0435589807564; Thu, 16 Feb 2023 05:33:04 -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-104-XStEPv5mPDCNbV6si-njDA-1; Thu, 16 Feb 2023 08:33:01 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2FE8100F912; Thu, 16 Feb 2023 13:32:57 +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 DCCFC492B10; Thu, 16 Feb 2023 13:32:57 +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 565FC19465A0; Thu, 16 Feb 2023 13:32:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0673C1946A4B for ; Thu, 16 Feb 2023 13:32:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EE3342166B34; Thu, 16 Feb 2023 13:32:56 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 606352166B30; Thu, 16 Feb 2023 13:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676554383; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Y1qbgY17azwIvSZN0bSZAnn5wZELMXL8gKpQu+DXsoQ=; b=WuPdk3TZAhM9qrb7ZZWKWtg8xkyttdY1AoDTa9sJkb3l4c2phjoy4fA7+0c1siljlltgG4 gjxJfsHeKTfAAmjQaeAOxbSXcl0uuTTjBaKTp8sOnyGN0w0F0tSFm8TuziePKoqfNFm4xg PuxcFMbW0RGKFBo8sphNRXjpjpBPYOs= X-MC-Unique: XStEPv5mPDCNbV6si-njDA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 3/5] qemu_passt: Make passt report errors to stderr whenever possible Date: Thu, 16 Feb 2023 14:32:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1676554387715100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Passt has '--stderr' argument which makes it report error onto stderr rather to system log. Unfortunately, it's currently impossible to use both '--log-file' and '--stderr', so pass the latter only if the former isn't passed. Then, use the stderr to produce more user friendly error message on failed start. Signed-off-by: Michal Privoznik --- src/qemu/qemu_passt.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index c082c149cd..881205449b 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -171,8 +171,13 @@ qemuPasstStart(virDomainObj *vm, if (net->sourceDev) virCommandAddArgList(cmd, "--interface", net->sourceDev, NULL); =20 - if (net->backend.logFile) + if (net->backend.logFile) { virCommandAddArgList(cmd, "--log-file", net->backend.logFile, NULL= ); + } else { + /* By default, passt logs into system logger. But we are interested + * into errors too. Make it print errors onto stderr. */ + virCommandAddArg(cmd, "--stderr"); + } =20 /* Add IP address info */ for (i =3D 0; i < net->guestIP.nips; i++) { @@ -265,8 +270,19 @@ qemuPasstStart(virDomainObj *vm, goto error; =20 if (cmdret < 0 || exitstatus !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not start 'passt': %s"), NULLSTR(errbuf)); + if (STRNEQ_NULLABLE(errbuf, "")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not start 'passt': %s"), errbuf); + } else if (net->backend.logFile) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not start 'passt': look into %s for er= ror"), + net->backend.logFile); + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not start 'passt': exit status =3D '%d= '"), + exitstatus); + } + goto error; } =20 --=20 2.39.1