Skip to content

Commit 02197a9

Browse files
committed
fix warning when using CSI driver to expand volume
Signed-off-by: hoyho <[email protected]>
1 parent a065680 commit 02197a9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/volume/plugins.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package volume
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"net"
2223
"strings"
@@ -62,6 +63,8 @@ const (
6263
ProbeRemove
6364
)
6465

66+
var ErrNoPluiginMatched = errors.New("no volume plugin matched")
67+
6568
// VolumeOptions contains option information about a volume.
6669
type VolumeOptions struct {
6770
// The attributes below are required by volume.Provisioner
@@ -649,7 +652,7 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
649652
}
650653

651654
if len(matchedPluginNames) == 0 {
652-
return nil, fmt.Errorf("no volume plugin matched")
655+
return nil, ErrNoPluiginMatched
653656
}
654657
if len(matchedPluginNames) > 1 {
655658
return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ","))
@@ -876,6 +879,9 @@ func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVol
876879
klog.V(4).InfoS("FindExpandablePluginBySpec -> returning noopExpandableVolumePluginInstance", "specName", spec.Name())
877880
return &noopExpandableVolumePluginInstance{spec}, nil
878881
}
882+
if errors.Is(err, ErrNoPluiginMatched) {
883+
return nil, nil
884+
}
879885
klog.V(4).InfoS("FindExpandablePluginBySpec -> err", "specName", spec.Name(), "err", err)
880886
return nil, err
881887
}

0 commit comments

Comments
 (0)