The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7166

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Also allows quota to be removed by setting to 0.

Fixes #7164

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From c551d535f2471c60e1f283adf24beb460dd4db22 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@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.parr...@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)
 }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to