@@ -210,13 +210,30 @@ func (s *Server) ListNvmePaths(ctx context.Context, in *pb.ListNvmePathsRequest)
210210 token = uuid .New ().String ()
211211 s .Pagination [token ] = offset + size
212212 }
213- Blobarray := make ([]* pb.NvmePath , len (result ))
214- for i := range result {
215- r := & result [i ]
216- Blobarray [i ] = & pb.NvmePath {Name : r .Name /* TODO: fill this */ }
213+ Blobarray := make ([]* pb.NvmePath , 0 , len (result ))
214+ for _ , r := range result {
215+ for _ , c := range r .Ctrlrs {
216+ path := & pb.NvmePath {
217+ Name : r .Name ,
218+ Trtype : utils .ParseOpiTransportType (c .Trid .Trtype ),
219+ Traddr : c .Trid .Traddr ,
220+ Fabrics : & pb.FabricsPath {
221+ Trsvcid : utils .ParseTrsvcid (c .Trid .Trsvcid ),
222+ Subnqn : c .Trid .Subnqn ,
223+ Adrfam : utils .SpdkAddressFamilyToOpi (c .Trid .Adrfam ),
224+ SourceTraddr : c .Host .Addr ,
225+ SourceTrsvcid : utils .ParseTrsvcid (c .Host .Svcid ),
226+ Hostnqn : c .Host .Nqn ,
227+ },
228+ }
229+ Blobarray = append (Blobarray , path )
230+ }
217231 }
218232 sortNvmePaths (Blobarray )
219- return & pb.ListNvmePathsResponse {NvmePaths : Blobarray , NextPageToken : token }, nil
233+ return & pb.ListNvmePathsResponse {
234+ NvmePaths : Blobarray ,
235+ NextPageToken : token ,
236+ }, nil
220237}
221238
222239// GetNvmePath gets Nvme path
@@ -239,10 +256,23 @@ func (s *Server) GetNvmePath(ctx context.Context, in *pb.GetNvmePathRequest) (*p
239256 }
240257 log .Printf ("Received from SPDK: %v" , result )
241258
242- for i := range result {
243- r := & result [i ]
244- if r .Name != "" {
245- return & pb.NvmePath { /* TODO: fill this */ }, nil
259+ for _ , r := range result {
260+ for _ , c := range r .Ctrlrs {
261+ if c .Trid .Subnqn == path .Fabrics .Subnqn {
262+ return & pb.NvmePath {
263+ Name : r .Name ,
264+ Trtype : utils .ParseOpiTransportType (c .Trid .Trtype ),
265+ Traddr : c .Trid .Traddr ,
266+ Fabrics : & pb.FabricsPath {
267+ Trsvcid : utils .ParseTrsvcid (c .Trid .Trsvcid ),
268+ Subnqn : c .Trid .Subnqn ,
269+ Adrfam : utils .SpdkAddressFamilyToOpi (c .Trid .Adrfam ),
270+ SourceTraddr : c .Host .Addr ,
271+ SourceTrsvcid : utils .ParseTrsvcid (c .Host .Svcid ),
272+ Hostnqn : c .Host .Nqn ,
273+ },
274+ }, nil
275+ }
246276 }
247277 }
248278 msg := fmt .Sprintf ("Could not find NQN: %s" , path .Fabrics .Subnqn )
0 commit comments