From fee68def8f743ea33d949b234678029d4dac63f7 Mon Sep 17 00:00:00 2001 From: Anusha Ragunathan Date: Mon, 18 Jul 2016 15:39:27 -0700 Subject: [PATCH] Add only legacy plugins to the legacy lookup map. Legacy plugin model maintained a map of plugins. This is not used by the new model. Using this map in the new model causes incorrect lookup of plugins. This change uses adds a plugin to the map only if its legacy. Signed-off-by: Anusha Ragunathan (cherry picked from commit 8fd779dc28a11d8727d76e9553379b0c854f7c4c) Signed-off-by: Tibor Vass --- pkg/plugins/plugins.go | 5 +++++ plugin/interface.go | 1 + plugin/manager.go | 5 +++++ volume/drivers/extpoint.go | 8 ++++++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index 9cda7fcd4c..debcd087c9 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -83,6 +83,11 @@ func (p *Plugin) Client() *Client { return p.client } +// IsLegacy returns true for legacy plugins and false otherwise. +func (p *Plugin) IsLegacy() bool { + return true +} + // NewLocalPlugin creates a new local plugin. func NewLocalPlugin(name, addr string) *Plugin { return &Plugin{ diff --git a/plugin/interface.go b/plugin/interface.go index 4a3ed64df2..80e6b5b8df 100644 --- a/plugin/interface.go +++ b/plugin/interface.go @@ -6,4 +6,5 @@ import "github.com/docker/docker/pkg/plugins" type Plugin interface { Client() *plugins.Client Name() string + IsLegacy() bool } diff --git a/plugin/manager.go b/plugin/manager.go index 47b3d3bcc1..be2f601671 100644 --- a/plugin/manager.go +++ b/plugin/manager.go @@ -54,6 +54,11 @@ func (p *plugin) Client() *plugins.Client { return p.client } +// IsLegacy returns true for legacy plugins and false otherwise. +func (p *plugin) IsLegacy() bool { + return false +} + func (p *plugin) Name() string { name := p.P.Name if len(p.P.Tag) > 0 { diff --git a/volume/drivers/extpoint.go b/volume/drivers/extpoint.go index 537a25f472..785063dfff 100644 --- a/volume/drivers/extpoint.go +++ b/volume/drivers/extpoint.go @@ -118,7 +118,9 @@ func lookup(name string) (volume.Driver, error) { return nil, err } - drivers.extensions[name] = d + if p.IsLegacy() { + drivers.extensions[name] = d + } return d, nil } @@ -174,7 +176,9 @@ func GetAllDrivers() ([]volume.Driver, error) { } ext = NewVolumeDriver(name, p.Client()) - drivers.extensions[name] = ext + if p.IsLegacy() { + drivers.extensions[name] = ext + } ds = append(ds, ext) } return ds, nil