Skip to content

Commit

Permalink
Merge pull request #1012 from himanshuvar/Bug-Fix
Browse files Browse the repository at this point in the history
Bug Fix: For Volume Attachment to OpenSDS CSI plugin
  • Loading branch information
skdwriting committed Sep 23, 2019
2 parents bc79715 + c717dff commit 089dca6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions contrib/connector/iscsi/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,18 @@ func connect(connMap map[string]interface{}) (string, error) {

targetlun := strconv.Itoa(conn.TgtLun)

cmd := "pgrep -f /sbin/iscsid"
_, err = connector.ExecCmd("/bin/bash", "-c", cmd)
cmd := "ls -ali / | sed '2!d' |awk {'print $1'}"
INODE_NUM, err := connector.ExecCmd("/bin/bash", "-c", cmd)
if err != nil && INODE_NUM == "2" {
cmd = "\"pgrep -f /sbin/iscsid\""
_, err = connector.ExecCmd("/bin/bash", "-c", cmd)

if err != nil {
cmd = "/sbin/iscsid"
_, errExec := connector.ExecCmd("/bin/bash", "-c", cmd)
if errExec != nil {
return "", fmt.Errorf("Please stop the iscsi process outside the container first: %v", errExec)
if err != nil {
cmd = "/sbin/iscsid"
_, errExec := connector.ExecCmd("/bin/bash", "-c", cmd)
if errExec != nil {
return "", fmt.Errorf("Please stop the iscsi process: %v", errExec)
}
}
}

Expand Down

0 comments on commit 089dca6

Please sign in to comment.