From 931c7f1b58503c31b11a153b6e771f0bf168c173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 9 Jun 2021 10:49:20 +0000 Subject: [PATCH] fix spaceid handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- internal/grpc/services/gateway/storageprovider.go | 9 ++++++++- pkg/storage/utils/decomposedfs/decomposedfs.go | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index 8208c25b146..849ccd2d17c 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -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{ diff --git a/pkg/storage/utils/decomposedfs/decomposedfs.go b/pkg/storage/utils/decomposedfs/decomposedfs.go index eff9674d9f5..79f4a04b129 100644 --- a/pkg/storage/utils/decomposedfs/decomposedfs.go +++ b/pkg/storage/utils/decomposedfs/decomposedfs.go @@ -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] + } } }