Skip to content

Commit 620aafc

Browse files
committed
incorporate review
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
1 parent e8d8b4b commit 620aafc

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

internal/grpc/services/gateway/storageprovider.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,13 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp
196196
uniqueSpaces := map[string]*provider.StorageSpace{}
197197
for i := range providers {
198198
if errors[i] != nil {
199-
log.Debug().Err(errors[i]).Msg("skipping provider")
200-
continue
199+
if len(providers) > 1 {
200+
log.Debug().Err(errors[i]).Msg("skipping provider")
201+
continue
202+
}
203+
return &provider.ListStorageSpacesResponse{
204+
Status: status.NewStatusFromErrType(ctx, "error listing space", errors[i]),
205+
}, nil
201206
}
202207
for j := range spacesFromProviders[i] {
203208
uniqueSpaces[spacesFromProviders[i][j].Id.OpaqueId] = spacesFromProviders[i][j]
@@ -207,6 +212,11 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp
207212
for spaceID := range uniqueSpaces {
208213
spaces = append(spaces, uniqueSpaces[spaceID])
209214
}
215+
if len(spaces) == 0 {
216+
return &provider.ListStorageSpacesResponse{
217+
Status: status.NewNotFound(ctx, "space not found")
218+
}, nil
219+
}
210220

211221
return &provider.ListStorageSpacesResponse{
212222
Status: status.NewOK(ctx),

internal/grpc/services/storageprovider/storageprovider.go

+3
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ func hasNodeID(s *provider.StorageSpace) bool {
433433
}
434434

435435
func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSpacesRequest) (*provider.ListStorageSpacesResponse, error) {
436+
log := appctx.GetLogger(ctx)
436437
spaces, err := s.storage.ListStorageSpaces(ctx, req.Filters)
437438
if err != nil {
438439
var st *rpc.Status
@@ -461,6 +462,8 @@ func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStora
461462
if spaces[i].Root.StorageId == "" {
462463
spaces[i].Root.StorageId = s.mountID
463464
}
465+
} else if spaces[i].Id == nil || spaces[i].Id.OpaqueId == "" {
466+
log.Warn().Str("service", "storageprovider").Str("driver", s.conf.Driver).Interface("space", spaces[i]).Msg("space is missing space id and root id")
464467
}
465468
}
466469

pkg/storage/utils/decomposedfs/decomposedfs.go

-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
577577
// do not list shares as spaces for the owner
578578
continue
579579
}
580-
space.Name = n.Name
581580
} else {
582581
space.Name = "root" // do not expose the id as name, this is the root of a space
583582
// TODO read from extended attribute for project / group spaces

0 commit comments

Comments
 (0)