|
@@ -25,70 +25,9 @@ import (
|
|
|
|
|
|
// SystemInfo returns information about the host server the daemon is running on.
|
|
// SystemInfo returns information about the host server the daemon is running on.
|
|
func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|
func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|
- kernelVersion := "<unknown>"
|
|
|
|
- if kv, err := kernel.GetKernelVersion(); err != nil {
|
|
|
|
- logrus.Warnf("Could not get kernel version: %v", err)
|
|
|
|
- } else {
|
|
|
|
- kernelVersion = kv.String()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- operatingSystem := "<unknown>"
|
|
|
|
- if s, err := operatingsystem.GetOperatingSystem(); err != nil {
|
|
|
|
- logrus.Warnf("Could not get operating system name: %v", err)
|
|
|
|
- } else {
|
|
|
|
- operatingSystem = s
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Don't do containerized check on Windows
|
|
|
|
- if runtime.GOOS != "windows" {
|
|
|
|
- if inContainer, err := operatingsystem.IsContainerized(); err != nil {
|
|
|
|
- logrus.Errorf("Could not determine if daemon is containerized: %v", err)
|
|
|
|
- operatingSystem += " (error determining if containerized)"
|
|
|
|
- } else if inContainer {
|
|
|
|
- operatingSystem += " (containerized)"
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- meminfo, err := system.ReadMemInfo()
|
|
|
|
- if err != nil {
|
|
|
|
- logrus.Errorf("Could not read system memory info: %v", err)
|
|
|
|
- meminfo = &system.MemInfo{}
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
sysInfo := sysinfo.New(true)
|
|
sysInfo := sysinfo.New(true)
|
|
cRunning, cPaused, cStopped := stateCtr.get()
|
|
cRunning, cPaused, cStopped := stateCtr.get()
|
|
|
|
|
|
- securityOptions := []string{}
|
|
|
|
- if sysInfo.AppArmor {
|
|
|
|
- securityOptions = append(securityOptions, "name=apparmor")
|
|
|
|
- }
|
|
|
|
- if sysInfo.Seccomp && supportsSeccomp {
|
|
|
|
- profile := daemon.seccompProfilePath
|
|
|
|
- if profile == "" {
|
|
|
|
- profile = "default"
|
|
|
|
- }
|
|
|
|
- securityOptions = append(securityOptions, fmt.Sprintf("name=seccomp,profile=%s", profile))
|
|
|
|
- }
|
|
|
|
- if selinuxEnabled() {
|
|
|
|
- securityOptions = append(securityOptions, "name=selinux")
|
|
|
|
- }
|
|
|
|
- rootIDs := daemon.idMappings.RootPair()
|
|
|
|
- if rootIDs.UID != 0 || rootIDs.GID != 0 {
|
|
|
|
- securityOptions = append(securityOptions, "name=userns")
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var ds [][2]string
|
|
|
|
- drivers := ""
|
|
|
|
- statuses := daemon.imageService.LayerStoreStatus()
|
|
|
|
- for os, gd := range daemon.graphDrivers {
|
|
|
|
- ds = append(ds, statuses[os]...)
|
|
|
|
- drivers += gd
|
|
|
|
- if len(daemon.graphDrivers) > 1 {
|
|
|
|
- drivers += fmt.Sprintf(" (%s) ", os)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- drivers = strings.TrimSpace(drivers)
|
|
|
|
-
|
|
|
|
v := &types.Info{
|
|
v := &types.Info{
|
|
ID: daemon.ID,
|
|
ID: daemon.ID,
|
|
Containers: cRunning + cPaused + cStopped,
|
|
Containers: cRunning + cPaused + cStopped,
|
|
@@ -96,27 +35,25 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|
ContainersPaused: cPaused,
|
|
ContainersPaused: cPaused,
|
|
ContainersStopped: cStopped,
|
|
ContainersStopped: cStopped,
|
|
Images: daemon.imageService.CountImages(),
|
|
Images: daemon.imageService.CountImages(),
|
|
- Driver: drivers,
|
|
|
|
- DriverStatus: ds,
|
|
|
|
- Plugins: daemon.showPluginsInfo(),
|
|
|
|
IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
|
|
IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
|
|
BridgeNfIptables: !sysInfo.BridgeNFCallIPTablesDisabled,
|
|
BridgeNfIptables: !sysInfo.BridgeNFCallIPTablesDisabled,
|
|
BridgeNfIP6tables: !sysInfo.BridgeNFCallIP6TablesDisabled,
|
|
BridgeNfIP6tables: !sysInfo.BridgeNFCallIP6TablesDisabled,
|
|
Debug: debug.IsEnabled(),
|
|
Debug: debug.IsEnabled(),
|
|
|
|
+ Name: hostName(),
|
|
NFd: fileutils.GetTotalUsedFds(),
|
|
NFd: fileutils.GetTotalUsedFds(),
|
|
NGoroutines: runtime.NumGoroutine(),
|
|
NGoroutines: runtime.NumGoroutine(),
|
|
SystemTime: time.Now().Format(time.RFC3339Nano),
|
|
SystemTime: time.Now().Format(time.RFC3339Nano),
|
|
LoggingDriver: daemon.defaultLogConfig.Type,
|
|
LoggingDriver: daemon.defaultLogConfig.Type,
|
|
CgroupDriver: daemon.getCgroupDriver(),
|
|
CgroupDriver: daemon.getCgroupDriver(),
|
|
NEventsListener: daemon.EventsService.SubscribersCount(),
|
|
NEventsListener: daemon.EventsService.SubscribersCount(),
|
|
- KernelVersion: kernelVersion,
|
|
|
|
- OperatingSystem: operatingSystem,
|
|
|
|
|
|
+ KernelVersion: kernelVersion(),
|
|
|
|
+ OperatingSystem: operatingSystem(),
|
|
IndexServerAddress: registry.IndexServer,
|
|
IndexServerAddress: registry.IndexServer,
|
|
OSType: platform.OSType,
|
|
OSType: platform.OSType,
|
|
Architecture: platform.Architecture,
|
|
Architecture: platform.Architecture,
|
|
RegistryConfig: daemon.RegistryService.ServiceConfig(),
|
|
RegistryConfig: daemon.RegistryService.ServiceConfig(),
|
|
NCPU: sysinfo.NumCPU(),
|
|
NCPU: sysinfo.NumCPU(),
|
|
- MemTotal: meminfo.MemTotal,
|
|
|
|
|
|
+ MemTotal: memInfo().MemTotal,
|
|
GenericResources: daemon.genericResources,
|
|
GenericResources: daemon.genericResources,
|
|
DockerRootDir: daemon.configStore.Root,
|
|
DockerRootDir: daemon.configStore.Root,
|
|
Labels: daemon.configStore.Labels,
|
|
Labels: daemon.configStore.Labels,
|
|
@@ -128,32 +65,21 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|
HTTPSProxy: sockets.GetProxyEnv("https_proxy"),
|
|
HTTPSProxy: sockets.GetProxyEnv("https_proxy"),
|
|
NoProxy: sockets.GetProxyEnv("no_proxy"),
|
|
NoProxy: sockets.GetProxyEnv("no_proxy"),
|
|
LiveRestoreEnabled: daemon.configStore.LiveRestoreEnabled,
|
|
LiveRestoreEnabled: daemon.configStore.LiveRestoreEnabled,
|
|
- SecurityOptions: securityOptions,
|
|
|
|
Isolation: daemon.defaultIsolation,
|
|
Isolation: daemon.defaultIsolation,
|
|
}
|
|
}
|
|
|
|
|
|
// Retrieve platform specific info
|
|
// Retrieve platform specific info
|
|
daemon.FillPlatformInfo(v, sysInfo)
|
|
daemon.FillPlatformInfo(v, sysInfo)
|
|
-
|
|
|
|
- hostname := ""
|
|
|
|
- if hn, err := os.Hostname(); err != nil {
|
|
|
|
- logrus.Warnf("Could not get hostname: %v", err)
|
|
|
|
- } else {
|
|
|
|
- hostname = hn
|
|
|
|
- }
|
|
|
|
- v.Name = hostname
|
|
|
|
|
|
+ daemon.fillDriverInfo(v)
|
|
|
|
+ daemon.fillPluginsInfo(v)
|
|
|
|
+ daemon.fillSecurityOptions(v, sysInfo)
|
|
|
|
|
|
return v, nil
|
|
return v, nil
|
|
}
|
|
}
|
|
|
|
|
|
// SystemVersion returns version information about the daemon.
|
|
// SystemVersion returns version information about the daemon.
|
|
func (daemon *Daemon) SystemVersion() types.Version {
|
|
func (daemon *Daemon) SystemVersion() types.Version {
|
|
- kernelVersion := "<unknown>"
|
|
|
|
- if kv, err := kernel.GetKernelVersion(); err != nil {
|
|
|
|
- logrus.Warnf("Could not get kernel version: %v", err)
|
|
|
|
- } else {
|
|
|
|
- kernelVersion = kv.String()
|
|
|
|
- }
|
|
|
|
|
|
+ kernelVersion := kernelVersion()
|
|
|
|
|
|
v := types.Version{
|
|
v := types.Version{
|
|
Components: []types.ComponentVersion{
|
|
Components: []types.ComponentVersion{
|
|
@@ -192,15 +118,100 @@ func (daemon *Daemon) SystemVersion() types.Version {
|
|
return v
|
|
return v
|
|
}
|
|
}
|
|
|
|
|
|
-func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {
|
|
|
|
- var pluginsInfo types.PluginsInfo
|
|
|
|
|
|
+func (daemon *Daemon) fillDriverInfo(v *types.Info) {
|
|
|
|
+ var ds [][2]string
|
|
|
|
+ drivers := ""
|
|
|
|
+ statuses := daemon.imageService.LayerStoreStatus()
|
|
|
|
+ for os, gd := range daemon.graphDrivers {
|
|
|
|
+ ds = append(ds, statuses[os]...)
|
|
|
|
+ drivers += gd
|
|
|
|
+ if len(daemon.graphDrivers) > 1 {
|
|
|
|
+ drivers += fmt.Sprintf(" (%s) ", os)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ drivers = strings.TrimSpace(drivers)
|
|
|
|
|
|
- pluginsInfo.Volume = daemon.volumes.GetDriverList()
|
|
|
|
- pluginsInfo.Network = daemon.GetNetworkDriverList()
|
|
|
|
- // The authorization plugins are returned in the order they are
|
|
|
|
- // used as they constitute a request/response modification chain.
|
|
|
|
- pluginsInfo.Authorization = daemon.configStore.AuthorizationPlugins
|
|
|
|
- pluginsInfo.Log = logger.ListDrivers()
|
|
|
|
|
|
+ v.Driver = drivers
|
|
|
|
+ v.DriverStatus = ds
|
|
|
|
+}
|
|
|
|
|
|
- return pluginsInfo
|
|
|
|
|
|
+func (daemon *Daemon) fillPluginsInfo(v *types.Info) {
|
|
|
|
+ v.Plugins = types.PluginsInfo{
|
|
|
|
+ Volume: daemon.volumes.GetDriverList(),
|
|
|
|
+ Network: daemon.GetNetworkDriverList(),
|
|
|
|
+
|
|
|
|
+ // The authorization plugins are returned in the order they are
|
|
|
|
+ // used as they constitute a request/response modification chain.
|
|
|
|
+ Authorization: daemon.configStore.AuthorizationPlugins,
|
|
|
|
+ Log: logger.ListDrivers(),
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (daemon *Daemon) fillSecurityOptions(v *types.Info, sysInfo *sysinfo.SysInfo) {
|
|
|
|
+ var securityOptions []string
|
|
|
|
+ if sysInfo.AppArmor {
|
|
|
|
+ securityOptions = append(securityOptions, "name=apparmor")
|
|
|
|
+ }
|
|
|
|
+ if sysInfo.Seccomp && supportsSeccomp {
|
|
|
|
+ profile := daemon.seccompProfilePath
|
|
|
|
+ if profile == "" {
|
|
|
|
+ profile = "default"
|
|
|
|
+ }
|
|
|
|
+ securityOptions = append(securityOptions, fmt.Sprintf("name=seccomp,profile=%s", profile))
|
|
|
|
+ }
|
|
|
|
+ if selinuxEnabled() {
|
|
|
|
+ securityOptions = append(securityOptions, "name=selinux")
|
|
|
|
+ }
|
|
|
|
+ if rootIDs := daemon.idMappings.RootPair(); rootIDs.UID != 0 || rootIDs.GID != 0 {
|
|
|
|
+ securityOptions = append(securityOptions, "name=userns")
|
|
|
|
+ }
|
|
|
|
+ v.SecurityOptions = securityOptions
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func hostName() string {
|
|
|
|
+ hostname := ""
|
|
|
|
+ if hn, err := os.Hostname(); err != nil {
|
|
|
|
+ logrus.Warnf("Could not get hostname: %v", err)
|
|
|
|
+ } else {
|
|
|
|
+ hostname = hn
|
|
|
|
+ }
|
|
|
|
+ return hostname
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func kernelVersion() string {
|
|
|
|
+ kernelVersion := "<unknown>"
|
|
|
|
+ if kv, err := kernel.GetKernelVersion(); err != nil {
|
|
|
|
+ logrus.Warnf("Could not get kernel version: %v", err)
|
|
|
|
+ } else {
|
|
|
|
+ kernelVersion = kv.String()
|
|
|
|
+ }
|
|
|
|
+ return kernelVersion
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func memInfo() *system.MemInfo {
|
|
|
|
+ memInfo, err := system.ReadMemInfo()
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.Errorf("Could not read system memory info: %v", err)
|
|
|
|
+ memInfo = &system.MemInfo{}
|
|
|
|
+ }
|
|
|
|
+ return memInfo
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func operatingSystem() string {
|
|
|
|
+ operatingSystem := "<unknown>"
|
|
|
|
+ if s, err := operatingsystem.GetOperatingSystem(); err != nil {
|
|
|
|
+ logrus.Warnf("Could not get operating system name: %v", err)
|
|
|
|
+ } else {
|
|
|
|
+ operatingSystem = s
|
|
|
|
+ }
|
|
|
|
+ // Don't do containerized check on Windows
|
|
|
|
+ if runtime.GOOS != "windows" {
|
|
|
|
+ if inContainer, err := operatingsystem.IsContainerized(); err != nil {
|
|
|
|
+ logrus.Errorf("Could not determine if daemon is containerized: %v", err)
|
|
|
|
+ operatingSystem += " (error determining if containerized)"
|
|
|
|
+ } else if inContainer {
|
|
|
|
+ operatingSystem += " (containerized)"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return operatingSystem
|
|
}
|
|
}
|