From a0ff07393b3dc2a17727fd68437873da79c403d7 Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Thu, 7 Nov 2024 12:24:37 -0600 Subject: [PATCH] drivers: provide empty implementations of cgroup helpers for non-root nomad (#24392) --- drivers/shared/executor/executor_universal_linux.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/shared/executor/executor_universal_linux.go b/drivers/shared/executor/executor_universal_linux.go index 5010171dbef..3c113f6d0c5 100644 --- a/drivers/shared/executor/executor_universal_linux.go +++ b/drivers/shared/executor/executor_universal_linux.go @@ -145,15 +145,15 @@ func (e *UniversalExecutor) configureResourceContainer( // v1: remove the executor process from the task's cgroups // v2: let go of the file descriptor of the task's cgroup var ( - deleteCgroup cleanupFunc - moveProcess runningFunc + deleteCgroup = func() {} + moveProcess = func() error { return nil } ) // manually configure cgroup for cpu / memory constraints switch cgroupslib.GetMode() { case cgroupslib.CG1: if err := e.configureCG1(cgroup, command); err != nil { - return nil, nil, err + return moveProcess, deleteCgroup, err } moveProcess, deleteCgroup = e.enterCG1(cgroup, command.CpusetCgroup()) default: @@ -162,12 +162,11 @@ func (e *UniversalExecutor) configureResourceContainer( // get file descriptor of the cgroup made for this task fd, cleanup, err := e.statCG(cgroup) if err != nil { - return nil, nil, err + return moveProcess, deleteCgroup, err } e.childCmd.SysProcAttr.UseCgroupFD = true e.childCmd.SysProcAttr.CgroupFD = fd deleteCgroup = cleanup - moveProcess = func() error { return nil } } e.logger.Info("configured cgroup for executor", "pid", pid)