Skip to content

Commit 24a447e

Browse files
authored
Merge pull request kubernetes#124317 from hoyho/bugfix/expand_vol_warning
fix warning when using CSI driver to expand volume
2 parents e367afe + 02197a9 commit 24a447e

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, ","))
@@ -863,6 +866,9 @@ func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVol
863866
klog.V(4).InfoS("FindExpandablePluginBySpec -> returning noopExpandableVolumePluginInstance", "specName", spec.Name())
864867
return &noopExpandableVolumePluginInstance{spec}, nil
865868
}
869+
if errors.Is(err, ErrNoPluiginMatched) {
870+
return nil, nil
871+
}
866872
klog.V(4).InfoS("FindExpandablePluginBySpec -> err", "specName", spec.Name(), "err", err)
867873
return nil, err
868874
}

0 commit comments

Comments
 (0)