Add back check for mountpoint to return consistent error

Adding this check here allows a nice error displaying that the specified
cgroup subsystem is not mounted.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2015-03-23 12:20:18 -07:00
parent fc3981ea5c
commit c5eef90460
1 changed files with 6 additions and 0 deletions

View File

@ -235,6 +235,12 @@ func (raw *data) parent(subsystem string) (string, error) {
} }
func (raw *data) path(subsystem string) (string, error) { func (raw *data) path(subsystem string) (string, error) {
_, err := cgroups.FindCgroupMountpoint(subsystem)
// If we didn't mount the subsystem, there is no point we make the path.
if err != nil {
return "", err
}
// If the cgroup name/path is absolute do not look relative to the cgroup of the init process. // If the cgroup name/path is absolute do not look relative to the cgroup of the init process.
if filepath.IsAbs(raw.cgroup) { if filepath.IsAbs(raw.cgroup) {
return filepath.Join(raw.root, subsystem, raw.cgroup), nil return filepath.Join(raw.root, subsystem, raw.cgroup), nil