@@ -657,9 +657,9 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
657
657
}
658
658
659
659
pm .refreshProbedPlugins ()
660
- for _ , plugin := range pm .probedPlugins {
660
+ for pluginName , plugin := range pm .probedPlugins {
661
661
if plugin .CanSupport (spec ) {
662
- matchedPluginNames = append (matchedPluginNames , plugin . GetPluginName () )
662
+ matchedPluginNames = append (matchedPluginNames , pluginName )
663
663
matches = append (matches , plugin )
664
664
}
665
665
}
@@ -713,19 +713,15 @@ func (pm *VolumePluginMgr) FindPluginByName(name string) (VolumePlugin, error) {
713
713
// Once we can get rid of legacy names we can reduce this to a map lookup.
714
714
matchedPluginNames := []string {}
715
715
matches := []VolumePlugin {}
716
- for k , v := range pm .plugins {
717
- if v .GetPluginName () == name {
718
- matchedPluginNames = append (matchedPluginNames , k )
719
- matches = append (matches , v )
720
- }
716
+ if v , found := pm .plugins [name ]; found {
717
+ matchedPluginNames = append (matchedPluginNames , name )
718
+ matches = append (matches , v )
721
719
}
722
720
723
721
pm .refreshProbedPlugins ()
724
- for _ , plugin := range pm .probedPlugins {
725
- if plugin .GetPluginName () == name {
726
- matchedPluginNames = append (matchedPluginNames , plugin .GetPluginName ())
727
- matches = append (matches , plugin )
728
- }
722
+ if plugin , found := pm .probedPlugins [name ]; found {
723
+ matchedPluginNames = append (matchedPluginNames , name )
724
+ matches = append (matches , plugin )
729
725
}
730
726
731
727
if len (matches ) == 0 {
0 commit comments