mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 17:38:50 +00:00
Volume AttachablePlugin.CanAttach() now returns both bool and error
This commit is contained in:
@@ -235,7 +235,7 @@ type AttachableVolumePlugin interface {
|
||||
NewAttacher() (Attacher, error)
|
||||
NewDetacher() (Detacher, error)
|
||||
// CanAttach tests if provided volume spec is attachable
|
||||
CanAttach(spec *Spec) bool
|
||||
CanAttach(spec *Spec) (bool, error)
|
||||
}
|
||||
|
||||
// DeviceMountableVolumePlugin is an extended interface of VolumePlugin and is used
|
||||
@@ -891,7 +891,9 @@ func (pm *VolumePluginMgr) FindAttachablePluginBySpec(spec *Spec) (AttachableVol
|
||||
return nil, err
|
||||
}
|
||||
if attachableVolumePlugin, ok := volumePlugin.(AttachableVolumePlugin); ok {
|
||||
if attachableVolumePlugin.CanAttach(spec) {
|
||||
if canAttach, err := attachableVolumePlugin.CanAttach(spec); err != nil {
|
||||
return nil, err
|
||||
} else if canAttach {
|
||||
return attachableVolumePlugin, nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user