From 518540009ebe57664191da3038f4bbf134020ad6 Mon Sep 17 00:00:00 2001 From: David Christofas Date: Thu, 23 Feb 2023 12:56:58 +0100 Subject: [PATCH] set max quota as space quota When CreateStorageSpace is called without a quota but a max quota was set then the space can at most have max quota. --- changelog/unreleased/quota.md | 1 + pkg/storage/utils/decomposedfs/spaces.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/changelog/unreleased/quota.md b/changelog/unreleased/quota.md index 01434a6e71..039965d098 100644 --- a/changelog/unreleased/quota.md +++ b/changelog/unreleased/quota.md @@ -4,5 +4,6 @@ Added a global max quota option to limit how much quota can be assigned to space Added a max quota value in the spacescapabilities. Added a quota parameter to CreateHome. This is a prerequisite for setting a default quota per usertypes. +https://github.com/cs3org/reva/pull/3682 https://github.com/cs3org/reva/pull/3678 https://github.com/cs3org/reva/pull/3671 diff --git a/pkg/storage/utils/decomposedfs/spaces.go b/pkg/storage/utils/decomposedfs/spaces.go index 238ac78db3..4c13bc746d 100644 --- a/pkg/storage/utils/decomposedfs/spaces.go +++ b/pkg/storage/utils/decomposedfs/spaces.go @@ -145,6 +145,10 @@ func (fs *Decomposedfs) CreateStorageSpace(ctx context.Context, req *provider.Cr return nil, errtypes.BadRequest("decompsedFS: requested quota is higher than allowed") } metadata[prefixes.QuotaAttr] = strconv.FormatUint(q.QuotaMaxBytes, 10) + } else if fs.o.MaxQuota != quotaUnrestricted { + // If no quota was requested but a max quota was set then the the storage space has a quota + // of max quota. + metadata[prefixes.QuotaAttr] = strconv.FormatUint(fs.o.MaxQuota, 10) } if description != "" {