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

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) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 5cfdadf9104b476cdf4944ae1d0a12dbfae3e63e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Thu, 7 Nov 2019 10:37:13 -0500
Subject: [PATCH] lxd/storage/dir: Don't apply quotas on snapshots
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/storage/drivers/driver_dir.go | 29 ++---------------------------
 1 file changed, 2 insertions(+), 27 deletions(-)

diff --git a/lxd/storage/drivers/driver_dir.go 
b/lxd/storage/drivers/driver_dir.go
index fdb9507217..d9395933bc 100644
--- a/lxd/storage/drivers/driver_dir.go
+++ b/lxd/storage/drivers/driver_dir.go
@@ -767,19 +767,13 @@ func (d *dir) deleteQuota(path string, volID int64) error 
{
 
 // CreateVolumeSnapshot creates a snapshot of a volume.
 func (d *dir) CreateVolumeSnapshot(volType VolumeType, volName string, 
newSnapshotName string, op *operations.Operation) error {
-       // Get the volume ID for the parent volume, which is used to set 
project quota on snapshot.
-       volID, err := d.getVolID(volType, volName)
-       if err != nil {
-               return err
-       }
-
        srcPath := GetVolumeMountPath(d.name, volType, volName)
        fullSnapName := GetSnapshotVolumeName(volName, newSnapshotName)
        snapVol := NewVolume(d, d.name, volType, ContentTypeFS, fullSnapName, 
nil)
        snapPath := snapVol.MountPath()
 
        // Create snapshot directory.
-       err = snapVol.CreateMountPath()
+       err := snapVol.CreateMountPath()
        if err != nil {
                return err
        }
@@ -787,17 +781,10 @@ func (d *dir) CreateVolumeSnapshot(volType VolumeType, 
volName string, newSnapsh
        revertPath := true
        defer func() {
                if revertPath {
-                       d.deleteQuota(snapPath, volID)
                        os.RemoveAll(snapPath)
                }
        }()
 
-       // Initialise the snapshot's quota with the parent volume's ID.
-       err = d.initQuota(snapPath, volID)
-       if err != nil {
-               return err
-       }
-
        bwlimit := d.config["rsync.bwlimit"]
 
        // Copy volume into snapshot directory.
@@ -813,22 +800,10 @@ func (d *dir) CreateVolumeSnapshot(volType VolumeType, 
volName string, newSnapsh
 // DeleteVolumeSnapshot removes a snapshot from the storage device. The 
volName and snapshotName
 // must be bare names and should not be in the format "volume/snapshot".
 func (d *dir) DeleteVolumeSnapshot(volType VolumeType, volName string, 
snapshotName string, op *operations.Operation) error {
-       // Get the volume ID for the parent volume, which is used to remove 
project quota.
-       volID, err := d.getVolID(volType, volName)
-       if err != nil {
-               return err
-       }
-
        snapPath := GetVolumeMountPath(d.name, volType, 
GetSnapshotVolumeName(volName, snapshotName))
 
-       // Remove the project quota.
-       err = d.deleteQuota(snapPath, volID)
-       if err != nil {
-               return err
-       }
-
        // Remove the snapshot from the storage device.
-       err = os.RemoveAll(snapPath)
+       err := os.RemoveAll(snapPath)
        if err != nil {
                return err
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to