mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
FC plugin: Return target wwn + lun at GetVolumeName()
At volume attach/detach controller, GetVolumeName() is expected to return unique volume identifier, but FC plugin didn't return unique identifier if user specified FC volume using target wwn and lun. In order to return unique identifier, GetVolumeName() should use combination of target wwn and lun. Fixes #52690
This commit is contained in:
parent
00c1ec5201
commit
a95a1ff6f1
@ -61,9 +61,12 @@ func (plugin *fcPlugin) GetVolumeName(spec *volume.Spec) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if len(volumeSource.TargetWWNs) != 0 {
|
||||
// API server validates these parameters beforehand but attach/detach
|
||||
// controller creates volumespec without validation. They may be nil
|
||||
// or zero length. We should check again to avoid unexpected conditions.
|
||||
if len(volumeSource.TargetWWNs) != 0 && volumeSource.Lun != nil {
|
||||
// TargetWWNs are the FibreChannel target worldwide names
|
||||
return fmt.Sprintf("%v", volumeSource.TargetWWNs), nil
|
||||
return fmt.Sprintf("%v:%v", volumeSource.TargetWWNs, *volumeSource.Lun), nil
|
||||
} else if len(volumeSource.WWIDs) != 0 {
|
||||
// WWIDs are the FibreChannel World Wide Identifiers
|
||||
return fmt.Sprintf("%v", volumeSource.WWIDs), nil
|
||||
|
Loading…
Reference in New Issue
Block a user