From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537273092700347.42294980342206; Tue, 18 Sep 2018 05:18:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 397F6307C941; Tue, 18 Sep 2018 12:18:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C629450A; Tue, 18 Sep 2018 12:18:09 +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 B67584BB75; Tue, 18 Sep 2018 12:18:07 +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 w8ICI5LH015724 for ; Tue, 18 Sep 2018 08:18:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id E1E15176A7; Tue, 18 Sep 2018 12:18:05 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6534F176A2 for ; Tue, 18 Sep 2018 12:18:05 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:17:53 +0200 Message-Id: <49a99a58238aa2b3d4f8a449fb221046336a0a98.1537273033.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/9] vircgroup: cleanup controllers not managed by systemd on error 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 18 Sep 2018 12:18:11 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If virCgroupEnableMissingControllers() fails it could already create some directories, we should clean it up as well. Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio --- src/util/vircgroup.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 64507bf8aa..6aa30a82be 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1555,6 +1555,7 @@ virCgroupNewMachineSystemd(const char *name, int rv; virCgroupPtr init; VIR_AUTOFREE(char *) path =3D NULL; + virErrorPtr saved =3D NULL; =20 VIR_DEBUG("Trying to setup machine '%s' via systemd", name); if ((rv =3D virSystemdCreateMachine(name, @@ -1588,20 +1589,24 @@ virCgroupNewMachineSystemd(const char *name, =20 if (virCgroupEnableMissingControllers(path, pidleader, controllers, group) < 0) { - return -1; + goto error; } =20 - if (virCgroupAddTask(*group, pidleader) < 0) { - virErrorPtr saved =3D virSaveLastError(); - virCgroupRemove(*group); - virCgroupFree(group); - if (saved) { - virSetError(saved); - virFreeError(saved); - } - } + if (virCgroupAddTask(*group, pidleader) < 0) + goto error; =20 return 0; + + error: + saved =3D virSaveLastError(); + virCgroupRemove(*group); + virCgroupFree(group); + if (saved) { + virSetError(saved); + virFreeError(saved); + } + + return -1; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537273093253267.8254970076192; Tue, 18 Sep 2018 05:18:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D554E30832F2; Tue, 18 Sep 2018 12:18:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3559616E26; Tue, 18 Sep 2018 12:18:09 +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 0480A4BB7F; Tue, 18 Sep 2018 12:18:07 +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 w8ICI67B015734 for ; Tue, 18 Sep 2018 08:18:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id B6C8C176AC; Tue, 18 Sep 2018 12:18:06 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B626176A7 for ; Tue, 18 Sep 2018 12:18:06 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:17:54 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/9] vircgroup: fix bug in virCgroupEnableMissingControllers 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 18 Sep 2018 12:18:12 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If we are on host with systemd we need to build cgroup hierarchy ourselves for controllers that are not managed by systemd. As a starting parent we need need to force root group because virCgroupMakeGroup() takes that parent in order to inherit values for cpuset controller. By default cpuset controller is managed by systemd so we will never hit the issue but for v2 cgroups we need to use parent cgroup every time. Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio --- src/util/vircgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 6aa30a82be..2328957818 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1495,7 +1495,7 @@ virCgroupEnableMissingControllers(char *path, int ret =3D -1; =20 if (virCgroupNew(pidleader, - "", + "/", NULL, controllers, &parent) < 0) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537273108027430.52645295853006; Tue, 18 Sep 2018 05:18:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C810EC05D3E4; Tue, 18 Sep 2018 12:18:25 +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 90C7B2010D05; Tue, 18 Sep 2018 12:18:25 +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 41029181A130; Tue, 18 Sep 2018 12:18:25 +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 w8ICI7Np015739 for ; Tue, 18 Sep 2018 08:18:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DA5A176AD; Tue, 18 Sep 2018 12:18:07 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 116EE176AC for ; Tue, 18 Sep 2018 12:18:06 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:17:55 +0200 Message-Id: <3e0932c6b17c16d7cdfff46ffa9bb79d53985d6c.1537273033.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/9] vircgroup: rename virCgroupAdd.*Task to virCgroupAdd.*Process 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 18 Sep 2018 12:18:26 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In cgroup v2 we need to handle processes and threads differently, following patch will introduce virCgroupAddThread. Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio --- src/libvirt-lxc.c | 2 +- src/libvirt_private.syms | 4 ++-- src/lxc/lxc_controller.c | 4 ++-- src/qemu/qemu_process.c | 4 ++-- src/qemu/qemu_tpm.c | 2 +- src/util/vircgroup.c | 32 ++++++++++++++++---------------- src/util/vircgroup.h | 4 ++-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c index c9f2146487..9bf0174b95 100644 --- a/src/libvirt-lxc.c +++ b/src/libvirt-lxc.c @@ -306,7 +306,7 @@ int virDomainLxcEnterCGroup(virDomainPtr domain, if (virCgroupNewDetect(domain->id, -1, &cgroup) < 0) goto error; =20 - if (virCgroupAddTask(cgroup, getpid()) < 0) + if (virCgroupAddProcess(cgroup, getpid()) < 0) goto error; =20 virCgroupFree(&cgroup); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b9dabfef1b..eac66b0174 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1498,8 +1498,8 @@ virBufferVasprintf; =20 =20 # util/vircgroup.h -virCgroupAddMachineTask; -virCgroupAddTask; +virCgroupAddMachineProcess; +virCgroupAddProcess; virCgroupAllowAllDevices; virCgroupAllowDevice; virCgroupAllowDevicePath; diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 4e84391bf5..4ead2dc9f0 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -875,12 +875,12 @@ static int virLXCControllerSetupCgroupLimits(virLXCCo= ntrollerPtr ctrl) ctrl->nicindexes))) goto cleanup; =20 - if (virCgroupAddMachineTask(ctrl->cgroup, getpid()) < 0) + if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0) goto cleanup; =20 /* Add all qemu-nbd tasks to the cgroup */ for (i =3D 0; i < ctrl->nnbdpids; i++) { - if (virCgroupAddMachineTask(ctrl->cgroup, ctrl->nbdpids[i]) < 0) + if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->nbdpids[i]) < 0) goto cleanup; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 72a59dec55..249dac39f2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2549,7 +2549,7 @@ qemuProcessSetupPid(virDomainObjPtr vm, goto cleanup; =20 /* Move the thread to the sub dir */ - if (virCgroupAddTask(cgroup, pid) < 0) + if (virCgroupAddProcess(cgroup, pid) < 0) goto cleanup; =20 } @@ -2787,7 +2787,7 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm) } =20 if (priv->cgroup && - virCgroupAddMachineTask(priv->cgroup, cpid) < 0) + virCgroupAddMachineProcess(priv->cgroup, cpid) < 0) goto cleanup; =20 if (qemuSecurityDomainSetPathLabel(driver, vm, socketPath, true) < 0) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 278b262c48..c64114feac 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -905,7 +905,7 @@ qemuExtTPMSetupCgroup(virQEMUDriverPtr driver, _("Could not get process id of swtpm")); goto cleanup; } - if (virCgroupAddTask(cgroup, pid) < 0) + if (virCgroupAddProcess(cgroup, pid) < 0) goto cleanup; break; case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 2328957818..cf510fb019 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1183,35 +1183,35 @@ virCgroupAddTaskInternal(virCgroupPtr group, pid_t = pid, bool withSystemd) } =20 /** - * virCgroupAddTask: + * virCgroupAddProcess: * - * @group: The cgroup to add a task to - * @pid: The pid of the task to add + * @group: The cgroup to add a process to + * @pid: The pid of the process to add * - * Will add the task to all controllers, except the + * Will add the process to all controllers, except the * systemd unit controller. * * Returns: 0 on success, -1 on error */ int -virCgroupAddTask(virCgroupPtr group, pid_t pid) +virCgroupAddProcess(virCgroupPtr group, pid_t pid) { return virCgroupAddTaskInternal(group, pid, false); } =20 /** - * virCgroupAddMachineTask: + * virCgroupAddMachineProcess: * - * @group: The cgroup to add a task to - * @pid: The pid of the task to add + * @group: The cgroup to add a process to + * @pid: The pid of the process to add * - * Will add the task to all controllers, including the + * Will add the process to all controllers, including the * systemd unit controller. * * Returns: 0 on success, -1 on error */ int -virCgroupAddMachineTask(virCgroupPtr group, pid_t pid) +virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid) { return virCgroupAddTaskInternal(group, pid, true); } @@ -1592,7 +1592,7 @@ virCgroupNewMachineSystemd(const char *name, goto error; } =20 - if (virCgroupAddTask(*group, pidleader) < 0) + if (virCgroupAddProcess(*group, pidleader) < 0) goto error; =20 return 0; @@ -1648,7 +1648,7 @@ virCgroupNewMachineManual(const char *name, group) < 0) goto cleanup; =20 - if (virCgroupAddTask(*group, pidleader) < 0) { + if (virCgroupAddProcess(*group, pidleader) < 0) { virErrorPtr saved =3D virSaveLastError(); virCgroupRemove(*group); virCgroupFree(group); @@ -4198,8 +4198,8 @@ virCgroupPathOfController(virCgroupPtr group ATTRIBUT= E_UNUSED, =20 =20 int -virCgroupAddTask(virCgroupPtr group ATTRIBUTE_UNUSED, - pid_t pid ATTRIBUTE_UNUSED) +virCgroupAddProcess(virCgroupPtr group ATTRIBUTE_UNUSED, + pid_t pid ATTRIBUTE_UNUSED) { virReportSystemError(ENXIO, "%s", _("Control groups not supported on this platform"= )); @@ -4208,8 +4208,8 @@ virCgroupAddTask(virCgroupPtr group ATTRIBUTE_UNUSED, =20 =20 int -virCgroupAddMachineTask(virCgroupPtr group ATTRIBUTE_UNUSED, - pid_t pid ATTRIBUTE_UNUSED) +virCgroupAddMachineProcess(virCgroupPtr group ATTRIBUTE_UNUSED, + pid_t pid ATTRIBUTE_UNUSED) { virReportSystemError(ENXIO, "%s", _("Control groups not supported on this platform"= )); diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index ee3b7c7222..bbd4c2ed57 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -118,8 +118,8 @@ int virCgroupPathOfController(virCgroupPtr group, const char *key, char **path); =20 -int virCgroupAddTask(virCgroupPtr group, pid_t pid); -int virCgroupAddMachineTask(virCgroupPtr group, pid_t pid); +int virCgroupAddProcess(virCgroupPtr group, pid_t pid); +int virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid); =20 int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight); int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537273113706919.8865892107739; Tue, 18 Sep 2018 05:18:33 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 4CFFF30014B5; Tue, 18 Sep 2018 12:18:30 +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 1869A4F9A1; Tue, 18 Sep 2018 12:18:30 +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 AF777181A13A; Tue, 18 Sep 2018 12:18:29 +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 w8ICI8kN015752 for ; Tue, 18 Sep 2018 08:18:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 63684176AD; Tue, 18 Sep 2018 12:18:08 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC720176AC for ; Tue, 18 Sep 2018 12:18:07 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:17:56 +0200 Message-Id: <36db1a7b683a5b449a8d2f233b7aa0d725e0270f.1537273033.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/9] vircgroup: introduce virCgroupTaskFlags 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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 18 Sep 2018 12:18:32 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use flags in virCgroupAddTaskInternal instead of boolean parameter. Following patch will ad new flag to indicate thread instead of process. Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio --- src/util/vircgroup.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index cf510fb019..1d361762c5 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1156,8 +1156,16 @@ virCgroupNew(pid_t pid, } =20 =20 +typedef enum { + VIR_CGROUP_TASK_PROCESS =3D 0, + VIR_CGROUP_TASK_SYSTEMD =3D 1 << 0, +} virCgroupTaskFlags; + + static int -virCgroupAddTaskInternal(virCgroupPtr group, pid_t pid, bool withSystemd) +virCgroupAddTaskInternal(virCgroupPtr group, + pid_t pid, + unsigned int flags) { int ret =3D -1; size_t i; @@ -1170,7 +1178,8 @@ virCgroupAddTaskInternal(virCgroupPtr group, pid_t pi= d, bool withSystemd) /* We must never add tasks in systemd's hierarchy * unless we're intentionally trying to move a * task into a systemd machine scope */ - if (i =3D=3D VIR_CGROUP_CONTROLLER_SYSTEMD && !withSystemd) + if (i =3D=3D VIR_CGROUP_CONTROLLER_SYSTEMD && + !(flags & VIR_CGROUP_TASK_SYSTEMD)) continue; =20 if (virCgroupSetValueI64(group, i, "tasks", pid) < 0) @@ -1196,7 +1205,7 @@ virCgroupAddTaskInternal(virCgroupPtr group, pid_t pi= d, bool withSystemd) int virCgroupAddProcess(virCgroupPtr group, pid_t pid) { - return virCgroupAddTaskInternal(group, pid, false); + return virCgroupAddTaskInternal(group, pid, VIR_CGROUP_TASK_PROCESS); } =20 /** @@ -1213,7 +1222,9 @@ virCgroupAddProcess(virCgroupPtr group, pid_t pid) int virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid) { - return virCgroupAddTaskInternal(group, pid, true); + return virCgroupAddTaskInternal(group, pid, + VIR_CGROUP_TASK_PROCESS | + VIR_CGROUP_TASK_SYSTEMD); } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537273119433746.0525502023328; Tue, 18 Sep 2018 05:18:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D2C9C80F8F; Tue, 18 Sep 2018 12:18:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 992B27FCA0; Tue, 18 Sep 2018 12:18:34 +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 4871A4A46D; Tue, 18 Sep 2018 12:18:34 +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 w8ICI9aG015759 for ; Tue, 18 Sep 2018 08:18:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3AA09176B3; Tue, 18 Sep 2018 12:18:09 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id B383B176AC for ; Tue, 18 Sep 2018 12:18:08 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:17:57 +0200 Message-Id: <234fa3c907259b0b02a6b9b6c7fbb2f869102002.1537273033.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/9] vircgroup: introduce virCgroupAddThread 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 18 Sep 2018 12:18:38 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Once we introduce cgroup v2 support we need to handle processes and threads differently. Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio --- src/libvirt_private.syms | 1 + src/qemu/qemu_process.c | 2 +- src/util/vircgroup.c | 29 +++++++++++++++++++++++++++++ src/util/vircgroup.h | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index eac66b0174..ad7ce57b65 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1500,6 +1500,7 @@ virBufferVasprintf; # util/vircgroup.h virCgroupAddMachineProcess; virCgroupAddProcess; +virCgroupAddThread; virCgroupAllowAllDevices; virCgroupAllowDevice; virCgroupAllowDevicePath; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 249dac39f2..00dcd5b580 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2549,7 +2549,7 @@ qemuProcessSetupPid(virDomainObjPtr vm, goto cleanup; =20 /* Move the thread to the sub dir */ - if (virCgroupAddProcess(cgroup, pid) < 0) + if (virCgroupAddThread(cgroup, pid) < 0) goto cleanup; =20 } diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 1d361762c5..3211f63cb1 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1159,6 +1159,7 @@ virCgroupNew(pid_t pid, typedef enum { VIR_CGROUP_TASK_PROCESS =3D 0, VIR_CGROUP_TASK_SYSTEMD =3D 1 << 0, + VIR_CGROUP_TASK_THREAD =3D 1 << 1, } virCgroupTaskFlags; =20 =20 @@ -1227,6 +1228,24 @@ virCgroupAddMachineProcess(virCgroupPtr group, pid_t= pid) VIR_CGROUP_TASK_SYSTEMD); } =20 +/** + * virCgroupAddThread: + * + * @group: The cgroup to add a thread to + * @pid: The pid of the thread to add + * + * Will add the thread to all controllers, except the + * systemd unit controller. + * + * Returns: 0 on success, -1 on error + */ +int +virCgroupAddThread(virCgroupPtr group, + pid_t pid) +{ + return virCgroupAddTaskInternal(group, pid, VIR_CGROUP_TASK_THREAD); +} + =20 static int virCgroupSetPartitionSuffix(const char *path, char **res) @@ -4228,6 +4247,16 @@ virCgroupAddMachineProcess(virCgroupPtr group ATTRIB= UTE_UNUSED, } =20 =20 +int +virCgroupAddThread(virCgroupPtr group ATTRIBUTE_UNUSED, + pid_t pid ATTRIBUTE_UNUSED) +{ + virReportSystemError(ENXIO, "%s", + _("Control groups not supported on this platform"= )); + return -1; +} + + int virCgroupGetBlkioIoServiced(virCgroupPtr group ATTRIBUTE_UNUSED, long long *bytes_read ATTRIBUTE_UNUSED, diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index bbd4c2ed57..1f676f21c3 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -120,6 +120,7 @@ int virCgroupPathOfController(virCgroupPtr group, =20 int virCgroupAddProcess(virCgroupPtr group, pid_t pid); int virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid); +int virCgroupAddThread(virCgroupPtr group, pid_t pid); =20 int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight); int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153727312289127.828320360253542; Tue, 18 Sep 2018 05:18:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A231A0919; Tue, 18 Sep 2018 12:18:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F340A20159BE; Tue, 18 Sep 2018 12:18:39 +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 9E0C24A471; Tue, 18 Sep 2018 12:18:39 +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 w8ICIA9l015764 for ; Tue, 18 Sep 2018 08:18:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 130A2176A2; Tue, 18 Sep 2018 12:18:10 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A1963796 for ; Tue, 18 Sep 2018 12:18:09 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:17:58 +0200 Message-Id: <9a524e608a418dfb0c6a30934197437be910d6c6.1537273033.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/9] vircgroupmock: cleanup unused cgroup files 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 18 Sep 2018 12:18:41 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio --- tests/vircgroupmock.c | 73 ------------------------------------------- 1 file changed, 73 deletions(-) diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index 51861be38e..e0024b2c63 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -214,13 +214,7 @@ static int make_controller(const char *path, mode_t mo= de) if (STRPREFIX(controller, "cpu,cpuacct")) { MAKE_FILE("cpu.cfs_period_us", "100000\n"); MAKE_FILE("cpu.cfs_quota_us", "-1\n"); - MAKE_FILE("cpu.rt_period_us", "1000000\n"); - MAKE_FILE("cpu.rt_runtime_us", "950000\n"); MAKE_FILE("cpu.shares", "1024\n"); - MAKE_FILE("cpu.stat", - "nr_periods 0\n" - "nr_throttled 0\n" - "throttled_time 0\n"); MAKE_FILE("cpuacct.stat", "user 216687025\n" "system 43421396\n"); @@ -235,46 +229,19 @@ static int make_controller(const char *path, mode_t m= ode) "709566900 0 0 0 0 0 0 0 444777342 0 0 0 0 0 0 0 " "5683512916 0 0 0 0 0 0 0 635751356 0 0 0 0 0 0 0\n"); } else if (STRPREFIX(controller, "cpuset")) { - MAKE_FILE("cpuset.cpu_exclusive", "1\n"); if (STREQ(controller, "cpuset")) MAKE_FILE("cpuset.cpus", "0-1"); else MAKE_FILE("cpuset.cpus", ""); /* Values don't inherit */ - MAKE_FILE("cpuset.mem_exclusive", "1\n"); - MAKE_FILE("cpuset.mem_hardwall", "0\n"); MAKE_FILE("cpuset.memory_migrate", "0\n"); - MAKE_FILE("cpuset.memory_pressure", "0\n"); - MAKE_FILE("cpuset.memory_pressure_enabled", "0\n"); - MAKE_FILE("cpuset.memory_spread_page", "0\n"); - MAKE_FILE("cpuset.memory_spread_slab", "0\n"); if (STREQ(controller, "cpuset")) MAKE_FILE("cpuset.mems", "0"); else MAKE_FILE("cpuset.mems", ""); /* Values don't inherit */ - MAKE_FILE("cpuset.sched_load_balance", "1\n"); - MAKE_FILE("cpuset.sched_relax_domain_level", "-1\n"); } else if (STRPREFIX(controller, "memory")) { - MAKE_FILE("memory.failcnt", "0\n"); - MAKE_FILE("memory.force_empty", ""); /* Write only */ - MAKE_FILE("memory.kmem.tcp.failcnt", "0\n"); - MAKE_FILE("memory.kmem.tcp.limit_in_bytes", "9223372036854775807\n= "); - MAKE_FILE("memory.kmem.tcp.max_usage_in_bytes", "0\n"); - MAKE_FILE("memory.kmem.tcp.usage_in_bytes", "16384\n"); MAKE_FILE("memory.limit_in_bytes", "9223372036854775807\n"); - MAKE_FILE("memory.max_usage_in_bytes", "0\n"); - MAKE_FILE("memory.memsw.failcnt", ""); /* Not supported */ MAKE_FILE("memory.memsw.limit_in_bytes", ""); /* Not supported */ - MAKE_FILE("memory.memsw.max_usage_in_bytes", ""); /* Not supported= */ MAKE_FILE("memory.memsw.usage_in_bytes", ""); /* Not supported */ - MAKE_FILE("memory.move_charge_at_immigrate", "0\n"); - MAKE_FILE("memory.numa_stat", - "total=3D367664 N0=3D367664\n" - "file=3D314764 N0=3D314764\n" - "anon=3D51999 N0=3D51999\n" - "unevictable=3D901 N0=3D901\n"); - MAKE_FILE("memory.oom_control", - "oom_kill_disable 0\n" - "under_oom 0\n"); MAKE_FILE("memory.soft_limit_in_bytes", "9223372036854775807\n"); MAKE_FILE("memory.stat", "cache 1336619008\n" @@ -306,50 +273,11 @@ static int make_controller(const char *path, mode_t m= ode) "recent_rotated_file 2547948\n" "recent_scanned_anon 113796164\n" "recent_scanned_file 8199863\n"); - MAKE_FILE("memory.swappiness", "60\n"); MAKE_FILE("memory.usage_in_bytes", "1455321088\n"); MAKE_FILE("memory.use_hierarchy", "0\n"); } else if (STRPREFIX(controller, "freezer")) { MAKE_FILE("freezer.state", "THAWED"); } else if (STRPREFIX(controller, "blkio")) { - MAKE_FILE("blkio.io_merged", - "8:0 Read 1100949\n" - "8:0 Write 2248076\n" - "8:0 Sync 63063\n" - "8:0 Async 3285962\n" - "8:0 Total 3349025\n"); - MAKE_FILE("blkio.io_queued", - "8:0 Read 0\n" - "8:0 Write 0\n" - "8:0 Sync 0\n" - "8:0 Async 0\n" - "8:0 Total 0\n"); - MAKE_FILE("blkio.io_service_bytes", - "8:0 Read 59542078464\n" - "8:0 Write 397369182208\n" - "8:0 Sync 234080922624\n" - "8:0 Async 222830338048\n" - "8:0 Total 456911260672\n"); - MAKE_FILE("blkio.io_serviced", - "8:0 Read 3402504\n" - "8:0 Write 14966516\n" - "8:0 Sync 12064031\n" - "8:0 Async 6304989\n" - "8:0 Total 18369020\n"); - MAKE_FILE("blkio.io_service_time", - "8:0 Read 10747537542349\n" - "8:0 Write 9200028590575\n" - "8:0 Sync 6449319855381\n" - "8:0 Async 13498246277543\n" - "8:0 Total 19947566132924\n"); - MAKE_FILE("blkio.io_wait_time", - "8:0 Read 14687514824889\n" - "8:0 Write 357748452187691\n" - "8:0 Sync 55296974349413\n" - "8:0 Async 317138992663167\n" - "8:0 Total 372435967012580\n"); - MAKE_FILE("blkio.reset_stats", ""); /* Write only */ - MAKE_FILE("blkio.sectors", "8:0 892404806\n"); MAKE_FILE("blkio.throttle.io_service_bytes", "8:0 Read 59542107136\n" "8:0 Write 411440480256\n" @@ -376,7 +304,6 @@ static int make_controller(const char *path, mode_t mod= e) MAKE_FILE("blkio.throttle.read_iops_device", ""); MAKE_FILE("blkio.throttle.write_bps_device", ""); MAKE_FILE("blkio.throttle.write_iops_device", ""); - MAKE_FILE("blkio.time", "8:0 61019089\n"); MAKE_FILE("blkio.weight", "1000\n"); MAKE_FILE("blkio.weight_device", ""); =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153727312737890.04488666900863; Tue, 18 Sep 2018 05:18:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6652C285B4; Tue, 18 Sep 2018 12:18:45 +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 1E9D878DEE; Tue, 18 Sep 2018 12:18:45 +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 BC163181A130; Tue, 18 Sep 2018 12:18:44 +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 w8ICIBpD015777 for ; Tue, 18 Sep 2018 08:18:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 130FA176B9; Tue, 18 Sep 2018 12:18:11 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60C4A176A2 for ; Tue, 18 Sep 2018 12:18:10 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:17:59 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/9] vircgroupmock: rewrite cgroup fopen mocking 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 18 Sep 2018 12:18:46 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move all the cgroup data into separate files out of vircgroupmock.c and rework the fopen function to load data from files. This will make it easier to add more test cases. Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio --- tests/vircgroupdata/all-in-one.cgroups | 7 ++ tests/vircgroupdata/all-in-one.mounts | 2 +- tests/vircgroupdata/all-in-one.parsed | 12 +- tests/vircgroupdata/all-in-one.self.cgroup | 1 + tests/vircgroupdata/logind.cgroups | 10 ++ tests/vircgroupdata/logind.mounts | 2 + tests/vircgroupdata/logind.self.cgroup | 1 + tests/vircgroupdata/systemd.cgroups | 8 ++ tests/vircgroupdata/systemd.mounts | 11 ++ tests/vircgroupdata/systemd.self.cgroup | 6 + tests/vircgroupmock.c | 133 ++++----------------- tests/vircgrouptest.c | 10 +- 12 files changed, 79 insertions(+), 124 deletions(-) create mode 100644 tests/vircgroupdata/all-in-one.cgroups create mode 100644 tests/vircgroupdata/all-in-one.self.cgroup create mode 100644 tests/vircgroupdata/logind.cgroups create mode 100644 tests/vircgroupdata/logind.mounts create mode 100644 tests/vircgroupdata/logind.self.cgroup create mode 100644 tests/vircgroupdata/systemd.cgroups create mode 100644 tests/vircgroupdata/systemd.mounts create mode 100644 tests/vircgroupdata/systemd.self.cgroup diff --git a/tests/vircgroupdata/all-in-one.cgroups b/tests/vircgroupdata/a= ll-in-one.cgroups new file mode 100644 index 0000000000..7208e5a0b6 --- /dev/null +++ b/tests/vircgroupdata/all-in-one.cgroups @@ -0,0 +1,7 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 6 1 1 +cpu 6 1 1 +cpuacct 6 1 1 +memory 6 1 1 +devices 6 1 1 +blkio 6 1 1 diff --git a/tests/vircgroupdata/all-in-one.mounts b/tests/vircgroupdata/al= l-in-one.mounts index 14093b961c..76c579ff69 100644 --- a/tests/vircgroupdata/all-in-one.mounts +++ b/tests/vircgroupdata/all-in-one.mounts @@ -4,4 +4,4 @@ proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 udev /dev devtmpfs rw,relatime,size=3D16458560k,nr_inodes=3D4114640,mode= =3D755 0 0 devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=3D5,mode=3D620,ptmxmo= de=3D000 0 0 nfsd /proc/fs/nfsd nfsd rw,relatime 0 0 -cgroup /sys/fs/cgroup cgroup rw,relatime,blkio,devices,memory,cpuacct,cpu,= cpuset 0 0 +cgroup /not/really/sys/fs/cgroup cgroup rw,relatime,blkio,devices,memory,c= puacct,cpu,cpuset 0 0 diff --git a/tests/vircgroupdata/all-in-one.parsed b/tests/vircgroupdata/al= l-in-one.parsed index 2701778fea..d703d08fb9 100644 --- a/tests/vircgroupdata/all-in-one.parsed +++ b/tests/vircgroupdata/all-in-one.parsed @@ -1,10 +1,10 @@ -cpu /sys/fs/cgroup -cpuacct /sys/fs/cgroup -cpuset /sys/fs/cgroup -memory /sys/fs/cgroup -devices /sys/fs/cgroup +cpu /not/really/sys/fs/cgroup +cpuacct /not/really/sys/fs/cgroup +cpuset /not/really/sys/fs/cgroup +memory /not/really/sys/fs/cgroup +devices /not/really/sys/fs/cgroup freezer -blkio /sys/fs/cgroup +blkio /not/really/sys/fs/cgroup net_cls perf_event name=3Dsystemd diff --git a/tests/vircgroupdata/all-in-one.self.cgroup b/tests/vircgroupda= ta/all-in-one.self.cgroup new file mode 100644 index 0000000000..cf237502e9 --- /dev/null +++ b/tests/vircgroupdata/all-in-one.self.cgroup @@ -0,0 +1 @@ +6:blkio,devices,memory,cpuacct,cpu,cpuset:/ diff --git a/tests/vircgroupdata/logind.cgroups b/tests/vircgroupdata/login= d.cgroups new file mode 100644 index 0000000000..9d46f130e0 --- /dev/null +++ b/tests/vircgroupdata/logind.cgroups @@ -0,0 +1,10 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 0 1 1 +cpu 0 1 1 +cpuacct 0 1 1 +memory 0 1 0 +devices 0 1 1 +freezer 0 1 1 +net_cls 0 1 1 +blkio 0 1 1 +perf_event 0 1 1 diff --git a/tests/vircgroupdata/logind.mounts b/tests/vircgroupdata/logind= .mounts new file mode 100644 index 0000000000..3ab908aee9 --- /dev/null +++ b/tests/vircgroupdata/logind.mounts @@ -0,0 +1,2 @@ +none /not/really/sys/fs/cgroup tmpfs rw,rootcontext=3Dsystem_u:object_r:sy= sfs_t:s0,seclabel,relatime,size=3D4k,mode=3D755 0 0 +systemd /not/really/sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,re= latime,name=3Dsystemd 0 0 diff --git a/tests/vircgroupdata/logind.self.cgroup b/tests/vircgroupdata/l= ogind.self.cgroup new file mode 100644 index 0000000000..31e0cfe8eb --- /dev/null +++ b/tests/vircgroupdata/logind.self.cgroup @@ -0,0 +1 @@ +0:name=3Dsystemd:/ diff --git a/tests/vircgroupdata/systemd.cgroups b/tests/vircgroupdata/syst= emd.cgroups new file mode 100644 index 0000000000..d32dfab222 --- /dev/null +++ b/tests/vircgroupdata/systemd.cgroups @@ -0,0 +1,8 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 2 4 1 +cpu 3 48 1 +cpuacct 3 48 1 +memory 4 4 1 +devices 5 4 1 +freezer 6 4 1 +blkio 8 4 1 diff --git a/tests/vircgroupdata/systemd.mounts b/tests/vircgroupdata/syste= md.mounts new file mode 100644 index 0000000000..75572c86f7 --- /dev/null +++ b/tests/vircgroupdata/systemd.mounts @@ -0,0 +1,11 @@ +rootfs / rootfs rw 0 0 +tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=3D755 0 0 +tmpfs /not/really/sys/fs/cgroup tmpfs rw,seclabel,nosuid,nodev,noexec,mode= =3D755 0 0 +cgroup /not/really/sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,rel= atime,release_agent=3D/usr/lib/systemd/systemd-cgroups-agent,name=3Dsystemd= 0 0 +cgroup /not/really/sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,rela= time,cpuset 0 0 +cgroup /not/really/sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec= ,relatime,cpuacct,cpu 0 0 +cgroup /not/really/sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,rel= atime,freezer 0 0 +cgroup /not/really/sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relat= ime,blkio 0 0 +cgroup /not/really/sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,rela= time,memory 0 0 +/dev/sda1 /boot ext4 rw,seclabel,relatime,data=3Dordered 0 0 +tmpfs /tmp tmpfs rw,seclabel,relatime,size=3D1024000k 0 0 diff --git a/tests/vircgroupdata/systemd.self.cgroup b/tests/vircgroupdata/= systemd.self.cgroup new file mode 100644 index 0000000000..2b95af79d2 --- /dev/null +++ b/tests/vircgroupdata/systemd.self.cgroup @@ -0,0 +1,6 @@ +115:memory:/ +8:blkio:/ +6:freezer:/ +3:cpuacct,cpu:/system +2:cpuset:/ +1:name=3Dsystemd:/user/berrange/123 diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index e0024b2c63..3afe2fe192 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -81,85 +81,6 @@ const char *fakedevicedir1 =3D FAKEDEVDIR1; * of files beneath it */ =20 -/* - * Intentionally missing the 'devices' mount. - * Co-mounting cpu & cpuacct controllers - * An anonymous controller for systemd - */ -const char *procmounts =3D - "rootfs / rootfs rw 0 0\n" - "tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=3D755 0 0\n" - "tmpfs /not/really/sys/fs/cgroup tmpfs rw,seclabel,nosuid,nodev,noexec= ,mode=3D755 0 0\n" - "cgroup /not/really/sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexe= c,relatime,release_agent=3D/usr/lib/systemd/systemd-cgroups-agent,name=3Dsy= stemd 0 0\n" - "cgroup /not/really/sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec= ,relatime,cpuset 0 0\n" - "cgroup /not/really/sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,n= oexec,relatime,cpuacct,cpu 0 0\n" - "cgroup /not/really/sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexe= c,relatime,freezer 0 0\n" - "cgroup /not/really/sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,= relatime,blkio 0 0\n" - "cgroup /not/really/sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec= ,relatime,memory 0 0\n" - "/dev/sda1 /boot ext4 rw,seclabel,relatime,data=3Dordered 0 0\n" - "tmpfs /tmp tmpfs rw,seclabel,relatime,size=3D1024000k 0 0\n"; - -const char *procselfcgroups =3D - "115:memory:/\n" - "8:blkio:/\n" - "6:freezer:/\n" - "3:cpuacct,cpu:/system\n" - "2:cpuset:/\n" - "1:name=3Dsystemd:/user/berrange/123\n"; - -const char *proccgroups =3D - "#subsys_name hierarchy num_cgroups enabled\n" - "cpuset 2 4 1\n" - "cpu 3 48 1\n" - "cpuacct 3 48 1\n" - "memory 4 4 1\n" - "devices 5 4 1\n" - "freezer 6 4 1\n" - "blkio 8 4 1\n"; - - -const char *procmountsallinone =3D - "rootfs / rootfs rw 0 0\n" - "sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0\n" - "proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0\n" - "udev /dev devtmpfs rw,relatime,size=3D16458560k,nr_inodes=3D4114640,m= ode=3D755 0 0\n" - "devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=3D5,mode=3D620,p= tmxmode=3D000 0 0\n" - "nfsd /proc/fs/nfsd nfsd rw,relatime 0 0\n" - "cgroup /not/really/sys/fs/cgroup cgroup rw,relatime,blkio,devices,mem= ory,cpuacct,cpu,cpuset 0 0\n"; - -const char *procselfcgroupsallinone =3D - "6:blkio,devices,memory,cpuacct,cpu,cpuset:/"; - -const char *proccgroupsallinone =3D - "#subsys_name hierarchy num_cgroups enabled\n" - "cpuset 6 1 1\n" - "cpu 6 1 1\n" - "cpuacct 6 1 1\n" - "memory 6 1 1\n" - "devices 6 1 1\n" - "blkio 6 1 1\n"; - -const char *procmountslogind =3D - "none /not/really/sys/fs/cgroup tmpfs rw,rootcontext=3Dsystem_u:object= _r:sysfs_t:s0,seclabel,relatime,size=3D4k,mode=3D755 0 0\n" - "systemd /not/really/sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noex= ec,relatime,name=3Dsystemd 0 0\n"; - -const char *procselfcgroupslogind =3D - "1:name=3Dsystemd:/\n"; - -const char *proccgroupslogind =3D - "#subsys_name hierarchy num_cgroups enabled\n" - "cpuset 0 1 1\n" - "cpu 0 1 1\n" - "cpuacct 0 1 1\n" - "memory 0 1 0\n" - "devices 0 1 1\n" - "freezer 0 1 1\n" - "net_cls 0 1 1\n" - "blkio 0 1 1\n" - "perf_event 0 1 1\n"; - - - static int make_file(const char *path, const char *name, const char *value) @@ -379,28 +300,16 @@ static void init_sysfs(void) =20 FILE *fopen(const char *path, const char *mode) { - const char *mock; - bool allinone =3D false, logind =3D false; - init_syms(); + char *filepath =3D NULL; + const char *type =3D NULL; + FILE *rc =3D NULL; + const char *filename =3D getenv("VIR_CGROUP_MOCK_FILENAME"); =20 - mock =3D getenv("VIR_CGROUP_MOCK_MODE"); - if (mock) { - if (STREQ(mock, "allinone")) - allinone =3D true; - else if (STREQ(mock, "logind")) - logind =3D true; - } + init_syms(); =20 if (STREQ(path, "/proc/mounts")) { if (STREQ(mode, "r")) { - if (allinone) - return fmemopen((void *)procmountsallinone, - strlen(procmountsallinone), mode); - else if (logind) - return fmemopen((void *)procmountslogind, - strlen(procmountslogind), mode); - else - return fmemopen((void *)procmounts, strlen(procmounts), mo= de); + type =3D "mounts"; } else { errno =3D EACCES; return NULL; @@ -408,14 +317,7 @@ FILE *fopen(const char *path, const char *mode) } if (STREQ(path, "/proc/cgroups")) { if (STREQ(mode, "r")) { - if (allinone) - return fmemopen((void *)proccgroupsallinone, - strlen(proccgroupsallinone), mode); - else if (logind) - return fmemopen((void *)proccgroupslogind, - strlen(proccgroupslogind), mode); - else - return fmemopen((void *)proccgroups, strlen(proccgroups), = mode); + type =3D "cgroups"; } else { errno =3D EACCES; return NULL; @@ -423,20 +325,25 @@ FILE *fopen(const char *path, const char *mode) } if (STREQ(path, "/proc/self/cgroup")) { if (STREQ(mode, "r")) { - if (allinone) - return fmemopen((void *)procselfcgroupsallinone, - strlen(procselfcgroupsallinone), mode); - else if (logind) - return fmemopen((void *)procselfcgroupslogind, - strlen(procselfcgroupslogind), mode); - else - return fmemopen((void *)procselfcgroups, strlen(procselfcg= roups), mode); + type =3D "self.cgroup"; } else { errno =3D EACCES; return NULL; } } =20 + if (type) { + if (!filename) + abort(); + if (virAsprintfQuiet(&filepath, "%s/vircgroupdata/%s.%s", + abs_srcdir, filename, type) < 0) { + abort(); + } + rc =3D real_fopen(filepath, mode); + free(filepath); + return rc; + } + return real_fopen(path, mode); } =20 diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c index be50f3e73c..7968903cad 100644 --- a/tests/vircgrouptest.c +++ b/tests/vircgrouptest.c @@ -890,6 +890,7 @@ mymain(void) DETECT_MOUNTS("no-cgroups"); DETECT_MOUNTS("kubevirt"); =20 + setenv("VIR_CGROUP_MOCK_FILENAME", "systemd", 1); if (virTestRun("New cgroup for self", testCgroupNewForSelf, NULL) < 0) ret =3D -1; =20 @@ -925,20 +926,21 @@ mymain(void) =20 if (virTestRun("virCgroupGetPercpuStats works", testCgroupGetPercpuSta= ts, NULL) < 0) ret =3D -1; + unsetenv("VIR_CGROUP_MOCK_FILENAME"); =20 - setenv("VIR_CGROUP_MOCK_MODE", "allinone", 1); + setenv("VIR_CGROUP_MOCK_FILENAME", "all-in-one", 1); if (virTestRun("New cgroup for self (allinone)", testCgroupNewForSelfA= llInOne, NULL) < 0) ret =3D -1; if (virTestRun("Cgroup available", testCgroupAvailable, (void*)0x1) < = 0) ret =3D -1; - unsetenv("VIR_CGROUP_MOCK_MODE"); + unsetenv("VIR_CGROUP_MOCK_FILENAME"); =20 - setenv("VIR_CGROUP_MOCK_MODE", "logind", 1); + setenv("VIR_CGROUP_MOCK_FILENAME", "logind", 1); if (virTestRun("New cgroup for self (logind)", testCgroupNewForSelfLog= ind, NULL) < 0) ret =3D -1; if (virTestRun("Cgroup available", testCgroupAvailable, (void*)0x0) < = 0) ret =3D -1; - unsetenv("VIR_CGROUP_MOCK_MODE"); + unsetenv("VIR_CGROUP_MOCK_FILENAME"); =20 if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537273109640641.6437626345559; Tue, 18 Sep 2018 05:18:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39269308FF2F; Tue, 18 Sep 2018 12:18:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA4D178DE1; Tue, 18 Sep 2018 12:18:26 +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 8D28E4A46C; Tue, 18 Sep 2018 12:18:26 +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 w8ICIBDE015788 for ; Tue, 18 Sep 2018 08:18:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id E0589176A2; Tue, 18 Sep 2018 12:18:11 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 637DC176A7 for ; Tue, 18 Sep 2018 12:18:11 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:18:00 +0200 Message-Id: <982608743d5e8a798ec27de5047425b41af44506.1537273033.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/9] vircgrouptest: call virCgroupDetectMounts directly 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 18 Sep 2018 12:18:28 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Because we can set which files to return for cgroup tests there is no need to have special function tailored to run tests. Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 2 +- src/util/vircgroup.c | 21 +++++---------------- src/util/vircgrouppriv.h | 4 +--- tests/vircgrouptest.c | 16 ++++++++-------- 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ad7ce57b65..7f3b5738c4 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1513,7 +1513,7 @@ virCgroupDelThread; virCgroupDenyAllDevices; virCgroupDenyDevice; virCgroupDenyDevicePath; -virCgroupDetectMountsFromFile; +virCgroupDetectMounts; virCgroupFree; virCgroupGetBlkioDeviceReadBps; virCgroupGetBlkioDeviceReadIops; diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 3211f63cb1..f8ef76136b 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -430,9 +430,7 @@ virCgroupMountOptsMatchController(const char *mntOpts, * mounted and where */ int -virCgroupDetectMountsFromFile(virCgroupPtr group, - const char *path, - bool checkLinks) +virCgroupDetectMounts(virCgroupPtr group) { size_t i; FILE *mounts =3D NULL; @@ -440,9 +438,9 @@ virCgroupDetectMountsFromFile(virCgroupPtr group, char buf[CGROUP_MAX_VAL]; int ret =3D -1; =20 - mounts =3D fopen(path, "r"); + mounts =3D fopen("/proc/mounts", "r"); if (mounts =3D=3D NULL) { - virReportSystemError(errno, _("Unable to open %s"), path); + virReportSystemError(errno, "%s", _("Unable to open /proc/mounts")= ); return -1; } =20 @@ -470,8 +468,7 @@ virCgroupDetectMountsFromFile(virCgroupPtr group, =20 /* If it is a co-mount it has a filename like "cpu,cpuacct" * and we must identify the symlink path */ - if (checkLinks && - virCgroupResolveMountLink(entry.mnt_dir, typestr, + if (virCgroupResolveMountLink(entry.mnt_dir, typestr, controller) < 0) { goto cleanup; } @@ -485,12 +482,6 @@ virCgroupDetectMountsFromFile(virCgroupPtr group, return ret; } =20 -static int -virCgroupDetectMounts(virCgroupPtr group) -{ - return virCgroupDetectMountsFromFile(group, "/proc/mounts", true); -} - =20 static int virCgroupCopyPlacement(virCgroupPtr group, @@ -4082,9 +4073,7 @@ virCgroupAvailable(void) =20 =20 int -virCgroupDetectMountsFromFile(virCgroupPtr group ATTRIBUTE_UNUSED, - const char *path ATTRIBUTE_UNUSED, - bool checkLinks ATTRIBUTE_UNUSED) +virCgroupDetectMounts(virCgroupPtr group ATTRIBUTE_UNUSED) { virReportSystemError(ENXIO, "%s", _("Control groups not supported on this platform"= )); diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h index a0034f3889..f78fe8bb9c 100644 --- a/src/util/vircgrouppriv.h +++ b/src/util/vircgrouppriv.h @@ -50,9 +50,7 @@ struct _virCgroup { virCgroupController controllers[VIR_CGROUP_CONTROLLER_LAST]; }; =20 -int virCgroupDetectMountsFromFile(virCgroupPtr group, - const char *path, - bool checkLinks); +int virCgroupDetectMounts(virCgroupPtr group); =20 int virCgroupNewPartition(const char *path, bool create, diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c index 7968903cad..6a38091a86 100644 --- a/tests/vircgrouptest.c +++ b/tests/vircgrouptest.c @@ -164,21 +164,21 @@ testCgroupDetectMounts(const void *args) { int result =3D -1; const char *file =3D args; - char *mounts =3D NULL; char *parsed =3D NULL; const char *actual; virCgroupPtr group =3D NULL; virBuffer buf =3D VIR_BUFFER_INITIALIZER; size_t i; =20 - if (virAsprintf(&mounts, "%s/vircgroupdata/%s.mounts", - abs_srcdir, file) < 0 || - virAsprintf(&parsed, "%s/vircgroupdata/%s.parsed", - abs_srcdir, file) < 0 || - VIR_ALLOC(group) < 0) + setenv("VIR_CGROUP_MOCK_FILENAME", file, 1); + + if (virAsprintf(&parsed, "%s/vircgroupdata/%s.parsed", abs_srcdir, fil= e) < 0) + goto cleanup; + + if (VIR_ALLOC(group) < 0) goto cleanup; =20 - if (virCgroupDetectMountsFromFile(group, mounts, false) < 0) + if (virCgroupDetectMounts(group) < 0) goto cleanup; =20 for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { @@ -196,7 +196,7 @@ testCgroupDetectMounts(const void *args) result =3D 0; =20 cleanup: - VIR_FREE(mounts); + unsetenv("VIR_CGROUP_MOCK_FILENAME"); VIR_FREE(parsed); virCgroupFree(&group); virBufferFreeAndReset(&buf); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:53:28 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537273114811724.823558034671; Tue, 18 Sep 2018 05:18:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95E9165983; Tue, 18 Sep 2018 12:18:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C4A6308BDA0; Tue, 18 Sep 2018 12:18:32 +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 090014A469; Tue, 18 Sep 2018 12:18:32 +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 w8ICIC9G015795 for ; Tue, 18 Sep 2018 08:18:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id BDF243796; Tue, 18 Sep 2018 12:18:12 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AEC6176AD for ; Tue, 18 Sep 2018 12:18:12 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 14:18:01 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 9/9] vircgrouptest: call virCgroupNewSelf instead virCgroupDetectMounts 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 18 Sep 2018 12:18:33 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This will be required once cgroup v2 is introduced. The cgroup detection is not simple and we will have multiple backends so we should not just jump into the middle of the detection code. In order to use virCgroupNewSelf we need to create all the remaining data files. Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 1 - src/util/vircgroup.c | 11 +---------- src/util/vircgrouppriv.h | 2 -- tests/vircgroupdata/cgroups1.cgroups | 11 +++++++++++ tests/vircgroupdata/cgroups1.self.cgroup | 11 +++++++++++ tests/vircgroupdata/cgroups2.cgroups | 10 ++++++++++ tests/vircgroupdata/cgroups2.self.cgroup | 10 ++++++++++ tests/vircgroupdata/cgroups3.cgroups | 12 ++++++++++++ tests/vircgroupdata/cgroups3.self.cgroup | 12 ++++++++++++ tests/vircgroupdata/fedora-18.cgroups | 10 ++++++++++ tests/vircgroupdata/fedora-18.self.cgroup | 9 +++++++++ tests/vircgroupdata/fedora-21.cgroups | 12 ++++++++++++ tests/vircgroupdata/fedora-21.self.cgroup | 10 ++++++++++ tests/vircgroupdata/kubevirt.cgroups | 10 ++++++++++ tests/vircgroupdata/kubevirt.self.cgroup | 10 ++++++++++ tests/vircgroupdata/ovirt-node-6.6.cgroups | 9 +++++++++ tests/vircgroupdata/ovirt-node-6.6.self.cgroup | 8 ++++++++ tests/vircgroupdata/ovirt-node-7.1.cgroups | 11 +++++++++++ tests/vircgroupdata/ovirt-node-7.1.self.cgroup | 10 ++++++++++ tests/vircgroupdata/rhel-7.1.cgroups | 11 +++++++++++ tests/vircgroupdata/rhel-7.1.self.cgroup | 10 ++++++++++ tests/vircgrouptest.c | 6 +----- 22 files changed, 188 insertions(+), 18 deletions(-) create mode 100644 tests/vircgroupdata/cgroups1.cgroups create mode 100644 tests/vircgroupdata/cgroups1.self.cgroup create mode 100644 tests/vircgroupdata/cgroups2.cgroups create mode 100644 tests/vircgroupdata/cgroups2.self.cgroup create mode 100644 tests/vircgroupdata/cgroups3.cgroups create mode 100644 tests/vircgroupdata/cgroups3.self.cgroup create mode 100644 tests/vircgroupdata/fedora-18.cgroups create mode 100644 tests/vircgroupdata/fedora-18.self.cgroup create mode 100644 tests/vircgroupdata/fedora-21.cgroups create mode 100644 tests/vircgroupdata/fedora-21.self.cgroup create mode 100644 tests/vircgroupdata/kubevirt.cgroups create mode 100644 tests/vircgroupdata/kubevirt.self.cgroup create mode 100644 tests/vircgroupdata/ovirt-node-6.6.cgroups create mode 100644 tests/vircgroupdata/ovirt-node-6.6.self.cgroup create mode 100644 tests/vircgroupdata/ovirt-node-7.1.cgroups create mode 100644 tests/vircgroupdata/ovirt-node-7.1.self.cgroup create mode 100644 tests/vircgroupdata/rhel-7.1.cgroups create mode 100644 tests/vircgroupdata/rhel-7.1.self.cgroup diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7f3b5738c4..75c59fbf89 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1513,7 +1513,6 @@ virCgroupDelThread; virCgroupDenyAllDevices; virCgroupDenyDevice; virCgroupDenyDevicePath; -virCgroupDetectMounts; virCgroupFree; virCgroupGetBlkioDeviceReadBps; virCgroupGetBlkioDeviceReadIops; diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index f8ef76136b..e85e0bde24 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -429,7 +429,7 @@ virCgroupMountOptsMatchController(const char *mntOpts, * Process /proc/mounts figuring out what controllers are * mounted and where */ -int +static int virCgroupDetectMounts(virCgroupPtr group) { size_t i; @@ -4072,15 +4072,6 @@ virCgroupAvailable(void) } =20 =20 -int -virCgroupDetectMounts(virCgroupPtr group ATTRIBUTE_UNUSED) -{ - virReportSystemError(ENXIO, "%s", - _("Control groups not supported on this platform"= )); - return -1; -} - - int virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED, bool create ATTRIBUTE_UNUSED, diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h index f78fe8bb9c..046c96c52c 100644 --- a/src/util/vircgrouppriv.h +++ b/src/util/vircgrouppriv.h @@ -50,8 +50,6 @@ struct _virCgroup { virCgroupController controllers[VIR_CGROUP_CONTROLLER_LAST]; }; =20 -int virCgroupDetectMounts(virCgroupPtr group); - int virCgroupNewPartition(const char *path, bool create, int controllers, diff --git a/tests/vircgroupdata/cgroups1.cgroups b/tests/vircgroupdata/cgr= oups1.cgroups new file mode 100644 index 0000000000..a03c290a98 --- /dev/null +++ b/tests/vircgroupdata/cgroups1.cgroups @@ -0,0 +1,11 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 3 1 1 +blkio 8 1 1 +memory 4 1 1 +devices 5 1 1 +freezer 6 1 1 +net_cls 7 1 1 +net_prio 9 1 1 +hugetlb 10 1 1 diff --git a/tests/vircgroupdata/cgroups1.self.cgroup b/tests/vircgroupdata= /cgroups1.self.cgroup new file mode 100644 index 0000000000..181f0c22f8 --- /dev/null +++ b/tests/vircgroupdata/cgroups1.self.cgroup @@ -0,0 +1,11 @@ +10:hugetlb:/ +9:net_prio:/ +8:blkio:/ +7:net_cls:/ +6:freezer:/ +5:devices:/ +4:memory:/ +3:cpuacct:/ +2:cpu:/ +1:cpuset:/ +0:name=3Dopenrc:/ diff --git a/tests/vircgroupdata/cgroups2.cgroups b/tests/vircgroupdata/cgr= oups2.cgroups new file mode 100644 index 0000000000..f0a7699559 --- /dev/null +++ b/tests/vircgroupdata/cgroups2.cgroups @@ -0,0 +1,10 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 3 1 1 +blkio 7 1 1 +memory 4 1 1 +devices 5 1 1 +freezer 6 1 1 +perf_event 8 1 1 +hugetlb 9 1 1 diff --git a/tests/vircgroupdata/cgroups2.self.cgroup b/tests/vircgroupdata= /cgroups2.self.cgroup new file mode 100644 index 0000000000..3d0e793e5a --- /dev/null +++ b/tests/vircgroupdata/cgroups2.self.cgroup @@ -0,0 +1,10 @@ +9:hugetlb:/ +8:perf_event:/ +7:blkio:/ +6:freezer:/ +5:devices:/ +4:memory:/ +3:cpuacct:/ +2:cpu:/ +1:cpuset:/ +0:name=3Dopenrc:/ diff --git a/tests/vircgroupdata/cgroups3.cgroups b/tests/vircgroupdata/cgr= oups3.cgroups new file mode 100644 index 0000000000..294d95dedf --- /dev/null +++ b/tests/vircgroupdata/cgroups3.cgroups @@ -0,0 +1,12 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 3 1 1 +blkio 8 1 1 +memory 4 1 1 +devices 5 1 1 +freezer 6 1 1 +net_cls 7 1 1 +perf_event 9 1 1 +net_prio 10 1 1 +hugetlb 11 1 1 diff --git a/tests/vircgroupdata/cgroups3.self.cgroup b/tests/vircgroupdata= /cgroups3.self.cgroup new file mode 100644 index 0000000000..bf346abdf9 --- /dev/null +++ b/tests/vircgroupdata/cgroups3.self.cgroup @@ -0,0 +1,12 @@ +11:hugetlb:/ +10:net_prio:/ +9:perf_event:/ +8:blkio:/ +7:net_cls:/ +6:freezer:/ +5:devices:/ +4:memory:/ +3:cpuacct:/ +2:cpu:/ +1:cpuset:/ +0:name=3Dopenrc:/ diff --git a/tests/vircgroupdata/fedora-18.cgroups b/tests/vircgroupdata/fe= dora-18.cgroups new file mode 100644 index 0000000000..8eb41087f3 --- /dev/null +++ b/tests/vircgroupdata/fedora-18.cgroups @@ -0,0 +1,10 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 2 1 1 +blkio 7 1 1 +memory 3 1 1 +devices 4 1 1 +freezer 5 1 1 +net_cls 6 1 1 +perf_event 8 1 1 diff --git a/tests/vircgroupdata/fedora-18.self.cgroup b/tests/vircgroupdat= a/fedora-18.self.cgroup new file mode 100644 index 0000000000..da9ad8ad4d --- /dev/null +++ b/tests/vircgroupdata/fedora-18.self.cgroup @@ -0,0 +1,9 @@ +8:perf_event:/ +7:blkio:/ +6:net_cls:/ +5:freezer:/ +4:devices:/ +3:memory:/ +2:cpu,cpuacct:/ +1:cpuset:/ +0:name=3Dsystemd:/ diff --git a/tests/vircgroupdata/fedora-21.cgroups b/tests/vircgroupdata/fe= dora-21.cgroups new file mode 100644 index 0000000000..3e1401ee98 --- /dev/null +++ b/tests/vircgroupdata/fedora-21.cgroups @@ -0,0 +1,12 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 2 1 1 +blkio 7 1 1 +memory 3 1 1 +devices 4 1 1 +freezer 5 1 1 +net_cls 6 1 1 +perf_event 8 1 1 +net_prio 6 1 1 +hugetlb 9 1 1 diff --git a/tests/vircgroupdata/fedora-21.self.cgroup b/tests/vircgroupdat= a/fedora-21.self.cgroup new file mode 100644 index 0000000000..4c666bd59e --- /dev/null +++ b/tests/vircgroupdata/fedora-21.self.cgroup @@ -0,0 +1,10 @@ +9:hugetlb:/ +8:perf_event:/ +7:blkio:/ +6:net_cls,net_prio:/ +5:freezer:/ +4:devices:/ +3:memory:/ +2:cpu,cpuacct:/ +1:cpuset:/ +0:name=3Dsystemd:/ diff --git a/tests/vircgroupdata/kubevirt.cgroups b/tests/vircgroupdata/kub= evirt.cgroups new file mode 100644 index 0000000000..f0a7699559 --- /dev/null +++ b/tests/vircgroupdata/kubevirt.cgroups @@ -0,0 +1,10 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 3 1 1 +blkio 7 1 1 +memory 4 1 1 +devices 5 1 1 +freezer 6 1 1 +perf_event 8 1 1 +hugetlb 9 1 1 diff --git a/tests/vircgroupdata/kubevirt.self.cgroup b/tests/vircgroupdata= /kubevirt.self.cgroup new file mode 100644 index 0000000000..3d0e793e5a --- /dev/null +++ b/tests/vircgroupdata/kubevirt.self.cgroup @@ -0,0 +1,10 @@ +9:hugetlb:/ +8:perf_event:/ +7:blkio:/ +6:freezer:/ +5:devices:/ +4:memory:/ +3:cpuacct:/ +2:cpu:/ +1:cpuset:/ +0:name=3Dopenrc:/ diff --git a/tests/vircgroupdata/ovirt-node-6.6.cgroups b/tests/vircgroupda= ta/ovirt-node-6.6.cgroups new file mode 100644 index 0000000000..aaabf11a44 --- /dev/null +++ b/tests/vircgroupdata/ovirt-node-6.6.cgroups @@ -0,0 +1,9 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 0 1 1 +cpu 1 1 1 +cpuacct 2 1 1 +blkio 7 1 1 +memory 3 1 1 +devices 4 1 1 +freezer 5 1 1 +net_cls 6 1 1 diff --git a/tests/vircgroupdata/ovirt-node-6.6.self.cgroup b/tests/vircgro= updata/ovirt-node-6.6.self.cgroup new file mode 100644 index 0000000000..dadc8155fa --- /dev/null +++ b/tests/vircgroupdata/ovirt-node-6.6.self.cgroup @@ -0,0 +1,8 @@ +7:blkio:/ +6:net_cls:/ +5:freezer:/ +4:devices:/ +3:memory:/ +2:cpuacct:/ +1:cpu:/ +0:cpuset:/ diff --git a/tests/vircgroupdata/ovirt-node-7.1.cgroups b/tests/vircgroupda= ta/ovirt-node-7.1.cgroups new file mode 100644 index 0000000000..687297ad4a --- /dev/null +++ b/tests/vircgroupdata/ovirt-node-7.1.cgroups @@ -0,0 +1,11 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 2 1 1 +blkio 7 1 1 +memory 3 1 1 +devices 4 1 1 +freezer 5 1 1 +net_cls 6 1 1 +perf_event 8 1 1 +hugetlb 9 1 1 diff --git a/tests/vircgroupdata/ovirt-node-7.1.self.cgroup b/tests/vircgro= updata/ovirt-node-7.1.self.cgroup new file mode 100644 index 0000000000..f07e8e20f5 --- /dev/null +++ b/tests/vircgroupdata/ovirt-node-7.1.self.cgroup @@ -0,0 +1,10 @@ +9:hugetlb:/ +8:perf_event:/ +7:blkio:/ +6:net_cls:/ +5:freezer:/ +4:devices:/ +3:memory:/ +2:cpu,cpuacct:/ +1:cpuset:/ +0:name=3Dsystemd:/ diff --git a/tests/vircgroupdata/rhel-7.1.cgroups b/tests/vircgroupdata/rhe= l-7.1.cgroups new file mode 100644 index 0000000000..687297ad4a --- /dev/null +++ b/tests/vircgroupdata/rhel-7.1.cgroups @@ -0,0 +1,11 @@ +#subsys_name hierarchy num_cgroups enabled +cpuset 1 1 1 +cpu 2 1 1 +cpuacct 2 1 1 +blkio 7 1 1 +memory 3 1 1 +devices 4 1 1 +freezer 5 1 1 +net_cls 6 1 1 +perf_event 8 1 1 +hugetlb 9 1 1 diff --git a/tests/vircgroupdata/rhel-7.1.self.cgroup b/tests/vircgroupdata= /rhel-7.1.self.cgroup new file mode 100644 index 0000000000..f07e8e20f5 --- /dev/null +++ b/tests/vircgroupdata/rhel-7.1.self.cgroup @@ -0,0 +1,10 @@ +9:hugetlb:/ +8:perf_event:/ +7:blkio:/ +6:net_cls:/ +5:freezer:/ +4:devices:/ +3:memory:/ +2:cpu,cpuacct:/ +1:cpuset:/ +0:name=3Dsystemd:/ diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c index 6a38091a86..bbbe6ffbe5 100644 --- a/tests/vircgrouptest.c +++ b/tests/vircgrouptest.c @@ -175,10 +175,7 @@ testCgroupDetectMounts(const void *args) if (virAsprintf(&parsed, "%s/vircgroupdata/%s.parsed", abs_srcdir, fil= e) < 0) goto cleanup; =20 - if (VIR_ALLOC(group) < 0) - goto cleanup; - - if (virCgroupDetectMounts(group) < 0) + if (virCgroupNewSelf(&group) < 0) goto cleanup; =20 for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { @@ -887,7 +884,6 @@ mymain(void) DETECT_MOUNTS("cgroups2"); DETECT_MOUNTS("cgroups3"); DETECT_MOUNTS("all-in-one"); - DETECT_MOUNTS("no-cgroups"); DETECT_MOUNTS("kubevirt"); =20 setenv("VIR_CGROUP_MOCK_FILENAME", "systemd", 1); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list