From nobody Fri Sep 20 22:15:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674657935; cv=none; d=zohomail.com; s=zohoarc; b=SVcgCGDhHL148VNRWqe3Yc5R+hfFcgqTYqCw43VctMT/u6c+Yqcf4+uDMGCZ+8BbddRwtUxbmSNv1pQ6GrP2Tj7V4CakZwrcJHgbJBSF7v40S6Wrbu8a71SmsHyGNWdMjsPKjVVHIFJfyjK56NMJVsGa3TldmUgBCCxNho8jrLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674657935; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=IGvwJnprn9eZnaJNkHNpgyaGRSOAiADoLN1JNm59y78=; b=lL2PRDvq7tD9PuR4RHZCgNxxKj+jDw6y5R9LJbpB81qnZzhR+blbSX/VmbC2h5QRzfTNvQztkqln5MShbKvgcjih3MEfC9iAjqWPaNTc3WHWR3ircEn1VVaM3dZYT9dY96ithghd8kVJugx821zjSNpRhxO+LDbg93LmtCg1m/o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674657935398407.70095251490886; Wed, 25 Jan 2023 06:45:35 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-292-pElO97AHNVeuuhVsOeeEog-1; Wed, 25 Jan 2023 09:45:30 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4852280558A; Wed, 25 Jan 2023 14:45:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E044040C200C; Wed, 25 Jan 2023 14:45:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C84BB1946594; Wed, 25 Jan 2023 14:45:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D82B9194658C for ; Wed, 25 Jan 2023 14:27:11 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C7A572166B32; Wed, 25 Jan 2023 14:27:11 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 563CA2166B26; Wed, 25 Jan 2023 14:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674657934; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IGvwJnprn9eZnaJNkHNpgyaGRSOAiADoLN1JNm59y78=; b=VykKtyvaptBVnmeyr61E65XCkxTO7aryZUvqJ+gqqUBBG9jqFWx1XitLczREgtys9mb/XT CdChPwHKjFbBSmBRuSgdOeuXkBp4WB8mBwLVVDxkQIEO7FdiNw6PM+uaEV/XULninxWOU5 kMyZgQnOFNZe6NWrE94EQQ4C8XHLOHw= X-MC-Unique: pElO97AHNVeuuhVsOeeEog-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] rpc: don't try to spawn non-existant daemon Date: Wed, 25 Jan 2023 14:27:09 +0000 Message-Id: <20230125142709.830297-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674657935741100001 If libvirt is built in client only mode, the libvirtd/virtqemud/etc daemons won't exist. If the client is told to connect to a local hypervisor, it'll see the socket doesn't exist, try to spawn the daemon and then re-try connecting to the socket for a few seconds. Ultimately this will fail because the daemon doesn't exist and the user gets an error message error: Failed to connect socket to '/run/user/1000/libvirt/virtqemud-sock= ': No such file or directory technically this is accurate, but it doesn't help identify the root cause. With this change it will now report error: binary 'virtqemud' does not exist in $PATH: No such file or direct= ory and will skip all the socket connect retries Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Martin Kletzander --- src/rpc/virnetsocket.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 8280bda007..bb2e0c5d3d 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -123,9 +123,19 @@ VIR_ONCE_GLOBAL_INIT(virNetSocket); #ifndef WIN32 static int virNetSocketForkDaemon(const char *binary) { - g_autoptr(virCommand) cmd =3D virCommandNewArgList(binary, - "--timeout=3D120", - NULL); + g_autofree char *binarypath =3D virFindFileInPath(binary); + g_autoptr(virCommand) cmd =3D NULL; + + if (!binarypath) { + virReportSystemError(ENOENT, + _("binary '%s' does not exist in $PATH"), + binary); + return -1; + } + + cmd =3D virCommandNewArgList(binarypath, + "--timeout=3D120", + NULL); =20 virCommandAddEnvPassCommon(cmd); virCommandAddEnvPass(cmd, "XDG_CACHE_HOME"); --=20 2.39.0