From nobody Mon Feb 9 10:30:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1622812351; cv=none; d=zohomail.com; s=zohoarc; b=Cn62inzKIoGp9A+p0MkiyuX0A6+iwueeoT9Xj0hEGwqYRNA4n1NdhXcyQSYpUwglqk7wVY70fReYfwUZeR/0wN7z1xz5AeyN0n6LZyixJvdXLY61nitttVzhLSTweQnhm0p+jgCpe0jUcY4kkg8gwW7my7rL51HoOVodFYmuqrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622812351; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GyhhHwtmn3xwD53Xcib61wIcPgKqoecDBW77IG59NoE=; b=Hct4yDKDLCXwbmswbSUjIc+q9lFKkrPGMEvEwBV3v1+EZlAPyZLg+w0YkTYzrhkrBpAWD+C14P0tVk9/ouboopo2hMg/w97dD2UlnlR2uOy7IrXyqtuDk2JOMDQsRAj0Xfh2XYIRw+XR9IuEHe9uSuiWHCJuzhFASpOVSdQ70UA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1622812351615668.0661176453937; Fri, 4 Jun 2021 06:12:31 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-189-OOFit8vDNXqnKbI6UauBDg-1; Fri, 04 Jun 2021 09:12:27 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C94E501E5; Fri, 4 Jun 2021 13:12:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65A1E10023AB; Fri, 4 Jun 2021 13:12:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1F8EC1801266; Fri, 4 Jun 2021 13:12:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 154DArAB026546 for ; Fri, 4 Jun 2021 09:10:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8A4B5C26D; Fri, 4 Jun 2021 13:10:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CC645C1C5 for ; Fri, 4 Jun 2021 13:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622812350; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GyhhHwtmn3xwD53Xcib61wIcPgKqoecDBW77IG59NoE=; b=CQV2ywAMOjaDILbp1DitBfD5Ex4HXvTRT4BMvr5D0vPCxl6e4lMJXrdr+MnZesTl3leIMA vrCNPHmFHuT1rbdEut3oDzSB9S267MkJJerNDT8gfy1ug//HEoocbcI+ysjnm8Tp7Hmsxg xaFoTgn1WFhK5R9tNEq2XirQ6arPmmw= X-MC-Unique: OOFit8vDNXqnKbI6UauBDg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/6] ch_driver: Don't error out if CH_CMD was not found Date: Fri, 4 Jun 2021 15:10:43 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The CH driver needs "cloud-hypervisor" binary. And if none was found then the initialization of the driver fails as chStateInitialize() returns VIR_DRV_STATE_INIT_ERROR. This in turn means that whole daemon fails to initialize. Let's return VIR_DRV_STATE_INIT_SKIPPED in this particular case, which disables the CH drvier but lets the daemon run. Signed-off-by: Michal Privoznik --- src/ch/ch_conf.c | 6 +++++- src/ch/ch_driver.c | 15 +++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c index dfebc8525a..b2812de7ad 100644 --- a/src/ch/ch_conf.c +++ b/src/ch/ch_conf.c @@ -199,8 +199,12 @@ chExtractVersion(virCHDriver *driver) char *help =3D NULL; char *tmp =3D NULL; g_autofree char *ch_cmd =3D g_find_program_in_path(CH_CMD); - virCommand *cmd =3D virCommandNewArgList(ch_cmd, "--version", NULL); + virCommand *cmd =3D NULL; =20 + if (!ch_cmd) + return -2; + + cmd =3D virCommandNewArgList(ch_cmd, "--version", NULL); virCommandAddEnvString(cmd, "LC_ALL=3DC"); virCommandSetOutputBuffer(cmd, &help); =20 diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 7d1e97098a..8c458a20bd 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -836,6 +836,9 @@ static int chStateInitialize(bool privileged, virStateInhibitCallback callback G_GNUC_UNUSE= D, void *opaque G_GNUC_UNUSED) { + int ret =3D VIR_DRV_STATE_INIT_ERROR; + int rv; + if (root !=3D NULL) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Driver does not support embedded mode")); @@ -861,14 +864,18 @@ static int chStateInitialize(bool privileged, if (!(ch_driver->config =3D virCHDriverConfigNew(privileged))) goto cleanup; =20 - if (chExtractVersion(ch_driver) < 0) + if ((rv =3D chExtractVersion(ch_driver)) < 0) { + if (rv =3D=3D -2) + ret =3D VIR_DRV_STATE_INIT_SKIPPED; goto cleanup; + } =20 - return VIR_DRV_STATE_INIT_COMPLETE; + ret =3D VIR_DRV_STATE_INIT_COMPLETE; =20 cleanup: - chStateCleanup(); - return VIR_DRV_STATE_INIT_ERROR; + if (ret !=3D VIR_DRV_STATE_INIT_COMPLETE) + chStateCleanup(); + return ret; } =20 /* Function Tables */ --=20 2.31.1