mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon: SystemInfo() extract container counts to a helper function
This makes it more inline with other data we collect, and can be used to make some info optional at some point. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e8a0a545e7
commit
a27f8aecad
1 changed files with 9 additions and 5 deletions
|
@ -30,14 +30,9 @@ func (daemon *Daemon) SystemInfo() *types.Info {
|
|||
defer metrics.StartTimer(hostInfoFunctions.WithValues("system_info"))()
|
||||
|
||||
sysInfo := daemon.RawSysInfo()
|
||||
cRunning, cPaused, cStopped := stateCtr.get()
|
||||
|
||||
v := &types.Info{
|
||||
ID: daemon.ID,
|
||||
Containers: cRunning + cPaused + cStopped,
|
||||
ContainersRunning: cRunning,
|
||||
ContainersPaused: cPaused,
|
||||
ContainersStopped: cStopped,
|
||||
Images: daemon.imageService.CountImages(),
|
||||
IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
|
||||
BridgeNfIptables: !sysInfo.BridgeNFCallIPTablesDisabled,
|
||||
|
@ -70,6 +65,7 @@ func (daemon *Daemon) SystemInfo() *types.Info {
|
|||
Isolation: daemon.defaultIsolation,
|
||||
}
|
||||
|
||||
daemon.fillContainerStates(v)
|
||||
daemon.fillAPIInfo(v)
|
||||
// Retrieve platform specific info
|
||||
daemon.fillPlatformInfo(v, sysInfo)
|
||||
|
@ -181,6 +177,14 @@ func (daemon *Daemon) fillSecurityOptions(v *types.Info, sysInfo *sysinfo.SysInf
|
|||
v.SecurityOptions = securityOptions
|
||||
}
|
||||
|
||||
func (daemon *Daemon) fillContainerStates(v *types.Info) {
|
||||
cRunning, cPaused, cStopped := stateCtr.get()
|
||||
v.Containers = cRunning + cPaused + cStopped
|
||||
v.ContainersPaused = cPaused
|
||||
v.ContainersRunning = cRunning
|
||||
v.ContainersStopped = cStopped
|
||||
}
|
||||
|
||||
func (daemon *Daemon) fillAPIInfo(v *types.Info) {
|
||||
const warn string = `
|
||||
Access to the remote API is equivalent to root access on the host. Refer
|
||||
|
|
Loading…
Reference in a new issue