Skip to content

Commit

Permalink
iscsi: capture and log iscsi disconnect error
Browse files Browse the repository at this point in the history
At present while iscsi target disconnect is attempted, if there is
an error its ignored. This patch fetches the error if any and also
log it for further actions.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
  • Loading branch information
humblec committed Apr 21, 2021
1 parent 608a1bd commit 660be11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/iscsi/iscsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func getISCSIInfo(req *csi.NodePublishVolumeRequest) (*iscsiDisk, error) {
}

for _, portal := range portals {
bkportal = append(bkportal, portalMounter(string(portal)))
bkportal = append(bkportal, portalMounter(portal))
}

iface := req.GetVolumeContext()["iscsiInterface"]
Expand Down
6 changes: 4 additions & 2 deletions pkg/iscsi/iscsi_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ func (util *ISCSIUtil) DetachDisk(c iscsiDiskUnmounter, targetPath string) error
return err
}

iscsi_lib.Disconnect(connector.TargetIqn, connector.TargetPortals)

disConnectErr := iscsi_lib.Disconnect(connector.TargetIqn, connector.TargetPortals)
if disConnectErr != nil {
klog.Warningf("Warning: Disconnect failed for IQN: %v", connector.TargetIqn)
}
if err := os.RemoveAll(targetPath); err != nil {
klog.Errorf("iscsi: failed to remove mount path Error: %v", err)
return err
Expand Down

0 comments on commit 660be11

Please sign in to comment.