Merge pull request #1599 from mavenugo/v0.9
Make use of GetAllManagedPluginsForCap to avoid loading v1-plugins
This commit is contained in:
commit
f2f0212cab
|
@ -143,8 +143,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/plugingetter",
|
"ImportPath": "github.com/docker/docker/pkg/plugingetter",
|
||||||
"Comment": "docs-v1.12.0-rc4-2016-07-15-1985-gfebf53d",
|
"Comment": "docs-v1.12.0-rc4-2016-07-15-4185-ge4512d2",
|
||||||
"Rev": "febf53d91a43fe13fbb802d9e6b7b6732183cf21"
|
"Rev": "e4512d264741e83e954a19f9ef5e3cb06c5856b6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/plugins",
|
"ImportPath": "github.com/docker/docker/pkg/plugins",
|
||||||
|
|
19
libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/plugingetter/getter.go
generated
vendored
19
libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/plugingetter/getter.go
generated
vendored
|
@ -5,22 +5,31 @@ import "github.com/docker/docker/pkg/plugins"
|
||||||
const (
|
const (
|
||||||
// LOOKUP doesn't update RefCount
|
// LOOKUP doesn't update RefCount
|
||||||
LOOKUP = 0
|
LOOKUP = 0
|
||||||
// CREATE increments RefCount
|
// ACQUIRE increments RefCount
|
||||||
CREATE = 1
|
ACQUIRE = 1
|
||||||
// REMOVE decrements RefCount
|
// RELEASE decrements RefCount
|
||||||
REMOVE = -1
|
RELEASE = -1
|
||||||
)
|
)
|
||||||
|
|
||||||
// CompatPlugin is a abstraction to handle both v2(new) and v1(legacy) plugins.
|
// CompatPlugin is an abstraction to handle both v2(new) and v1(legacy) plugins.
|
||||||
type CompatPlugin interface {
|
type CompatPlugin interface {
|
||||||
Client() *plugins.Client
|
Client() *plugins.Client
|
||||||
Name() string
|
Name() string
|
||||||
|
BasePath() string
|
||||||
IsV1() bool
|
IsV1() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CountedPlugin is a plugin which is reference counted.
|
||||||
|
type CountedPlugin interface {
|
||||||
|
Acquire()
|
||||||
|
Release()
|
||||||
|
CompatPlugin
|
||||||
|
}
|
||||||
|
|
||||||
// PluginGetter is the interface implemented by Store
|
// PluginGetter is the interface implemented by Store
|
||||||
type PluginGetter interface {
|
type PluginGetter interface {
|
||||||
Get(name, capability string, mode int) (CompatPlugin, error)
|
Get(name, capability string, mode int) (CompatPlugin, error)
|
||||||
GetAllByCap(capability string) ([]CompatPlugin, error)
|
GetAllByCap(capability string) ([]CompatPlugin, error)
|
||||||
|
GetAllManagedPluginsByCap(capability string) []CompatPlugin
|
||||||
Handle(capability string, callback func(string, *plugins.Client))
|
Handle(capability string, callback func(string, *plugins.Client))
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
|
||||||
handleFunc := plugins.Handle
|
handleFunc := plugins.Handle
|
||||||
if pg := dc.GetPluginGetter(); pg != nil {
|
if pg := dc.GetPluginGetter(); pg != nil {
|
||||||
handleFunc = pg.Handle
|
handleFunc = pg.Handle
|
||||||
activePlugins, _ := pg.GetAllByCap(driverapi.NetworkPluginEndpointType)
|
activePlugins := pg.GetAllManagedPluginsByCap(driverapi.NetworkPluginEndpointType)
|
||||||
for _, ap := range activePlugins {
|
for _, ap := range activePlugins {
|
||||||
newPluginHandler(ap.Name(), ap.Client())
|
newPluginHandler(ap.Name(), ap.Client())
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ func Init(cb ipamapi.Callback, l, g interface{}) error {
|
||||||
handleFunc := plugins.Handle
|
handleFunc := plugins.Handle
|
||||||
if pg := cb.GetPluginGetter(); pg != nil {
|
if pg := cb.GetPluginGetter(); pg != nil {
|
||||||
handleFunc = pg.Handle
|
handleFunc = pg.Handle
|
||||||
activePlugins, _ := pg.GetAllByCap(ipamapi.PluginEndpointType)
|
activePlugins := pg.GetAllManagedPluginsByCap(ipamapi.PluginEndpointType)
|
||||||
for _, ap := range activePlugins {
|
for _, ap := range activePlugins {
|
||||||
newPluginHandler(ap.Name(), ap.Client())
|
newPluginHandler(ap.Name(), ap.Client())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue