diff options
| author | Rafael Gieschke | 2025-11-24 16:57:19 +0100 |
|---|---|---|
| committer | Rafael Gieschke | 2025-11-24 16:57:19 +0100 |
| commit | a5c33a92befe4a553c05246e0596e1fac1803f4e (patch) | |
| tree | edc310fab2b846cde62cd2308533544007b99c5a /contrib/iscsi-destroy/main.go | |
| parent | [server] Add GitLab CI for performance tests (diff) | |
| download | dnbd3-isfant.tar.gz dnbd3-isfant.tar.xz dnbd3-isfant.zip | |
[server] Try to clean up after performance testsisfant
Diffstat (limited to 'contrib/iscsi-destroy/main.go')
| -rw-r--r-- | contrib/iscsi-destroy/main.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/contrib/iscsi-destroy/main.go b/contrib/iscsi-destroy/main.go new file mode 100644 index 0000000..0227c9d --- /dev/null +++ b/contrib/iscsi-destroy/main.go @@ -0,0 +1,39 @@ +// Source: https://github.com/open-iscsi/open-iscsi/issues/228#issuecomment-715770988 + +package main + +import ( + "os" + "fmt" + "strconv" + "github.com/u-root/iscsinl" +) + +func main() { + ipc, err := iscsinl.ConnectNetlink() + + if err != nil { + fmt.Printf("Error connecting to netlink: %s\n", err) + return + } + + sid, _ := strconv.Atoi(os.Args[1]) + + err = ipc.StopConnection(uint32(sid), 0) + + if err != nil { + fmt.Printf("Error stopping connection: %s\n", err) + } + + err = ipc.DestroyConnection(uint32(sid), 0) + + if err != nil { + fmt.Printf("Error destroying connection: %s\n", err) + } + + err = ipc.DestroySession(uint32(sid)) + + if err != nil { + fmt.Printf("Error destroying session: %s\n", err) + } +} |
