Skip to content

Commit

Permalink
lxd/storage/drivers: Don't needlessly re-apply project id on quota ch…
Browse files Browse the repository at this point in the history
…anges

Signed-off-by: Stéphane Graber <[email protected]>
Reported-by: Marius Klocke <[email protected]>
(cherry picked from commit 4d4f97804721014a78fefb16d10126ae5556d436)
Signed-off-by: hamistao <[email protected]>
License: Apache-2.0
  • Loading branch information
stgraber authored and hamistao committed Aug 30, 2024
1 parent c0108aa commit ee16591
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lxd/storage/drivers/driver_dir_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,17 @@ func (d *dir) setQuota(path string, volID int64, sizeBytes int64) error {
return err
}

// Remove current project if desired project ID is different.
// Clear and create new project if desired project ID is different.
if currentProjectID != d.quotaProjectID(volID) {
err = quota.DeleteProject(path, currentProjectID)
if err != nil {
return err
}
}

// Initialise the project.
err = quota.SetProject(path, projectID)
if err != nil {
return fmt.Errorf("Failed setting project: %w", err)
err = quota.SetProject(path, projectID)
if err != nil {
return fmt.Errorf("Failed setting project: %w", err)
}
}

// Set the project quota size.
Expand Down

0 comments on commit ee16591

Please sign in to comment.