Skip to content

Commit

Permalink
Limit attach/detach only within subsystem
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Nov 17, 2022
1 parent 4bbd244 commit b9cd7bd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ func (s *server) CreateNVMeNamespace(ctx context.Context, in *pb.CreateNVMeNames

// Now, attach this new NS to ALL controllers
for _, c := range controllers {
if c.Spec.SubsystemId.Value != in.Namespace.Spec.SubsystemId.Value {
continue;
}
params := MrvlNvmCtrlrAttachNsParams{
Subnqn: subsys.Spec.Nqn,
CtrlID: int(c.Spec.NvmeControllerId),
Expand Down Expand Up @@ -420,16 +423,17 @@ func (s *server) DeleteNVMeNamespace(ctx context.Context, in *pb.DeleteNVMeNames
if !ok {
err := fmt.Errorf("unable to find subsystem %s", namespace.Spec.SubsystemId.Value)
log.Printf("error: %v", err)
// TODO: temp workaround
subsys = &pb.NVMeSubsystem{Spec: &pb.NVMeSubsystemSpec{Nqn: namespace.Spec.SubsystemId.Value}}
// return nil, err
return nil, err
}
// First, detach this NS from ALL controllers
for _, c := range controllers {
if c.Spec.SubsystemId.Value != namespace.Spec.SubsystemId.Value {
continue;
}
params := MrvlNvmCtrlrDetachNsParams{
Subnqn: subsys.Spec.Nqn,
CtrlID: int(c.Spec.NvmeControllerId),
NsInstanceID: int(in.Namespace.Spec.HostNsid),
CtrlrID: int(c.Spec.NvmeControllerId),
NsInstanceID: int(namespace.Spec.HostNsid),
}
var result MrvlNvmCtrlrDetachNsResult
err := call("mrvl_nvm_ctrlr_detach_ns", &params, &result)
Expand Down

0 comments on commit b9cd7bd

Please sign in to comment.