Commit a95a1ff6 authored by mtanino's avatar mtanino

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
parent 00c1ec52
...@@ -61,9 +61,12 @@ func (plugin *fcPlugin) GetVolumeName(spec *volume.Spec) (string, error) { ...@@ -61,9 +61,12 @@ func (plugin *fcPlugin) GetVolumeName(spec *volume.Spec) (string, error) {
return "", err 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 // 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 { } else if len(volumeSource.WWIDs) != 0 {
// WWIDs are the FibreChannel World Wide Identifiers // WWIDs are the FibreChannel World Wide Identifiers
return fmt.Sprintf("%v", volumeSource.WWIDs), nil return fmt.Sprintf("%v", volumeSource.WWIDs), nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment