Skip to content

Commit

Permalink
Returning ControllerId
Browse files Browse the repository at this point in the history
Signed-off-by: Harshita Pandey <Harshita_Pandey@dell.com>
  • Loading branch information
harshitap26 committed Dec 6, 2022
1 parent 5e76e51 commit 58d7e0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions goopicsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ func NVMeControllerDisconnect(id int64) error {
}

// ExposeRemoteNVMe creates a new NVMe Subsystem and NVMe controller
func ExposeRemoteNVMe(subsystemNQN string, maxNamespaces int64) (string, error) {
func ExposeRemoteNVMe(subsystemNQN string, maxNamespaces int64) (string, string, error) {
if conn == nil {
err := dialConnection()
if err != nil {
return "", err
return "", "", err
}
}

Expand All @@ -260,7 +260,7 @@ func ExposeRemoteNVMe(subsystemNQN string, maxNamespaces int64) (string, error)
})
if err != nil {
log.Println(err)
return "", err
return "", "", err
}
log.Printf("NVMe Subsytem created: %v", response1)
} else {
Expand All @@ -284,13 +284,13 @@ func ExposeRemoteNVMe(subsystemNQN string, maxNamespaces int64) (string, error)
})
if err != nil {
log.Println(err)
return "", err
return subsystemID, "", err
}
log.Printf("NVMe Controller created: %v", response2)
return subsystemID, nil
return subsystemID, controllerID, nil
}
log.Printf("NVMe Controller is already present with the controllerID: %v", controllerID)
return subsystemID, nil
return subsystemID, controllerID, nil
}

// CreateNVMeNamespace Creates a new NVMe namespace
Expand Down
5 changes: 3 additions & 2 deletions goopicsi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ func TestDeleteNVMeNamespace(t *testing.T) {
}

func TestExposeRemoteNVMe(t *testing.T) {
subsystemID, err := ExposeRemoteNVMe("nqn.2022-09.io.spdk:test", 10)
subsystemID, controllerID, err := ExposeRemoteNVMe("nqn.2022-09.io.spdk:test", 10)
if err != nil {
log.Println(err)
}
log.Println(subsystemID)
log.Printf("Subsystem ID: %s", subsystemID)
log.Printf("Controller Id: %s", controllerID)
}

func TestGenerateHostNQN(t *testing.T) {
Expand Down

0 comments on commit 58d7e0b

Please sign in to comment.