1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Make docker volume list lookup plugins installed using new model.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
Anusha Ragunathan 2016-08-16 15:53:43 -07:00
parent d8e12f8755
commit 59c45f7c0a
3 changed files with 12 additions and 7 deletions

View file

@ -206,6 +206,13 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
}
}()
out, err = s.d.Cmd("volume", "ls")
if err != nil {
c.Fatalf("Could not list volume: %v %s", err, out)
}
c.Assert(out, checker.Contains, volName)
c.Assert(out, checker.Contains, pluginName)
mountPoint, err := s.d.Cmd("volume", "inspect", volName, "--format", "{{.Mountpoint}}")
if err != nil {
c.Fatalf("Could not inspect volume: %v %s", err, mountPoint)

View file

@ -181,14 +181,13 @@ func FindWithCapability(capability string) ([]Plugin, error) {
handleLegacy = manager.handleLegacy
manager.RLock()
defer manager.RUnlock()
pluginLoop:
for _, p := range manager.plugins {
for _, typ := range p.PluginObj.Manifest.Interface.Types {
if typ.Capability != capability || typ.Prefix != "docker" {
continue pluginLoop
if strings.EqualFold(typ.Capability, capability) && typ.Prefix == "docker" {
result = append(result, p)
break
}
}
result = append(result, p)
}
}
if handleLegacy {
@ -244,9 +243,8 @@ func LookupWithCapability(name, capability string) (Plugin, error) {
return nil, err
}
capability = strings.ToLower(capability)
for _, typ := range p.PluginObj.Manifest.Interface.Types {
if typ.Capability == capability && typ.Prefix == "docker" {
if strings.EqualFold(typ.Capability, capability) && typ.Prefix == "docker" {
return p, nil
}
}

View file

@ -107,7 +107,7 @@ func lookup(name string) (volume.Driver, error) {
return nil, fmt.Errorf("Error looking up volume plugin %s: %v", name, err)
}
d := NewVolumeDriver(name, p.Client())
d := NewVolumeDriver(p.Name(), p.Client())
if err := validateDriver(d); err != nil {
return nil, err
}