From nobody Mon Feb 9 16:53:53 2026 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=1623141928; cv=none; d=zohomail.com; s=zohoarc; b=COblTF9v+Xw16FRK5CiTbLEiqlRSd6ZMQoEynIeSHo7WprYkKt3z6nIZOUYZ9qRIFzn8KhCGgvMGsC2/hGea9tM6y3Pb/IInC0LDECmciS6dYenxwFg2m4bSiPV92Yp6Wtw9NT/RxU8SmO3zt7CyiOTqAu9Nnv5cc4jgVIU5SjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623141928; 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=RNRwH+H+lhZnwqANM+8MkEZ+88wdGjsIAUP+xo1XTzA=; b=mR/r17kUX2m3yA74yR0IPVUdjbubvHXIeeqZr6hmQzC6W6ipiCghrW3t7E5sI6LitL5ZV5O+huN0ZKESDSnnkxvJJvUz/C1Lpl+sjKkGFur6+xYbqTH2Ko+xua2W4/bYOIosJARYaDpfDnFFVi0CECLuKR9GNQm1H5gbVKflK+U= 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) header.from= 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 1623141928862625.611680439682; Tue, 8 Jun 2021 01:45:28 -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-518-PZxNLYW1NaSuXLbqL_R4RQ-1; Tue, 08 Jun 2021 04:45:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B818F107ACCD; Tue, 8 Jun 2021 08:45:19 +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 936865D9DE; Tue, 8 Jun 2021 08:45:19 +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 2B1311801265; Tue, 8 Jun 2021 08:45:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1588jHIw007048 for ; Tue, 8 Jun 2021 04:45:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id CF1C55D736; Tue, 8 Jun 2021 08:45:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 516B75D75A for ; Tue, 8 Jun 2021 08:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623141925; 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=RNRwH+H+lhZnwqANM+8MkEZ+88wdGjsIAUP+xo1XTzA=; b=Z/wOV2/lIxwY8hvSr9gF0HAeNYeC6KvXKtV8ev+yVc/gYzjbGMZ9vkZ5xYeIl9tepWCLdp enY+22o71AeZaZXAo2pEDaBEUkXBKdhx2U7wyZB/q02S52o97NATKHgxcKmOrsXZf4pY+Y zkJnnZ4rCmMrHUJu6gG8gOy9HFp+NRQ= X-MC-Unique: PZxNLYW1NaSuXLbqL_R4RQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/5] virt-host-validate: Report an error if failed to detect CGroups Date: Tue, 8 Jun 2021 10:45:07 +0200 Message-Id: <2a2114d6ac6118f5276d45b69b3ba5f65c0c0f62.1623141866.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.79 on 10.5.11.14 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" As a part of its checks, virt-host-validate calls virCgroupNew() to detect CGroup controllers which are then printed out. However, virCgroupNew() can fail (with appropriate error message set). Let's print an error onto stderr if that happens. Signed-off-by: Michal Privoznik --- tools/virt-host-validate-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-c= ommon.c index 9412bb7514..c0cee43409 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -290,8 +290,11 @@ int virHostValidateCGroupControllers(const char *hvnam= e, int ret =3D 0; size_t i; =20 - if (virCgroupNew("/", -1, &group) < 0) + if (virCgroupNew("/", -1, &group) < 0) { + fprintf(stderr, "Unable to initialize cgroups: %s\n", + virGetLastErrorMessage()); return VIR_HOST_VALIDATE_FAILURE(level); + } =20 for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { int flag =3D 1 << i; --=20 2.31.1