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 <anusha@docker.com>
(cherry picked from commit 8fd779dc28
)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
45920009cc
commit
fee68def8f
4 changed files with 17 additions and 2 deletions
|
@ -83,6 +83,11 @@ func (p *Plugin) Client() *Client {
|
||||||
return p.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.
|
// NewLocalPlugin creates a new local plugin.
|
||||||
func NewLocalPlugin(name, addr string) *Plugin {
|
func NewLocalPlugin(name, addr string) *Plugin {
|
||||||
return &Plugin{
|
return &Plugin{
|
||||||
|
|
|
@ -6,4 +6,5 @@ import "github.com/docker/docker/pkg/plugins"
|
||||||
type Plugin interface {
|
type Plugin interface {
|
||||||
Client() *plugins.Client
|
Client() *plugins.Client
|
||||||
Name() string
|
Name() string
|
||||||
|
IsLegacy() bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,11 @@ func (p *plugin) Client() *plugins.Client {
|
||||||
return p.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 {
|
func (p *plugin) Name() string {
|
||||||
name := p.P.Name
|
name := p.P.Name
|
||||||
if len(p.P.Tag) > 0 {
|
if len(p.P.Tag) > 0 {
|
||||||
|
|
|
@ -118,7 +118,9 @@ func lookup(name string) (volume.Driver, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.IsLegacy() {
|
||||||
drivers.extensions[name] = d
|
drivers.extensions[name] = d
|
||||||
|
}
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +176,9 @@ func GetAllDrivers() ([]volume.Driver, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ext = NewVolumeDriver(name, p.Client())
|
ext = NewVolumeDriver(name, p.Client())
|
||||||
|
if p.IsLegacy() {
|
||||||
drivers.extensions[name] = ext
|
drivers.extensions[name] = ext
|
||||||
|
}
|
||||||
ds = append(ds, ext)
|
ds = append(ds, ext)
|
||||||
}
|
}
|
||||||
return ds, nil
|
return ds, nil
|
||||||
|
|
Loading…
Reference in a new issue