Skip to content

Commit

Permalink
Merge pull request moby#25816 from anusha-ragunathan/vol-plugin-list
Browse files Browse the repository at this point in the history
Make `docker volume list` lookup plugins installed using new model.
  • Loading branch information
vdemeester authored Aug 25, 2016
2 parents a36016c + 59c45f7 commit 0c69260
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 7 additions & 0 deletions integration-cli/docker_cli_daemon_experimental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions plugin/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion volume/drivers/extpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 0c69260

Please sign in to comment.