mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #17300 from kunalkushwaha/plugin-info
Patch for Plugin drivers in docker info
This commit is contained in:
commit
f18d5da6a7
8 changed files with 79 additions and 0 deletions
|
@ -44,6 +44,19 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
||||||
}
|
}
|
||||||
ioutils.FprintfIfNotEmpty(cli.out, "Execution Driver: %s\n", info.ExecutionDriver)
|
ioutils.FprintfIfNotEmpty(cli.out, "Execution Driver: %s\n", info.ExecutionDriver)
|
||||||
ioutils.FprintfIfNotEmpty(cli.out, "Logging Driver: %s\n", info.LoggingDriver)
|
ioutils.FprintfIfNotEmpty(cli.out, "Logging Driver: %s\n", info.LoggingDriver)
|
||||||
|
|
||||||
|
fmt.Fprintf(cli.out, "Plugins: \n")
|
||||||
|
fmt.Fprintf(cli.out, " Volume:")
|
||||||
|
for _, driver := range info.Plugins.Volume {
|
||||||
|
fmt.Fprintf(cli.out, " %s", driver)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(cli.out, "\n")
|
||||||
|
fmt.Fprintf(cli.out, " Network:")
|
||||||
|
for _, driver := range info.Plugins.Network {
|
||||||
|
fmt.Fprintf(cli.out, " %s", driver)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(cli.out, "\n")
|
||||||
|
|
||||||
ioutils.FprintfIfNotEmpty(cli.out, "Kernel Version: %s\n", info.KernelVersion)
|
ioutils.FprintfIfNotEmpty(cli.out, "Kernel Version: %s\n", info.KernelVersion)
|
||||||
ioutils.FprintfIfNotEmpty(cli.out, "Operating System: %s\n", info.OperatingSystem)
|
ioutils.FprintfIfNotEmpty(cli.out, "Operating System: %s\n", info.OperatingSystem)
|
||||||
fmt.Fprintf(cli.out, "CPUs: %d\n", info.NCPU)
|
fmt.Fprintf(cli.out, "CPUs: %d\n", info.NCPU)
|
||||||
|
|
|
@ -188,6 +188,7 @@ type Info struct {
|
||||||
Images int
|
Images int
|
||||||
Driver string
|
Driver string
|
||||||
DriverStatus [][2]string
|
DriverStatus [][2]string
|
||||||
|
Plugins PluginsInfo
|
||||||
MemoryLimit bool
|
MemoryLimit bool
|
||||||
SwapLimit bool
|
SwapLimit bool
|
||||||
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
||||||
|
@ -225,6 +226,15 @@ type Info struct {
|
||||||
ClusterAdvertise string
|
ClusterAdvertise string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PluginsInfo is temp struct holds Plugins name
|
||||||
|
// registered with docker daemon. It used by Info struct
|
||||||
|
type PluginsInfo struct {
|
||||||
|
// List of Volume plugins registered
|
||||||
|
Volume []string
|
||||||
|
// List of Network plugins registered
|
||||||
|
Network []string
|
||||||
|
}
|
||||||
|
|
||||||
// ExecStartCheck is a temp struct used by execStart
|
// ExecStartCheck is a temp struct used by execStart
|
||||||
// Config fields is part of ExecConfig in runconfig package
|
// Config fields is part of ExecConfig in runconfig package
|
||||||
type ExecStartCheck struct {
|
type ExecStartCheck struct {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
"github.com/docker/docker/registry"
|
"github.com/docker/docker/registry"
|
||||||
"github.com/docker/docker/utils"
|
"github.com/docker/docker/utils"
|
||||||
|
"github.com/docker/docker/volume/drivers"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemInfo returns information about the host server the daemon is running on.
|
// SystemInfo returns information about the host server the daemon is running on.
|
||||||
|
@ -62,6 +63,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
||||||
Images: len(daemon.Graph().Map()),
|
Images: len(daemon.Graph().Map()),
|
||||||
Driver: daemon.GraphDriver().String(),
|
Driver: daemon.GraphDriver().String(),
|
||||||
DriverStatus: daemon.GraphDriver().Status(),
|
DriverStatus: daemon.GraphDriver().Status(),
|
||||||
|
Plugins: daemon.showPluginsInfo(),
|
||||||
IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
|
IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
|
||||||
BridgeNfIptables: !sysInfo.BridgeNfCallIptablesDisabled,
|
BridgeNfIptables: !sysInfo.BridgeNfCallIptablesDisabled,
|
||||||
BridgeNfIP6tables: !sysInfo.BridgeNfCallIP6tablesDisabled,
|
BridgeNfIP6tables: !sysInfo.BridgeNfCallIP6tablesDisabled,
|
||||||
|
@ -111,3 +113,16 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
||||||
|
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {
|
||||||
|
var pluginsInfo types.PluginsInfo
|
||||||
|
|
||||||
|
pluginsInfo.Volume = volumedrivers.GetDriverList()
|
||||||
|
|
||||||
|
networkDriverList := daemon.GetNetworkDriverList()
|
||||||
|
for nd := range networkDriverList {
|
||||||
|
pluginsInfo.Network = append(pluginsInfo.Network, nd)
|
||||||
|
}
|
||||||
|
|
||||||
|
return pluginsInfo
|
||||||
|
}
|
||||||
|
|
|
@ -146,3 +146,19 @@ func (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, netwo
|
||||||
}
|
}
|
||||||
return container.DisconnectFromNetwork(network)
|
return container.DisconnectFromNetwork(network)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetNetworkDriverList returns the list of plugins drivers
|
||||||
|
// registered for network.
|
||||||
|
func (daemon *Daemon) GetNetworkDriverList() map[string]bool {
|
||||||
|
pluginList := make(map[string]bool)
|
||||||
|
|
||||||
|
c := daemon.netController
|
||||||
|
networks := c.Networks()
|
||||||
|
|
||||||
|
for _, network := range networks {
|
||||||
|
driver := network.Type()
|
||||||
|
pluginList[driver] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return pluginList
|
||||||
|
}
|
||||||
|
|
|
@ -1891,6 +1891,16 @@ Display system-wide information
|
||||||
"DockerRootDir": "/var/lib/docker",
|
"DockerRootDir": "/var/lib/docker",
|
||||||
"Driver": "btrfs",
|
"Driver": "btrfs",
|
||||||
"DriverStatus": [[""]],
|
"DriverStatus": [[""]],
|
||||||
|
"Plugins": {
|
||||||
|
"Volume": [
|
||||||
|
"local"
|
||||||
|
],
|
||||||
|
"Network": [
|
||||||
|
"null",
|
||||||
|
"host",
|
||||||
|
"bridge"
|
||||||
|
]
|
||||||
|
},
|
||||||
"ExecutionDriver": "native-0.1",
|
"ExecutionDriver": "native-0.1",
|
||||||
"ExperimentalBuild": false,
|
"ExperimentalBuild": false,
|
||||||
"HttpProxy": "http://test:test@localhost:8080",
|
"HttpProxy": "http://test:test@localhost:8080",
|
||||||
|
|
|
@ -25,6 +25,8 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
|
||||||
"Total Memory:",
|
"Total Memory:",
|
||||||
"Kernel Version:",
|
"Kernel Version:",
|
||||||
"Storage Driver:",
|
"Storage Driver:",
|
||||||
|
"Volume:",
|
||||||
|
"Network:",
|
||||||
}
|
}
|
||||||
|
|
||||||
if utils.ExperimentalBuild() {
|
if utils.ExperimentalBuild() {
|
||||||
|
|
|
@ -39,6 +39,9 @@ Here is a sample output:
|
||||||
Dirs: 80
|
Dirs: 80
|
||||||
Execution Driver: native-0.2
|
Execution Driver: native-0.2
|
||||||
Logging Driver: json-file
|
Logging Driver: json-file
|
||||||
|
Plugins:
|
||||||
|
Volume: local
|
||||||
|
Network: bridge null host
|
||||||
Kernel Version: 3.13.0-24-generic
|
Kernel Version: 3.13.0-24-generic
|
||||||
Operating System: Ubuntu 14.04 LTS
|
Operating System: Ubuntu 14.04 LTS
|
||||||
CPUs: 1
|
CPUs: 1
|
||||||
|
|
|
@ -106,3 +106,13 @@ func GetDriver(name string) (volume.Driver, error) {
|
||||||
}
|
}
|
||||||
return Lookup(name)
|
return Lookup(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDriverList returns list of volume drivers registered.
|
||||||
|
// If no driver is registered, empty string list will be returned.
|
||||||
|
func GetDriverList() []string {
|
||||||
|
var driverList []string
|
||||||
|
for driverName := range drivers.extensions {
|
||||||
|
driverList = append(driverList, driverName)
|
||||||
|
}
|
||||||
|
return driverList
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue