From nobody Sun Feb 8 18:44:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561645587; cv=none; d=zoho.com; s=zohoarc; b=cpusk41H9Q06b/QaD+uRiaZRS0LGEoP6piYZ0PwofrKbfHKM+YrJYyYFH/7N1GkaODORgJQSLqJWcMInbhFtjRB3h9RA3gTisL9Nn2VcLrDirGWuLmTqsuJpSrbGO/652xJWcpMxIsDbCbK2nAmBUj6CBgmbJS+LqswG57gvfQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561645587; 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:ARC-Authentication-Results; bh=HUMpJpNhpWt2BSteCtAutATOA5l03giB8uJ44lR0VFM=; b=a5NOrzkQC3NdlKGjF1bhgVCC3+rviLd0pRkYxhNthrJsDjrb0vGCI2C9qIIPe1xzaPH4lprwuGFxteP6B4gb3adtBx+Eq8+56IxXuX/frQhI/GhgcqB1qryO6CgSbCdpA1Jlrg/IAY9cfcLgpfqs0ZSMDskafD1nAbZh/dybEOE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561645587039363.8644788171372; Thu, 27 Jun 2019 07:26:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D734F5D60F; Thu, 27 Jun 2019 14:26:11 +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 9964960126; Thu, 27 Jun 2019 14:26:10 +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 2476D1806B18; Thu, 27 Jun 2019 14:26:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5REIoJT007983 for ; Thu, 27 Jun 2019 10:18:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6663360C62; Thu, 27 Jun 2019 14:18:50 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6C3160BE0 for ; Thu, 27 Jun 2019 14:18:49 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 27 Jun 2019 16:18:47 +0200 Message-Id: <168063fea7cb23952f6348df4766fd1e9c03e6ab.1561645070.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] util: vircgroupv2: stop enabling missing controllers with systemd 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Jun 2019 14:26:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Because of a systemd delegation policy [1] we should not write to any cgroups files owned by systemd which in case of cgroups v2 includes 'cgroups.subtree_control'. systemd will enable controllers automatically for us to have them available for VM cgroups. [1] Signed-off-by: Pavel Hrdina --- src/util/vircgroup.c | 2 +- src/util/vircgroupbackend.h | 3 +++ src/util/vircgroupv2.c | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index e4675a0977..268e4013e3 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1082,7 +1082,7 @@ virCgroupEnableMissingControllers(char *path, &tmp) < 0) goto cleanup; =20 - if (virCgroupMakeGroup(parent, tmp, true, VIR_CGROUP_NONE) < 0) { + if (virCgroupMakeGroup(parent, tmp, true, VIR_CGROUP_SYSTEMD) < 0)= { virCgroupFree(&tmp); goto cleanup; } diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h index e58e327c68..a91719f89d 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -34,6 +34,9 @@ typedef enum { * attaching tasks */ VIR_CGROUP_THREAD =3D 1 << 1, /* cgroup v2 handles threads differently= */ + VIR_CGROUP_SYSTEMD =3D 1 << 2, /* with systemd and cgroups v2 we cannot + * manually enable controllers that syste= md + * doesn't know how to delegate */ } virCgroupBackendFlags; =20 typedef enum { diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index b3297dbb13..9d8a38925a 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -395,6 +395,11 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNU= SED, VIR_AUTOFREE(char *) path =3D NULL; int controller; =20 + if (flags & VIR_CGROUP_SYSTEMD) { + VIR_DEBUG("Running with systemd so we should not create cgroups ou= rselves."); + return 0; + } + VIR_DEBUG("Make group %s", group->path); =20 controller =3D virCgroupV2GetAnyController(group); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list