diff --git a/pkg/iscsi/iscsi.go b/pkg/iscsi/iscsi.go index b29fd84d..f93a0bcd 100644 --- a/pkg/iscsi/iscsi.go +++ b/pkg/iscsi/iscsi.go @@ -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"] diff --git a/pkg/iscsi/iscsi_util.go b/pkg/iscsi/iscsi_util.go index 803b93da..80de335f 100644 --- a/pkg/iscsi/iscsi_util.go +++ b/pkg/iscsi/iscsi_util.go @@ -109,9 +109,10 @@ func (util *ISCSIUtil) DetachDisk(c iscsiDiskUnmounter, targetPath string) error return err } - iscsiLib.Disconnect(connector.TargetIqn, connector.TargetPortals) - - if err := os.RemoveAll(targetPath); err != nil { + if disConnectErr := iscsiLib.Disconnect(connector.TargetIqn, connector.TargetPortals); disConnectErr != nil { + klog.Warningf("Warning: Disconnect failed for IQN: %v", connector.TargetIqn) + } + if err := os.Remove(targetPath); err != nil { klog.Errorf("iscsi: failed to remove mount path Error: %v", err) return err }