-
Notifications
You must be signed in to change notification settings - Fork 19
Update lxc config option and fix cgroup2 volume mount #38
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ type taskHandle struct { | |
var ( | ||
LXCMeasuredCpuStats = []string{"System Mode", "User Mode", "Percent"} | ||
|
||
LXCMeasuredMemStats = []string{"RSS", "Cache", "Swap", "Max Usage", "Kernel Usage", "Kernel Max Usage"} | ||
LXCMeasuredMemStats = []string{"RSS", "Cache", "Swap"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You said in the PR description:
Those stats will still be supported on cgroups v1 machines. Unless all supported versions of LXC stopped supporting cgroups v2, we shouldn't remove these stats. I can't find any notes to this in their docs, but I'll admit their docs are also not very searchable 😀 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed them due to provide a consistent view regardless of the system cgroup version. My goal was to support jobs running in a mixed cgroup environment. Provides a seamless path to cgroup v2 only systems. If you would prefer to keep the stats (with no values for v2), I could ignore errors when fetching measured stats from LXC. Open to any suggestions. |
||
) | ||
|
||
func (h *taskHandle) TaskStatus() *drivers.TaskStatus { | ||
|
@@ -151,35 +151,6 @@ func (h *taskHandle) handleStats(ctx context.Context, ch chan *drivers.TaskResou | |
Measured: LXCMeasuredMemStats, | ||
} | ||
|
||
mu := h.container.CgroupItem("memory.max_usage_in_bytes") | ||
for _, rawMemMaxUsage := range mu { | ||
val, err := strconv.ParseUint(rawMemMaxUsage, 10, 64) | ||
if err != nil { | ||
h.logger.Error("failed to get max memory usage", "error", err) | ||
continue | ||
} | ||
ms.MaxUsage = val | ||
} | ||
ku := h.container.CgroupItem("memory.kmem.usage_in_bytes") | ||
for _, rawKernelUsage := range ku { | ||
val, err := strconv.ParseUint(rawKernelUsage, 10, 64) | ||
if err != nil { | ||
h.logger.Error("failed to get kernel memory usage", "error", err) | ||
continue | ||
} | ||
ms.KernelUsage = val | ||
} | ||
|
||
mku := h.container.CgroupItem("memory.kmem.max_usage_in_bytes") | ||
for _, rawMaxKernelUsage := range mku { | ||
val, err := strconv.ParseUint(rawMaxKernelUsage, 10, 64) | ||
if err != nil { | ||
h.logger.Error("failed tog get max kernel memory usage", "error", err) | ||
continue | ||
} | ||
ms.KernelMaxUsage = val | ||
} | ||
|
||
taskResUsage := drivers.TaskResourceUsage{ | ||
ResourceUsage: &drivers.ResourceUsage{ | ||
CpuStats: cs, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have this set in the plugin configuration and not the job spec because under the Nomad security model personas the LXC config file would be controlled by the System Administrator or Nomad Administrator, whereas the jobspec is controlled by the Nomad Operator (the person who runs
nomad job run
). Generally speaking it doesn't make sense to give the Nomad Operator the ability to pick and choose among files that are owned by the client.Additionally, the appropriate file would be a property of the client, not all clients, so that belongs in the plugin configuration. Imagine the case where someone submits a job with a particular LXC config path that doesn't exist on the client it happens to get placed on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Will rework.