Skip to content

Commit

Permalink
fix spaceid handling
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Jun 9, 2021
1 parent 66e4779 commit 931c7f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,15 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp
id = f.GetId()
}
}
parts := strings.SplitN(id.OpaqueId, "!", 2)
if len(parts) != 2 {
return &provider.ListStorageSpacesResponse{
Status: status.NewInvalidArg(ctx, "space id must be seperated by !"),
}, nil
}
c, err := s.find(ctx, &provider.Reference{
StorageId: id.OpaqueId, // FIXME REFERENCE the StorageSpaceId is a storageid + a nodeid
StorageId: parts[0], // FIXME REFERENCE the StorageSpaceId is a storageid + a nodeid
NodeId: parts[1],
})
if err != nil {
return &provider.ListStorageSpacesResponse{
Expand Down
5 changes: 4 additions & 1 deletion pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,10 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
case provider.ListStorageSpacesRequest_Filter_TYPE_SPACE_TYPE:
spaceType = filter[i].GetSpaceType()
case provider.ListStorageSpacesRequest_Filter_TYPE_ID:
//spaceId = filter[i].GetId().OpaqueId // TODO requests needs to contain the driveid ... currently it is the storage id
parts := strings.SplitN(filter[i].GetId().OpaqueId, "!", 2)
if len(parts) == 2 {
spaceID = parts[1]
}
}
}

Expand Down

0 comments on commit 931c7f1

Please sign in to comment.