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 029C05A005E for ; Thu, 9 Feb 2023 09:36:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675931792; 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: in-reply-to:in-reply-to:references:references; bh=VIEAbh0yUiyJecERQEnohR6al1br7ZQX25L96MCwLlA=; b=bU4zMqmpv/d+vcctNeQT/x4x8KqGrBSPso2ulnQOLNY/8fTlqzeKH/QvmOJ1BqePFwu4Sb bFBLom0ILuvxNMlIhY5zASqEqn1lOnpuGnyRCxF29ENjutT7dz3rdI3kTXxjJI8LVwnocq 8sC37/E8sNW6Gk065qexkwVaFyTRvdU= 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-587-7xrBzoQJP0SPlz7wnD9RQA-1; Thu, 09 Feb 2023 03:36:30 -0500 X-MC-Unique: 7xrBzoQJP0SPlz7wnD9RQA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E1C487B2A1 for ; Thu, 9 Feb 2023 08:36:30 +0000 (UTC) Received: from angien.pipo.sk (ovpn-208-29.brq.redhat.com [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B28C2026D4B; Thu, 9 Feb 2023 08:36:29 +0000 (UTC) Date: Thu, 9 Feb 2023 09:36:26 +0100 From: Peter Krempa To: Laine Stump Subject: Re: [libvirt PATCH] qemu: allow passt to self-daemonize Message-ID: References: <20230208231310.1728051-1-laine@redhat.com> MIME-Version: 1.0 In-Reply-To: <20230208231310.1728051-1-laine@redhat.com> User-Agent: Mutt/2.2.9 (2022-11-12) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation Message-ID-Hash: QTUJH67AA3YPF4Q7ZCIF7FJJAAYGHXLH X-Message-ID-Hash: QTUJH67AA3YPF4Q7ZCIF7FJJAAYGHXLH X-Mailman-Approved-At: Thu, 09 Feb 2023 10:29:07 +0100 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 Wed, Feb 08, 2023 at 18:13:10 -0500, Laine Stump wrote: > I initially had the passt process being started in an identical > fashion to the slirp-helper - libvirt was daemonizing the new process > and recording its pid in a pidfile. The problem with this is that, > since it is daemonized immediately, any startup error in passt happens > after the daemonization, and thus isn't seen by libvirt - libvirt > believes that the process has started successfully and continues on > its merry way. The result was that sometimes a guest would be started, > but there would be no passt process for qemu to use for network > traffic. > > Instead, we should be starting passt in the same manner we start > dnsmasq - we just exec it as normal (along with a request that passt > create the pidfile, which is just another option on the passt > commandline) and wait for the child process to exit; passt then has a > chance to parse its commandline and complete all the setup prior to > daemonizing itself; if it encounters an error and exits with a non-0 > code, libvirt will see the code and know about the failure. We can > then grab the output from stderr, log that so the "user" has some idea > of what went wrong, and then fail the guest startup. > > Signed-off-by: Laine Stump > --- > src/qemu/qemu_passt.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) [..] > if (cmdret < 0 || exitstatus != 0) { > virReportError(VIR_ERR_INTERNAL_ERROR, > - _("Could not start 'passt'. exitstatus: %d"), exitstatus); > + _("Could not start 'passt': %s"), errbuf); > goto error; > } So the 'passt' binary doesn't do any logging later on during runtime which we'd have to capture into a specific log file? For this patch: Reviewed-by: Peter Krempa