From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id BC31E5A026A for ; Thu, 16 Feb 2023 17:07:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676563629; h=from:from: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; bh=mucPhq+T9EWFZU7Vy9WRIsn2dh2yZwclKuE3MKlW/38=; b=D/covHD2A/m+F1wDredL7Se2N2fAxPEF66g0iwKw+lYj0sJ4ZErWVeceb2IkL1lrGmmCgF n7Y6jadfMJ3Zttj7/T8zSwEahJNCuHaTUACAZH1qd63z8Y9R9S25YAw56ZHnVHBN2Is1ru xq03TMyP3MX4ssLXogMfEEcubHs3vFk= 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-210-HhAVr8L6MrGDjvsUc3OJxg-1; Thu, 16 Feb 2023 11:07:08 -0500 X-MC-Unique: HhAVr8L6MrGDjvsUc3OJxg-1 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 0A670800DB8 for ; Thu, 16 Feb 2023 16:07:06 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1DF81121314; Thu, 16 Feb 2023 16:07:05 +0000 (UTC) Date: Thu, 16 Feb 2023 17:07:02 +0100 From: Stefano Brivio To: Michal Privoznik Subject: Re: [PATCH v2 3/5] qemu_passt: Make passt report errors to stderr whenever possible Message-ID: <20230216170702.3ad76aeb@elisabeth> In-Reply-To: References: Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 4FHTBMPHMIYBVQCRLA7EJCWWW5VKNJXM X-Message-ID-Hash: 4FHTBMPHMIYBVQCRLA7EJCWWW5VKNJXM X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: libvir-list@redhat.com, passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 16 Feb 2023 14:32:50 +0100 Michal Privoznik wrote: > 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); > > - 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"); > + } There's no need for this, see my previous email, archived at: https://listman.redhat.com/archives/libvir-list/2023-February/237880.html > > /* Add IP address info */ > for (i = 0; i < net->guestIP.nips; i++) { > @@ -265,8 +270,19 @@ qemuPasstStart(virDomainObj *vm, > goto error; > > if (cmdret < 0 || exitstatus != 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 error"), > + net->backend.logFile); ...and this won't be needed either, with Laine's series for passt. It might actually be a bit misleading. > + } else { > + virReportError(VIR_ERR_INTERNAL_ERROR, > + _("Could not start 'passt': exit status = '%d'"), > + exitstatus); > + } > + > goto error; > } > So all in all I think this is unnecessary, but also kind of harmless. -- Stefano