From 8086443a449af8ef5c5b0574de8957df7e52f296 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 19 Jan 2021 15:07:08 +0900 Subject: [PATCH 1/2] docker info: silence unhandleable warnings The following warnings in `docker info` are now discarded, because there is no action user can actually take. On cgroup v1: - "WARNING: No blkio weight support" - "WARNING: No blkio weight_device support" On cgroup v2: - "WARNING: No kernel memory TCP limit support" - "WARNING: No oom kill disable support" `docker run` still prints warnings when the missing feature is being attempted to use. Signed-off-by: Akihiro Suda --- daemon/info_unix.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/daemon/info_unix.go b/daemon/info_unix.go index 7a71ff28da..1b25b51266 100644 --- a/daemon/info_unix.go +++ b/daemon/info_unix.go @@ -100,10 +100,14 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo) if !v.SwapLimit { v.Warnings = append(v.Warnings, "WARNING: No swap limit support") } - if !v.KernelMemoryTCP { + if !v.KernelMemoryTCP && v.CgroupVersion == "1" { + // kernel memory is not available for cgroup v2. + // Warning is not printed on cgroup v2, because there is no action user can take. v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support") } - if !v.OomKillDisable { + if !v.OomKillDisable && v.CgroupVersion == "1" { + // oom kill disable is not available for cgroup v2. + // Warning is not printed on cgroup v2, because there is no action user can take. v.Warnings = append(v.Warnings, "WARNING: No oom kill disable support") } if !v.CPUCfsQuota { @@ -122,10 +126,13 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo) v.Warnings = append(v.Warnings, "WARNING: Support for cgroup v2 is experimental") } // TODO add fields for these options in types.Info - if !sysInfo.BlkioWeight { + if !sysInfo.BlkioWeight && v.CgroupVersion == "2" { + // blkio weight is not available on cgroup v1 since kernel 5.0. + // Warning is not printed on cgroup v1, because there is no action user can take. + // On cgroup v2, blkio weight is implemented using io.weight v.Warnings = append(v.Warnings, "WARNING: No blkio weight support") } - if !sysInfo.BlkioWeightDevice { + if !sysInfo.BlkioWeightDevice && v.CgroupVersion == "2" { v.Warnings = append(v.Warnings, "WARNING: No blkio weight_device support") } if !sysInfo.BlkioReadBpsDevice { From 00225e220fb18283dcf9e4fa6625fad6746d8a50 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Wed, 20 Jan 2021 13:42:32 +0900 Subject: [PATCH 2/2] docker info: adjust warning strings for cgroup v2 Signed-off-by: Akihiro Suda --- daemon/info_unix.go | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/daemon/info_unix.go b/daemon/info_unix.go index 1b25b51266..56c920990b 100644 --- a/daemon/info_unix.go +++ b/daemon/info_unix.go @@ -130,22 +130,38 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo) // blkio weight is not available on cgroup v1 since kernel 5.0. // Warning is not printed on cgroup v1, because there is no action user can take. // On cgroup v2, blkio weight is implemented using io.weight - v.Warnings = append(v.Warnings, "WARNING: No blkio weight support") + v.Warnings = append(v.Warnings, "WARNING: No io.weight support") } if !sysInfo.BlkioWeightDevice && v.CgroupVersion == "2" { - v.Warnings = append(v.Warnings, "WARNING: No blkio weight_device support") + v.Warnings = append(v.Warnings, "WARNING: No io.weight (per device) support") } if !sysInfo.BlkioReadBpsDevice { - v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.read_bps_device support") + if v.CgroupVersion == "2" { + v.Warnings = append(v.Warnings, "WARNING: No io.max (rbps) support") + } else { + v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.read_bps_device support") + } } if !sysInfo.BlkioWriteBpsDevice { - v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.write_bps_device support") + if v.CgroupVersion == "2" { + v.Warnings = append(v.Warnings, "WARNING: No io.max (wbps) support") + } else { + v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.write_bps_device support") + } } if !sysInfo.BlkioReadIOpsDevice { - v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.read_iops_device support") + if v.CgroupVersion == "2" { + v.Warnings = append(v.Warnings, "WARNING: No io.max (riops) support") + } else { + v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.read_iops_device support") + } } if !sysInfo.BlkioWriteIOpsDevice { - v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.write_iops_device support") + if v.CgroupVersion == "2" { + v.Warnings = append(v.Warnings, "WARNING: No io.max (wiops) support") + } else { + v.Warnings = append(v.Warnings, "WARNING: No blkio throttle.write_iops_device support") + } } } if !v.IPv4Forwarding {