Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incusd/storage/driver/dir: Don't needlessly re-apply project id on qu… #1163

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions internal/server/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
}
}

// Initialize the project.
err = quota.SetProject(path, projectID)
if err != nil {
return err
err = quota.SetProject(path, projectID)
if err != nil {
return err
}
}

// Set the project quota size.
Expand Down
4 changes: 4 additions & 0 deletions internal/server/storage/quota/projectquota.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ func GetProject(path string) (uint32, error) {
func SetProject(path string, id uint32) error {
err := filepath.Walk(path, func(filePath string, info os.FileInfo, err error) error {
if err != nil {
if os.IsNotExist(err) {
return nil
}

return err
}

Expand Down
Loading