Add logdrivers to /info
This is required for swarmkit to be able to filter based on log driver. Signed-off-by: Brian Goff <cpuguy83@gmail.com> Upstream-commit: 17abacb8946ed89496fcbf07a0288fafe24cb7b0 Component: engine
This commit is contained in:
@@ -52,6 +52,7 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
||||
// the plugin list by default.
|
||||
addPlugins("Network", append([]string{"overlay"}, info.Plugins.Network...))
|
||||
addPlugins("Authorization", info.Plugins.Authorization)
|
||||
addPlugins("Log", info.Plugins.Log)
|
||||
|
||||
// add v2 plugins
|
||||
v2Plugins, err := e.backend.PluginManager().List(filters.NewArgs())
|
||||
@@ -62,11 +63,15 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
||||
continue
|
||||
}
|
||||
plgnTyp := typ.Capability
|
||||
if typ.Capability == "volumedriver" {
|
||||
switch typ.Capability {
|
||||
case "volumedriver":
|
||||
plgnTyp = "Volume"
|
||||
} else if typ.Capability == "networkdriver" {
|
||||
case "networkdriver":
|
||||
plgnTyp = "Network"
|
||||
case "logdriver":
|
||||
plgnTyp = "Log"
|
||||
}
|
||||
|
||||
plugins[api.PluginDescription{
|
||||
Type: plgnTyp,
|
||||
Name: plgn.Name,
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/cli/debug"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/logger"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
@@ -175,6 +176,7 @@ func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {
|
||||
pluginsInfo.Volume = volumedrivers.GetDriverList()
|
||||
pluginsInfo.Network = daemon.GetNetworkDriverList()
|
||||
pluginsInfo.Authorization = daemon.configStore.GetAuthorizationPlugins()
|
||||
pluginsInfo.Log = logger.ListDrivers()
|
||||
|
||||
return pluginsInfo
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package logger
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
@@ -23,6 +24,22 @@ type logdriverFactory struct {
|
||||
m sync.Mutex
|
||||
}
|
||||
|
||||
func (lf *logdriverFactory) list() []string {
|
||||
ls := make([]string, 0, len(lf.registry))
|
||||
lf.m.Lock()
|
||||
for name := range lf.registry {
|
||||
ls = append(ls, name)
|
||||
}
|
||||
lf.m.Unlock()
|
||||
sort.Strings(ls)
|
||||
return ls
|
||||
}
|
||||
|
||||
// ListDrivers gets the list of registered log driver names
|
||||
func ListDrivers() []string {
|
||||
return factory.list()
|
||||
}
|
||||
|
||||
func (lf *logdriverFactory) register(name string, c Creator) error {
|
||||
if lf.driverRegistered(name) {
|
||||
return fmt.Errorf("logger: log driver named '%s' is already registered", name)
|
||||
|
||||
Reference in New Issue
Block a user