diff --git a/lxd/storage/drivers/driver_dir_utils.go b/lxd/storage/drivers/driver_dir_utils.go index 6300990368c2..b521deeb986f 100644 --- a/lxd/storage/drivers/driver_dir_utils.go +++ b/lxd/storage/drivers/driver_dir_utils.go @@ -120,14 +120,15 @@ func (d *dir) setQuota(path string, volID int64, sizeBytes int64) error { // Clear and create new project if desired project ID is different. if currentProjectID != d.quotaProjectID(volID) { - err = quota.DeleteProject(path, currentProjectID) + err = quota.SetProject(path, projectID) if err != nil { - return err + return fmt.Errorf("Failed setting project: %w", err) } - err = quota.SetProject(path, projectID) + // Unset the quota on the current project. + err = quota.SetProjectQuota(path, currentProjectID, 0) if err != nil { - return fmt.Errorf("Failed setting project: %w", err) + return err } }