aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/info.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/handlers/compat/info.go')
-rw-r--r--pkg/api/handlers/compat/info.go141
1 files changed, 71 insertions, 70 deletions
diff --git a/pkg/api/handlers/compat/info.go b/pkg/api/handlers/compat/info.go
index 6286fdaee..85547570a 100644
--- a/pkg/api/handlers/compat/info.go
+++ b/pkg/api/handlers/compat/info.go
@@ -53,75 +53,76 @@ func GetInfo(w http.ResponseWriter, r *http.Request) {
// FIXME: Need to expose if runtime supports Checkpointing
// liveRestoreEnabled := criu.CheckForCriu() && configInfo.RuntimeSupportsCheckpoint()
- info := &handlers.Info{Info: docker.Info{
- Architecture: goRuntime.GOARCH,
- BridgeNfIP6tables: !sysInfo.BridgeNFCallIP6TablesDisabled,
- BridgeNfIptables: !sysInfo.BridgeNFCallIPTablesDisabled,
- CPUCfsPeriod: sysInfo.CPUCfsPeriod,
- CPUCfsQuota: sysInfo.CPUCfsQuota,
- CPUSet: sysInfo.Cpuset,
- CPUShares: sysInfo.CPUShares,
- CgroupDriver: configInfo.Engine.CgroupManager,
- ClusterAdvertise: "",
- ClusterStore: "",
- ContainerdCommit: docker.Commit{},
- Containers: infoData.Store.ContainerStore.Number,
- ContainersPaused: stateInfo[define.ContainerStatePaused],
- ContainersRunning: stateInfo[define.ContainerStateRunning],
- ContainersStopped: stateInfo[define.ContainerStateStopped] + stateInfo[define.ContainerStateExited],
- Debug: log.IsLevelEnabled(log.DebugLevel),
- DefaultRuntime: configInfo.Engine.OCIRuntime,
- DockerRootDir: infoData.Store.GraphRoot,
- Driver: infoData.Store.GraphDriverName,
- DriverStatus: getGraphStatus(infoData.Store.GraphStatus),
- ExperimentalBuild: true,
- GenericResources: nil,
- HTTPProxy: getEnv("http_proxy"),
- HTTPSProxy: getEnv("https_proxy"),
- ID: uuid.New().String(),
- IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
- Images: infoData.Store.ImageStore.Number,
- IndexServerAddress: "",
- InitBinary: "",
- InitCommit: docker.Commit{},
- Isolation: "",
- KernelMemoryTCP: false,
- KernelVersion: infoData.Host.Kernel,
- Labels: nil,
- LiveRestoreEnabled: false,
- LoggingDriver: "",
- MemTotal: infoData.Host.MemTotal,
- MemoryLimit: sysInfo.MemoryLimit,
- NCPU: goRuntime.NumCPU(),
- NEventsListener: 0,
- NFd: getFdCount(),
- NGoroutines: goRuntime.NumGoroutine(),
- Name: infoData.Host.Hostname,
- NoProxy: getEnv("no_proxy"),
- OSType: goRuntime.GOOS,
- OSVersion: infoData.Host.Distribution.Version,
- OomKillDisable: sysInfo.OomKillDisable,
- OperatingSystem: infoData.Host.Distribution.Distribution,
- PidsLimit: sysInfo.PidsLimit,
- Plugins: docker.PluginsInfo{
- Volume: infoData.Plugins.Volume,
- Network: infoData.Plugins.Network,
- Log: infoData.Plugins.Log,
+ info := &handlers.Info{
+ Info: docker.Info{
+ Architecture: goRuntime.GOARCH,
+ BridgeNfIP6tables: !sysInfo.BridgeNFCallIP6TablesDisabled,
+ BridgeNfIptables: !sysInfo.BridgeNFCallIPTablesDisabled,
+ CPUCfsPeriod: sysInfo.CPUCfsPeriod,
+ CPUCfsQuota: sysInfo.CPUCfsQuota,
+ CPUSet: sysInfo.Cpuset,
+ CPUShares: sysInfo.CPUShares,
+ CgroupDriver: configInfo.Engine.CgroupManager,
+ ClusterAdvertise: "",
+ ClusterStore: "",
+ ContainerdCommit: docker.Commit{},
+ Containers: infoData.Store.ContainerStore.Number,
+ ContainersPaused: stateInfo[define.ContainerStatePaused],
+ ContainersRunning: stateInfo[define.ContainerStateRunning],
+ ContainersStopped: stateInfo[define.ContainerStateStopped] + stateInfo[define.ContainerStateExited],
+ Debug: log.IsLevelEnabled(log.DebugLevel),
+ DefaultRuntime: configInfo.Engine.OCIRuntime,
+ DockerRootDir: infoData.Store.GraphRoot,
+ Driver: infoData.Store.GraphDriverName,
+ DriverStatus: getGraphStatus(infoData.Store.GraphStatus),
+ ExperimentalBuild: true,
+ GenericResources: nil,
+ HTTPProxy: getEnv("http_proxy"),
+ HTTPSProxy: getEnv("https_proxy"),
+ ID: uuid.New().String(),
+ IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
+ Images: infoData.Store.ImageStore.Number,
+ IndexServerAddress: "",
+ InitBinary: "",
+ InitCommit: docker.Commit{},
+ Isolation: "",
+ KernelMemoryTCP: false,
+ KernelVersion: infoData.Host.Kernel,
+ Labels: nil,
+ LiveRestoreEnabled: false,
+ LoggingDriver: "",
+ MemTotal: infoData.Host.MemTotal,
+ MemoryLimit: sysInfo.MemoryLimit,
+ NCPU: goRuntime.NumCPU(),
+ NEventsListener: 0,
+ NFd: getFdCount(),
+ NGoroutines: goRuntime.NumGoroutine(),
+ Name: infoData.Host.Hostname,
+ NoProxy: getEnv("no_proxy"),
+ OSType: goRuntime.GOOS,
+ OSVersion: infoData.Host.Distribution.Version,
+ OomKillDisable: sysInfo.OomKillDisable,
+ OperatingSystem: infoData.Host.Distribution.Distribution,
+ PidsLimit: sysInfo.PidsLimit,
+ Plugins: docker.PluginsInfo{
+ Volume: infoData.Plugins.Volume,
+ Network: infoData.Plugins.Network,
+ Log: infoData.Plugins.Log,
+ },
+ ProductLicense: "Apache-2.0",
+ RegistryConfig: getServiceConfig(runtime),
+ RuncCommit: docker.Commit{},
+ Runtimes: getRuntimes(configInfo),
+ SecurityOptions: getSecOpts(sysInfo),
+ ServerVersion: versionInfo.Version,
+ SwapLimit: sysInfo.SwapLimit,
+ Swarm: swarm.Info{
+ LocalNodeState: swarm.LocalNodeStateInactive,
+ },
+ SystemStatus: nil,
+ SystemTime: time.Now().Format(time.RFC3339Nano),
+ Warnings: []string{},
},
- ProductLicense: "Apache-2.0",
- RegistryConfig: getServiceConfig(runtime),
- RuncCommit: docker.Commit{},
- Runtimes: getRuntimes(configInfo),
- SecurityOptions: getSecOpts(sysInfo),
- ServerVersion: versionInfo.Version,
- SwapLimit: sysInfo.SwapLimit,
- Swarm: swarm.Info{
- LocalNodeState: swarm.LocalNodeStateInactive,
- },
- SystemStatus: nil,
- SystemTime: time.Now().Format(time.RFC3339Nano),
- Warnings: []string{},
- },
BuildahVersion: infoData.Host.BuildahVersion,
CPURealtimePeriod: sysInfo.CPURealtimePeriod,
CPURealtimeRuntime: sysInfo.CPURealtimeRuntime,
@@ -186,7 +187,7 @@ func getSecOpts(sysInfo *sysinfo.SysInfo) []string {
}
func getRuntimes(configInfo *config.Config) map[string]docker.Runtime {
- var runtimes = map[string]docker.Runtime{}
+ runtimes := map[string]docker.Runtime{}
for name, paths := range configInfo.Engine.OCIRuntimes {
runtimes[name] = docker.Runtime{
Path: paths[0],
@@ -206,7 +207,7 @@ func getFdCount() (count int) {
// Just ignoring Container errors here...
func getContainersState(r *libpod.Runtime) map[define.ContainerStatus]int {
- var states = map[define.ContainerStatus]int{}
+ states := map[define.ContainerStatus]int{}
ctnrs, err := r.GetAllContainers()
if err == nil {
for _, ctnr := range ctnrs {