Skip to content

Commit 4a4020e

Browse files
Report error if there are no matching wwpns found during publish.
1 parent 8010624 commit 4a4020e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

storage_drivers/ontap/ontap_common.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ func PublishLUN(
983983
} else if config.SANType == sa.FCP {
984984
// Add wwpns to igroup
985985

986+
var wwpn string
986987
// Get the WWPNs and WWNNs from the host and propagate only the ones which are mapped to SVM
987988
for initiatorPortName, targetPortNames := range publishInfo.HostWWPNMap {
988989
// Format the WWNNs to match the SVM WWNNs
@@ -991,7 +992,7 @@ func PublishLUN(
991992
// Add initiator port name to igroup, if the target port name is mapped to SVM
992993
if nodeName == portNameFormatted {
993994
portName := strings.TrimPrefix(initiatorPortName, "0x")
994-
wwpn := fcp.ConvertStrToWWNFormat(portName)
995+
wwpn = fcp.ConvertStrToWWNFormat(portName)
995996

996997
err = clientAPI.EnsureIgroupAdded(ctx, igroupName, wwpn)
997998
if err != nil {
@@ -1000,6 +1001,12 @@ func PublishLUN(
10001001
}
10011002
}
10021003
}
1004+
1005+
if wwpn == "" {
1006+
err = fmt.Errorf("no matching WWPN found for node %v", nodeName)
1007+
Logc(ctx).Error(err)
1008+
return err
1009+
}
10031010
}
10041011

10051012
// Map LUN (it may already be mapped)

0 commit comments

Comments
 (0)