From ca89c329b9f0748da74d08d02a47bc494e7965e2 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Thu, 18 Feb 2016 18:10:31 +0800 Subject: [PATCH] Add CgroupDriver to docker info Fixes: #19539 Signed-off-by: Qiang Huang --- api/client/info.go | 1 + daemon/daemon_unix.go | 8 ++++++++ daemon/daemon_windows.go | 4 ++++ daemon/info.go | 1 + docs/reference/api/docker_remote_api.md | 1 + docs/reference/api/docker_remote_api_v1.23.md | 1 + docs/reference/commandline/info.md | 1 + man/docker-info.1.md | 1 + 8 files changed, 18 insertions(+) diff --git a/api/client/info.go b/api/client/info.go index fb2bdcd730..0a55f3bd52 100644 --- a/api/client/info.go +++ b/api/client/info.go @@ -50,6 +50,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error { } ioutils.FprintfIfNotEmpty(cli.out, "Execution Driver: %s\n", info.ExecutionDriver) ioutils.FprintfIfNotEmpty(cli.out, "Logging Driver: %s\n", info.LoggingDriver) + ioutils.FprintfIfNotEmpty(cli.out, "Cgroup Driver: %s\n", info.CgroupDriver) fmt.Fprintf(cli.out, "Plugins: \n") fmt.Fprintf(cli.out, " Volume:") diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index f47e420852..d8d4e56e39 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -362,6 +362,14 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi return warnings, nil } +func (daemon *Daemon) getCgroupDriver() string { + cgroupDriver := "cgroupfs" + if daemon.usingSystemd() { + cgroupDriver = "systemd" + } + return cgroupDriver +} + func usingSystemd(config *Config) bool { for _, option := range config.ExecOptions { key, val, err := parsers.ParseKeyValueOpt(option) diff --git a/daemon/daemon_windows.go b/daemon/daemon_windows.go index 609506f7b1..b9aadc6b00 100644 --- a/daemon/daemon_windows.go +++ b/daemon/daemon_windows.go @@ -65,6 +65,10 @@ func checkKernel() error { return nil } +func (daemon *Daemon) getCgroupDriver() string { + return "" +} + // adaptContainerSettings is called during container creation to modify any // settings necessary in the HostConfig structure. func (daemon *Daemon) adaptContainerSettings(hostConfig *containertypes.HostConfig, adjustCPUShares bool) error { diff --git a/daemon/info.go b/daemon/info.go index 61eab2d7fd..e0edc2ad22 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -83,6 +83,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) { SystemTime: time.Now().Format(time.RFC3339Nano), ExecutionDriver: daemon.ExecutionDriver().Name(), LoggingDriver: daemon.defaultLogConfig.Type, + CgroupDriver: daemon.getCgroupDriver(), NEventsListener: daemon.EventsService.SubscribersCount(), KernelVersion: kernelVersion, OperatingSystem: operatingSystem, diff --git a/docs/reference/api/docker_remote_api.md b/docs/reference/api/docker_remote_api.md index 8880975eb9..715e8fede3 100644 --- a/docs/reference/api/docker_remote_api.md +++ b/docs/reference/api/docker_remote_api.md @@ -121,6 +121,7 @@ This section lists each version from latest to oldest. Each listing includes a * `GET /networks/(name)` now returns an `EnableIPv6` field showing whether the network has ipv6 enabled or not. * `POST /containers/(name)/update` now supports updating container's restart policy. * `POST /networks/create` now supports enabling ipv6 on the network by setting the `EnableIPv6` field (doing this with a label will no longer work). +* `GET /info` now returns `CgroupDriver` field showing what cgroup driver the daemon is using; `cgroupfs` or `systemd`. ### v1.22 API changes diff --git a/docs/reference/api/docker_remote_api_v1.23.md b/docs/reference/api/docker_remote_api_v1.23.md index 425fe1d3ae..3617e54cff 100644 --- a/docs/reference/api/docker_remote_api_v1.23.md +++ b/docs/reference/api/docker_remote_api_v1.23.md @@ -2128,6 +2128,7 @@ Display system-wide information { "Architecture": "x86_64", + "CgroupDriver": "cgroupfs", "Containers": 11, "ContainersRunning": 7, "ContainersStopped": 3, diff --git a/docs/reference/commandline/info.md b/docs/reference/commandline/info.md index e3cce9bbee..06f7848d5a 100644 --- a/docs/reference/commandline/info.md +++ b/docs/reference/commandline/info.md @@ -33,6 +33,7 @@ For example: Dirperm1 Supported: true Execution Driver: native-0.2 Logging Driver: json-file + Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge null host diff --git a/man/docker-info.1.md b/man/docker-info.1.md index 93004a83c9..1ebcd1a419 100644 --- a/man/docker-info.1.md +++ b/man/docker-info.1.md @@ -42,6 +42,7 @@ Here is a sample output: Dirs: 80 Execution Driver: native-0.2 Logging Driver: json-file + Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge null host