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 D5CC95A0082 for ; Thu, 16 Feb 2023 14:33:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676554385; 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=K5VMDiuM5wTl90liLT12n2w+qa4f1u66egMwviBYO2g=; b=M5wik9WEmoJEY/4Z16Mknk9zcvaAVfdhiKiPeG4uUSwh+gc3lzx3rPH6eyVzxglufpVPLO YVK3e50ceTBZIhZYPsW5qhRioI4wGA2fExQN5nLAN6us9rkio4oP4LFxyXZdRyM/OWDJeI uapLo9P973ZD4Rh3Qj+FxuxZmBDI3nY= 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-178-kNGKbDZQNNCz9fcNMlxTSQ-1; Thu, 16 Feb 2023 08:32:56 -0500 X-MC-Unique: kNGKbDZQNNCz9fcNMlxTSQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2680E802C18 for ; 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 903E02166B30; Thu, 16 Feb 2023 13:32:55 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 2/5] qemu_passt: Report passt's error on failed start Date: Thu, 16 Feb 2023 14:32:49 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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: LBNCWG2GG6LD4FPE5YPEI6UPTCW5744O X-Message-ID-Hash: LBNCWG2GG6LD4FPE5YPEI6UPTCW5744O X-Mailman-Approved-At: Thu, 16 Feb 2023 18:44:37 +0100 CC: sbrivio@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: When starting passt, it may write something onto its stderr (convincing it to print even more is addressed later). Pass this string we read to user. Since we're not daemonizing passt anymore (see previous commit), we can let virCommand module do all the heavy lifting and switch to virCommandSetErrorBuffer() instead of reading error from an FD. Signed-off-by: Michal Privoznik --- src/qemu/qemu_passt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index adc69fc052..c082c149cd 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -144,18 +144,18 @@ qemuPasstStart(virDomainObj *vm, g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net); g_autoptr(virCommand) cmd = NULL; g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net); + g_autofree char *errbuf = NULL; char macaddr[VIR_MAC_STRING_BUFLEN]; size_t i; pid_t pid = (pid_t) -1; int exitstatus = 0; int cmdret = 0; - VIR_AUTOCLOSE errfd = -1; cmd = virCommandNew(PASST); virCommandClearCaps(cmd); virCommandSetPidFile(cmd, pidfile); - virCommandSetErrorFD(cmd, &errfd); + virCommandSetErrorBuffer(cmd, &errbuf); virCommandAddArgList(cmd, "--one-off", @@ -266,7 +266,7 @@ qemuPasstStart(virDomainObj *vm, if (cmdret < 0 || exitstatus != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not start 'passt'. exitstatus: %d"), exitstatus); + _("Could not start 'passt': %s"), NULLSTR(errbuf)); goto error; } -- 2.39.1