From c0e01b17c1de8c3ae93dd1ae187f8b20e3547be6 Mon Sep 17 00:00:00 2001 From: Vishnu Kannan Date: Wed, 16 Dec 2015 11:35:45 -0800 Subject: [PATCH] Update cgroupsPath to cgroupName and clarify the semantics around that. --- runtime-config-linux.md | 20 +++++++++++++++----- runtime_config_linux.go | 8 ++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/runtime-config-linux.md b/runtime-config-linux.md index b9d633c87..b72d3d429 100644 --- a/runtime-config-linux.md +++ b/runtime-config-linux.md @@ -144,19 +144,29 @@ Also known as cgroups, they are used to restrict resource usage for a container cgroups provide controls to restrict cpu, memory, IO, pids and network for the container. For more information, see the [kernel cgroups documentation](https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt). -The path to the cgroups can be specified in the Spec via `cgroupsPath`. -`cgroupsPath` is expected to be relative to the cgroups mount point. -If `cgroupsPath` is not specified, implementations can define the default cgroup path. +The name of the cgroups can be specified in the Spec via `cgroupsName`. +Cgroup names mimic filesystem paths closely since they express a hierarchy of cgroups. +`cgroupsName` is expected to be absolute. +An absolute name is one that is defined from the root cgroup `/`. +For example, `/foo/bar` is acceptible. `foo/bar` is not acceptible. +Allowable characters for cgroup names are, +Alpha numeric ([a-zA-Z0-9]+) +Underscores (_) +Dashes (-) +Periods (.) +In general and unless otherwise specified, regular filesystem path rules apply. + +If `cgroupsName` is not specified, implementations can choose to use (or not use) any cgroups. Implementations of the Spec can choose to name cgroups in any manner. The Spec does not include naming schema for cgroups. The Spec does not support [split hierarchy](https://www.kernel.org/doc/Documentation/cgroups/unified-hierarchy.txt). The cgroups will be created if they don't exist. ```json - "cgroupsPath": "/myRuntime/myContainer" + "cgroupsName": "/foo-runtime/bar.container" ``` -`cgroupsPath` can be used to either control the cgroups hierarchy for containers or to run a new process in an existing container. +`cgroupsName` can be used to either control the cgroups for new containers or to run a new process in an existing container. You can configure a container's cgroups via the `resources` field of the Linux configuration. Do not specify `resources` unless limits have to be updated. diff --git a/runtime_config_linux.go b/runtime_config_linux.go index 7673e693e..7a7da05c9 100644 --- a/runtime_config_linux.go +++ b/runtime_config_linux.go @@ -25,10 +25,10 @@ type LinuxRuntime struct { // Resources contain cgroup information for handling resource constraints // for the container Resources *Resources `json:"resources"` - // CgroupsPath specifies the path to cgroups that are created and/or joined by the container. - // The path is expected to be relative to the cgroups mountpoint. - // If resources are specified, the cgroups at CgroupsPath will be updated based on resources. - CgroupsPath string `json:"cgroupsPath"` + // CgroupsName specifies the name of to cgroups that are created and/or joined by the container. + // The name is expected to be absolute. + // If resources are specified, the CgroupsName cgroups will be updated based on resources. + CgroupsName string `json:"cgroupsName"` // Namespaces contains the namespaces that are created and/or joined by the container Namespaces []Namespace `json:"namespaces"` // Devices are a list of device nodes that are created and enabled for the container