Skip to content

Commit

Permalink
docker[linux]: change docker error valiable and add cgroup error.
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed Aug 7, 2015
1 parent a365e17 commit 1223e28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package docker

import "errors"

var ErrNotAvailable = errors.New("docker not available")
var ErrDockerNotAvailable = errors.New("docker not available")
var ErrCgroupNotAvailable = errors.New("cgroup not available")

type CgroupMemStat struct {
ContainerID string `json:"container_id"`
Expand Down
1 change: 0 additions & 1 deletion docker/docker_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package docker

import (
"encoding/json"
"errors"
"os/exec"
"path"
"strconv"
Expand Down
6 changes: 3 additions & 3 deletions docker/docker_notlinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ import (
// GetDockerIDList returnes a list of DockerID.
// This requires certain permission.
func GetDockerIDList() ([]string, error) {
return nil, common.NotImplementedError
return nil, ErrDockerNotAvailable
}

// CgroupCPU returnes specified cgroup id CPU status.
// containerid is same as docker id if you use docker.
// If you use container via systemd.slice, you could use
// containerid = docker-<container id>.scope and base=/sys/fs/cgroup/cpuacct/system.slice/
func CgroupCPU(containerid string, base string) (*cpu.CPUTimesStat, error) {
return nil, common.NotImplementedError
return nil, ErrCgroupNotAvailable
}

func CgroupCPUDocker(containerid string) (*cpu.CPUTimesStat, error) {
return CgroupCPU(containerid, "/sys/fs/cgroup/cpuacct/docker")
}

func CgroupMem(containerid string, base string) (*CgroupMemStat, error) {
return nil, common.NotImplementedError
return nil, ErrCgroupNotAvailable
}

func CgroupMemDocker(containerid string) (*CgroupMemStat, error) {
Expand Down

0 comments on commit 1223e28

Please sign in to comment.