@@ -17,6 +17,7 @@ limitations under the License.
17
17
package volume
18
18
19
19
import (
20
+ "errors"
20
21
"fmt"
21
22
"net"
22
23
"strings"
@@ -62,6 +63,8 @@ const (
62
63
ProbeRemove
63
64
)
64
65
66
+ var ErrNoPluiginMatched = errors .New ("no volume plugin matched" )
67
+
65
68
// VolumeOptions contains option information about a volume.
66
69
type VolumeOptions struct {
67
70
// The attributes below are required by volume.Provisioner
@@ -649,7 +652,7 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
649
652
}
650
653
651
654
if len (matchedPluginNames ) == 0 {
652
- return nil , fmt . Errorf ( "no volume plugin matched" )
655
+ return nil , ErrNoPluiginMatched
653
656
}
654
657
if len (matchedPluginNames ) > 1 {
655
658
return nil , fmt .Errorf ("multiple volume plugins matched: %s" , strings .Join (matchedPluginNames , "," ))
@@ -876,6 +879,9 @@ func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVol
876
879
klog .V (4 ).InfoS ("FindExpandablePluginBySpec -> returning noopExpandableVolumePluginInstance" , "specName" , spec .Name ())
877
880
return & noopExpandableVolumePluginInstance {spec }, nil
878
881
}
882
+ if errors .Is (err , ErrNoPluiginMatched ) {
883
+ return nil , nil
884
+ }
879
885
klog .V (4 ).InfoS ("FindExpandablePluginBySpec -> err" , "specName" , spec .Name (), "err" , err )
880
886
return nil , err
881
887
}
0 commit comments