Browse Source

Merge pull request #16873 from coolljt0725/expand_docker_info

Add more cgroup config to docker info
Alexander Morozov 9 years ago
parent
commit
cccf674943
4 changed files with 20 additions and 1 deletions
  1. 15 0
      api/client/info.go
  2. 2 0
      api/types/types.go
  3. 2 0
      daemon/info.go
  4. 1 1
      docs/reference/api/docker_remote_api.md

+ 15 - 0
api/client/info.go

@@ -83,6 +83,21 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
 			if !info.SwapLimit {
 			if !info.SwapLimit {
 				fmt.Fprintf(cli.err, "WARNING: No swap limit support\n")
 				fmt.Fprintf(cli.err, "WARNING: No swap limit support\n")
 			}
 			}
+			if !info.OomKillDisable {
+				fmt.Fprintf(cli.err, "WARNING: No oom kill disable support\n")
+			}
+			if !info.CPUCfsQuota {
+				fmt.Fprintf(cli.err, "WARNING: No cpu cfs quota support\n")
+			}
+			if !info.CPUCfsPeriod {
+				fmt.Fprintf(cli.err, "WARNING: No cpu cfs period support\n")
+			}
+			if !info.CPUShares {
+				fmt.Fprintf(cli.err, "WARNING: No cpu shares support\n")
+			}
+			if !info.CPUSet {
+				fmt.Fprintf(cli.err, "WARNING: No cpuset support\n")
+			}
 			if !info.IPv4Forwarding {
 			if !info.IPv4Forwarding {
 				fmt.Fprintf(cli.err, "WARNING: IPv4 forwarding is disabled\n")
 				fmt.Fprintf(cli.err, "WARNING: IPv4 forwarding is disabled\n")
 			}
 			}

+ 2 - 0
api/types/types.go

@@ -192,6 +192,8 @@ type Info struct {
 	SwapLimit          bool
 	SwapLimit          bool
 	CPUCfsPeriod       bool `json:"CpuCfsPeriod"`
 	CPUCfsPeriod       bool `json:"CpuCfsPeriod"`
 	CPUCfsQuota        bool `json:"CpuCfsQuota"`
 	CPUCfsQuota        bool `json:"CpuCfsQuota"`
+	CPUShares          bool
+	CPUSet             bool
 	IPv4Forwarding     bool
 	IPv4Forwarding     bool
 	BridgeNfIptables   bool
 	BridgeNfIptables   bool
 	BridgeNfIP6tables  bool `json:"BridgeNfIp6tables"`
 	BridgeNfIP6tables  bool `json:"BridgeNfIp6tables"`

+ 2 - 0
daemon/info.go

@@ -101,6 +101,8 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
 		v.OomKillDisable = sysInfo.OomKillDisable
 		v.OomKillDisable = sysInfo.OomKillDisable
 		v.CPUCfsPeriod = sysInfo.CPUCfsPeriod
 		v.CPUCfsPeriod = sysInfo.CPUCfsPeriod
 		v.CPUCfsQuota = sysInfo.CPUCfsQuota
 		v.CPUCfsQuota = sysInfo.CPUCfsQuota
+		v.CPUShares = sysInfo.CPUShares
+		v.CPUSet = sysInfo.Cpuset
 	}
 	}
 
 
 	if hostname, err := os.Hostname(); err == nil {
 	if hostname, err := os.Hostname(); err == nil {

+ 1 - 1
docs/reference/api/docker_remote_api.md

@@ -113,7 +113,7 @@ list of DNS options to be used in the container.
 * `POST /build` now optionally takes a serialized map of build-time variables.
 * `POST /build` now optionally takes a serialized map of build-time variables.
 * `GET /events` now includes a `timenano` field, in addition to the existing `time` field.
 * `GET /events` now includes a `timenano` field, in addition to the existing `time` field.
 * `GET /events` now supports filtering by image and container labels.
 * `GET /events` now supports filtering by image and container labels.
-* `GET /info` now lists engine version information.
+* `GET /info` now lists engine version information and return the information of `CPUShares` and `Cpuset`.
 * `GET /containers/json` will return `ImageID` of the image used by container.
 * `GET /containers/json` will return `ImageID` of the image used by container.
 * `POST /exec/(name)/start` will now return an HTTP 409 when the container is either stopped or paused.
 * `POST /exec/(name)/start` will now return an HTTP 409 when the container is either stopped or paused.
 * `GET /containers/(name)/json` now accepts a `size` parameter. Setting this parameter to '1' returns container size information in the `SizeRw` and `SizeRootFs` fields.
 * `GET /containers/(name)/json` now accepts a `size` parameter. Setting this parameter to '1' returns container size information in the `SizeRw` and `SizeRootFs` fields.