Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update arguments of nsexec.Execute #75

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/longhorn/go-iscsi-helper
go 1.21

require (
github.com/longhorn/go-common-libs v0.0.0-20240103081802-3993c5908447
github.com/longhorn/go-common-libs v0.0.0-20240219051150-081e7dcbfef2
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
golang.org/x/sys v0.13.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/longhorn/go-common-libs v0.0.0-20240103081802-3993c5908447 h1:NwR+xCGLpAORmB1UwNfDkQj3vPNIVikJe/hZe9+BQe0=
github.com/longhorn/go-common-libs v0.0.0-20240103081802-3993c5908447/go.mod h1:nIECQARppamt2zwFSdzADRTVKo/7izFwWIS3VWi7D/s=
github.com/longhorn/go-common-libs v0.0.0-20240219051150-081e7dcbfef2 h1:MP6JLqc8zFSbeq8FUHbAwvTqoBQk9mVefPr/pLyatm0=
github.com/longhorn/go-common-libs v0.0.0-20240219051150-081e7dcbfef2/go.mod h1:nIECQARppamt2zwFSdzADRTVKo/7izFwWIS3VWi7D/s=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
Expand Down
24 changes: 12 additions & 12 deletions iscsi/initiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func CheckForInitiatorExistence(nsexec *lhns.Executor) error {
opts := []string{
"--version",
}
_, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
return err
}

Expand All @@ -53,7 +53,7 @@ func UpdateIscsiDeviceAbortTimeout(target string, timeout int64, nsexec *lhns.Ex
"-n", "node.session.err_timeo.abort_timeout",
"-v", strconv.FormatInt(timeout, 10),
}
_, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
return err
}

Expand All @@ -63,7 +63,7 @@ func DiscoverTarget(ip, target string, nsexec *lhns.Executor) error {
"-t", "sendtargets",
"-p", ip,
}
output, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
output, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
if err != nil {
return err
}
Expand Down Expand Up @@ -91,7 +91,7 @@ func DeleteDiscoveredTarget(ip, target string, nsexec *lhns.Executor) error {
if ip != "" {
opts = append(opts, "-p", ip)
}
_, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
return err
}

Expand All @@ -103,7 +103,7 @@ func IsTargetDiscovered(ip, target string, nsexec *lhns.Executor) bool {
if ip != "" {
opts = append(opts, "-p", ip)
}
_, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
return err == nil
}

Expand All @@ -114,7 +114,7 @@ func LoginTarget(ip, target string, nsexec *lhns.Executor) error {
"-p", ip,
"--login",
}
_, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
if err != nil {
return err
}
Expand Down Expand Up @@ -146,7 +146,7 @@ func LogoutTarget(ip, target string, nsexec *lhns.Executor) error {
if ip != "" {
opts = append(opts, "-p", ip)
}
_, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
return err
}

Expand All @@ -173,7 +173,7 @@ func IsTargetLoggedIn(ip, target string, nsexec *lhns.Executor) bool {
"-m", "session",
}

output, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
output, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
if err != nil {
return false
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func manualScanSession(ip, target string, nsexec *lhns.Executor) error {
"-p", ip,
"--rescan",
}
_, err := nsexec.Execute(iscsiBinary, opts, ScanTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, ScanTimeout)
return err
}

Expand All @@ -216,7 +216,7 @@ func getIscsiNodeSessionScanMode(ip, target string, nsexec *lhns.Executor) (stri
"-p", ip,
"-o", "show",
}
output, err := nsexec.Execute(iscsiBinary, opts, ScanTimeout)
output, err := nsexec.Execute(nil, iscsiBinary, opts, ScanTimeout)
if err != nil {
return "", err
}
Expand All @@ -233,7 +233,7 @@ func findScsiDevice(ip, target string, lun int, nsexec *lhns.Executor) (*lhtypes
"-m", "session",
"-P", "3",
}
output, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
output, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -362,6 +362,6 @@ func RescanTarget(ip, target string, nsexec *lhns.Executor) error {
if ip != "" {
opts = append(opts, "-p", ip)
}
_, err := nsexec.Execute(iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
_, err := nsexec.Execute(nil, iscsiBinary, opts, lhtypes.ExecuteDefaultTimeout)
return err
}
2 changes: 1 addition & 1 deletion iscsidev/iscsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (dev *Device) DeleteTarget() error {

// UnbindInitiator can return tgtadmSuccess, tgtadmAclNoexist or tgtadmNoTarget
// Target is deleted in the last step, so tgtadmNoTarget error should not occur here.
// Just ingore tgtadmAclNoexist and continue working on the remaining tasks.
// Just ignore tgtadmAclNoexist and continue working on the remaining tasks.
if err := iscsi.UnbindInitiator(tid, "ALL"); err != nil {
if !strings.Contains(err.Error(), types.TgtadmAclNoexist) {
return err
Expand Down
2 changes: 1 addition & 1 deletion types/tgtadm_errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

// erros are from tgt/usr/tgtadm_error.h and tgt/usr/tgtadm.c
// errors are from tgt/usr/tgtadm_error.h and tgt/usr/tgtadm.c
const (
TgtadmSuccess = "success"
TgtadmUnknown = "unknown error"
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/longhorn/go-common-libs/ns/crypto.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions vendor/github.com/longhorn/go-common-libs/ns/executor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/longhorn/go-common-libs/ns/filelock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vendor/github.com/longhorn/go-common-libs/sys/sys.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ github.com/kr/pretty
# github.com/kr/text v0.1.0
## explicit
github.com/kr/text
# github.com/longhorn/go-common-libs v0.0.0-20240103081802-3993c5908447
# github.com/longhorn/go-common-libs v0.0.0-20240219051150-081e7dcbfef2
## explicit; go 1.21
github.com/longhorn/go-common-libs/exec
github.com/longhorn/go-common-libs/io
Expand Down