Describe the bug
A clear and concise description of what the bug is.
PowerStore CSI driver is configured for FC connectivity, however its reporting "“AttachVolume.Attach failed for volume "csi-pstore-167d09d5dd" : rpc error: code = Internal desc = could not get iscsiTargets: can't get iscsi target address”" when using CSI to provision PVC from PowerStore.
Issue only resolved by config CSI with a fake iSCSI targets, then FC connectivity would work.
Looking at the code of "addTargetsInfoToPublishContext()", it seems the code would always check iSCSI target first then FC, if there is no ISCSI target configured, the provision would exit with error, it would not proceed with FC target check. This is not ideal, the code should skip ISCSI target check and proceed with FC targets check, if no ISCSI targets configured.
func (s *SCSIPublisher)
addTargetsInfoToPublishContext(
publishContext map[string]string, client gopowerstore.Client) error {
iscsiTargetsInfo, err := common.GetISCSITargetsInfoFromStorage(client)
if err != nil {
return err
}
for i, t := range iscsiTargetsInfo {
publishContext[fmt.Sprintf("%s%d", common.PublishContextISCSIPortalsPrefix, i)] = t.Portal
publishContext[fmt.Sprintf("%s%d", common.PublishContextISCSITargetsPrefix, i)] = t.Target
}
fcTargetsInfo, err := common.GetFCTargetsInfoFromStorage(client)
if err != nil {
return err
}
for i, t := range fcTargetsInfo {
publishContext[fmt.Sprintf("%s%d", common.PublishContextFCWWPNPrefix, i)] = t.WWPN
}
return nil
}
To Reproduce
Steps to reproduce the behavior:
- Step 1 configure CSI with FC connectivity without configuring iSCSI targets
- Step 2 try provision FC based PVC from Powerstore to pod
n See error
"“AttachVolume.Attach failed for volume "csi-pstore-167d09d5dd" : rpc error: code = Internal desc = could not get iscsiTargets: can't get iscsi target address”"
Expected behavior
User should be able to provision FC based PVC from Powerstore without configuring iSCSI targets.
The code of "addTargetsInfoToPublishContext()" should skip ISCSI target check and proceed with FC targets check if no ISCSI targets configured.
Screenshots
If applicable, add screenshots to help explain your problem.
Logs
If applicable, submit logs or stack traces from the affected services
System Information (please complete the following information):
- OS/Version: [e.g. RHEL 7.6]
- Kubernetes Version [e.g. 1.18]
- Additional Information...
Additional context
Add any other context about the problem here.