[lxc-devel] [lxd/master] lxd/storage/drivers/driver/dir/utils: Removes default project quota

tomponline on Github lxc-bot at linuxcontainers.org
Thu Apr 9 16:14:44 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 428 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200409/8e7e6844/attachment-0001.bin>
-------------- next part --------------
From c551d535f2471c60e1f283adf24beb460dd4db22 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 9 Apr 2020 17:13:33 +0100
Subject: [PATCH] lxd/storage/drivers/driver/dir/utils: Removes default project
 quota

Also allows quota to be removed by setting to 0.

Fixes #7164

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/drivers/driver_dir_utils.go | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/lxd/storage/drivers/driver_dir_utils.go b/lxd/storage/drivers/driver_dir_utils.go
index 5b3e76f0d2..4ca5e3035e 100644
--- a/lxd/storage/drivers/driver_dir_utils.go
+++ b/lxd/storage/drivers/driver_dir_utils.go
@@ -125,7 +125,7 @@ func (d *dir) quotaProjectID(volID int64) uint32 {
 // setQuota sets the project quota on the path. The volID generates a quota project ID.
 func (d *dir) setQuota(path string, volID int64, size string) error {
 	if volID == volIDQuotaSkip {
-		// Disabled on purpose, just ignore
+		// Disabled on purpose, just ignore.
 		return nil
 	}
 
@@ -133,11 +133,6 @@ func (d *dir) setQuota(path string, volID int64, size string) error {
 		return fmt.Errorf("Missing volume ID")
 	}
 
-	// If size not specified in volume config, then use pool's default size setting.
-	if size == "" || size == "0" {
-		size = defaultBlockSize
-	}
-
 	sizeBytes, err := units.ParseByteSizeString(size)
 	if err != nil {
 		return err
@@ -152,10 +147,5 @@ func (d *dir) setQuota(path string, volID int64, size string) error {
 		return nil
 	}
 
-	err = quota.SetProjectQuota(path, d.quotaProjectID(volID), sizeBytes)
-	if err != nil {
-		return err
-	}
-
-	return nil
+	return quota.SetProjectQuota(path, d.quotaProjectID(volID), sizeBytes)
 }


More information about the lxc-devel mailing list