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 090625A005E for ; Thu, 9 Feb 2023 09:59:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675933198; 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=Ca/odAu/G5/oA6NFW5qW57kDcnpf/NdKh4d+ruY/VLw=; b=KQd7y2g2ZbiWh0mcsGxTKvy/dTL1ZUo7cKr/YczWimDAuQ8AcgryNTLi57MfUZQDcd5+0i Ctf/RwBJ6/b1Aw1aReUm/FR8IOdPd/P4tBChXNVOnqmKFr+2dSSAm3z0v6V6XuQ4rVki6S /CCoWDovQIn8Zmbof2k7QLyrJ0bVWCo= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-607-7i9nI2m3O-W9ZdPTL3jtIw-1; Thu, 09 Feb 2023 03:59:56 -0500 X-MC-Unique: 7i9nI2m3O-W9ZdPTL3jtIw-1 Received: by mail-ej1-f70.google.com with SMTP id qa17-20020a170907869100b0088ea39742c8so1092851ejc.13 for ; Thu, 09 Feb 2023 00:59:56 -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: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=Ca/odAu/G5/oA6NFW5qW57kDcnpf/NdKh4d+ruY/VLw=; b=t/q0KEkKpC6mpVV0MNBXHbFpcbsZvE+RKvyn97S1rRa/jc20XNtKzqNSf7qCo0i6mo 1Y8mXxcHxhgvTfx1kPibSbXhElM0U6M/lBd5oIZ8H8fZZDZcin2YIZDKkJwPqkrhexo0 fW8bj7to4sF7KKbFjVYMYF1qXETuUawT11NkbMVxn5XfZ06OI0MSjjyUPEmwdph9pbv3 y6jrszOyLhV4zoFYPDS/6xgg1GJtZwif4pFLy3uDvgmftOze4frEevw+zUuvsegmZL7u bXA9IXfldZuRKMoTPRGsfr9yLIr6twEiNtCKtzKgH4OIjAbpzL/cdQxsmdKdmW7mfx3f n2XQ== X-Gm-Message-State: AO0yUKVZ6u3E0+USFemi1Z0ytkccgoF9J8fB708WEnrZywpNX24x50Oz /V9yAL9frXAqBvuDSQMPSLWaIk74WZKTH9rzcJ0u4oXD87MITCJ3CdLvPmSaffZH6HXTsfiFfRQ 4o5LbcZdg+sA6 X-Received: by 2002:a50:d58e:0:b0:4a2:7833:e385 with SMTP id v14-20020a50d58e000000b004a27833e385mr13157349edi.22.1675933195529; Thu, 09 Feb 2023 00:59:55 -0800 (PST) X-Google-Smtp-Source: AK7set9+WVh+vR6GShZKImozFIAVnjD9ju42VQoMPMkOo31QPjGRU6LDTZbzxPKSv6AKgI+NwdSCMg== X-Received: by 2002:a50:d58e:0:b0:4a2:7833:e385 with SMTP id v14-20020a50d58e000000b004a27833e385mr13157331edi.22.1675933195294; Thu, 09 Feb 2023 00:59:55 -0800 (PST) Received: from [10.43.2.39] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id w8-20020a50c448000000b0049668426aa6sm464487edf.24.2023.02.09.00.59.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Feb 2023 00:59:54 -0800 (PST) Message-ID: <30ce5926-e7ee-2bdf-33c2-5964032c117e@redhat.com> Date: Thu, 9 Feb 2023 09:59:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [libvirt PATCH] qemu: allow passt to self-daemonize To: Peter Krempa , Laine Stump References: <20230208231310.1728051-1-laine@redhat.com> From: =?UTF-8?B?TWljaGFsIFByw612b3puw61r?= In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-MailFrom: mprivozn@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: MIDAMMYO5BHOFFEHWOYB4HB5I2CG7TQA X-Message-ID-Hash: MIDAMMYO5BHOFFEHWOYB4HB5I2CG7TQA 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 2/9/23 09:36, Peter Krempa wrote: > 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? It does: -e, --stderr Log to stderr too default: log to system logger only if started from a TTY -l, --log-file PATH Log (only) to given file --log-size BYTES Maximum size of log file default: 1 MiB Maybe, we can keep the errfd and let our event loop read from it? But that looks like a stretch, unnecessary - what would we do with the error if it's reported after guest is started, there's no client connected and no API running? The best we could do is to relay the error into our logs. Which is probably as good as '-l' option then. BTW: I don't see us passing --stderr. Is that intentional? Maybe I don't understand the default. Michal