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.129.124]) by passt.top (Postfix) with ESMTP id 14F2E5A0082 for ; Thu, 16 Feb 2023 17:33:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676565200; 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=gOVHOuJh5/UuVRfHw1VskhWxJccUwtf1g3WpykYURfQ=; b=YQhxH2BtI02r8pyOBdl8LGsMkwF9+VtBuV+Zw0UiosN5yrzb+PJ0f1GCS6tXHuEltLiZ87 cHzdl2y2CPu/H1EK4JH0wjkdalX2eOkz2i/4K2/U1tShh9HQx61wiuNjkRv70JfmhLa/3I C696dnU2v9Yk07jA2mtE3Z9UE6jufNQ= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-563-kMtZvDNjNE-dFK6aKjriug-1; Thu, 16 Feb 2023 11:33:18 -0500 X-MC-Unique: kMtZvDNjNE-dFK6aKjriug-1 Received: by mail-qv1-f70.google.com with SMTP id t5-20020a0cef45000000b0056ecf4b8f5cso1347056qvs.19 for ; Thu, 16 Feb 2023 08:33:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gOVHOuJh5/UuVRfHw1VskhWxJccUwtf1g3WpykYURfQ=; b=pWoAD7gMRvh4Wm09ELy7FsEoRqlu92l3kNWr3b3Vf0/MveGBrlsXseyFbc71DTp00B YgzWDOxbWdHjOpNwhXnlmVRkJDWMr19QgBHQdeTtq3Gp/WNPQ5a098E1hBwHpF6eb5U3 4swN2Cdqv05OyHLJe92ulFAvFr4JGdQS1P7tRsFGeBT1VCJ7xvM3EAtmPOo1EdOJP1KK rRLBajleMTEcd6yc5fOwt4dwtn37bKCcXYD3aIeigPeud7UUKqLl9MrX2wFo2VTMi2eF YlolghUdf7SG3g14nHP8nTzwhbnC73C1yzv38czIkeU2wF1GGexU16qv1B72h1FcBYYB l66g== X-Gm-Message-State: AO0yUKXXN2oCJXfVxsgGC1cO8+fIK8ROc7xhtCO5dTIwfWH3lcGpNlOU /vAAB4Dp59Q3ls28h1UaC3qF2cSRRUklV8/ruJdMhi2mh+HubZruICrOK2WZF37aRcxH49bc8ye N7D1vh+h7jBa9 X-Received: by 2002:a05:6214:501c:b0:56b:f178:f45b with SMTP id jo28-20020a056214501c00b0056bf178f45bmr13266741qvb.13.1676565197710; Thu, 16 Feb 2023 08:33:17 -0800 (PST) X-Google-Smtp-Source: AK7set8c0pCcq30D17w/WkIcRIbzlcWW90+EpBHFkqz76YERq3DS5C29aNqzXp5asBuRSgPLW0RJzg== X-Received: by 2002:a05:6214:501c:b0:56b:f178:f45b with SMTP id jo28-20020a056214501c00b0056bf178f45bmr13266712qvb.13.1676565197422; Thu, 16 Feb 2023 08:33:17 -0800 (PST) Received: from ?IPV6:2600:8805:3a00:3:3b4f:6d3c:92c4:a5c7? ([2600:8805:3a00:3:3b4f:6d3c:92c4:a5c7]) by smtp.gmail.com with ESMTPSA id v1-20020a372f01000000b00721299cfffesm1494141qkh.39.2023.02.16.08.33.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Feb 2023 08:33:17 -0800 (PST) Message-ID: Date: Thu, 16 Feb 2023 11:33:16 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v2 3/5] qemu_passt: Make passt report errors to stderr whenever possible To: libvir-list@redhat.com References: From: Laine Stump Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: GXKCFFNRUQKL3HEBVYPRXPJXHZEQD4JO X-Message-ID-Hash: GXKCFFNRUQKL3HEBVYPRXPJXHZEQD4JO X-MailFrom: laine@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: sbrivio@redhat.com, passt-dev@passt.top, Michal Privoznik 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: This is all unnecessary. The issue with error messages has been fixed upstream in passt (along with other logging issues), and just serves to unnecessarily complicate the code. On 2/16/23 8:32 AM, 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"); > + } > > /* 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); > + } else { > + virReportError(VIR_ERR_INTERNAL_ERROR, > + _("Could not start 'passt': exit status = '%d'"), > + exitstatus); > + } > + > goto error; > } >