Skip to content

Commit

Permalink
eosfs: move set quota logic to nominal home creation branch
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Feb 15, 2021
1 parent f21e233 commit 5c723ea
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,25 @@ func (fs *eosfs) createNominalHome(ctx context.Context) error {
}

err = fs.createUserDir(ctx, u, home, false)
if err != nil {
err := errors.Wrap(err, "eosfs: error creating user dir")
return err
}

// set quota for user
quotaInfo := &eosclient.SetQuotaInfo{
Username: u.Username,
MaxBytes: fs.conf.DefaultQuotaBytes,
MaxFiles: fs.conf.DefaultQuotaFiles,
QuotaNode: fs.conf.QuotaNode,
}

err = fs.c.SetQuota(ctx, uid, gid, quotaInfo)
if err != nil {
err := errors.Wrap(err, "eosfs: error setting quota")
return err
}

return err
}

Expand Down Expand Up @@ -926,20 +945,6 @@ func (fs *eosfs) createUserDir(ctx context.Context, u *userpb.User, path string,
}
}

// set quota for user
quotaInfo := &eosclient.SetQuotaInfo{
Username: u.Username,
MaxBytes: fs.conf.DefaultQuotaBytes,
MaxFiles: fs.conf.DefaultQuotaFiles,
QuotaNode: fs.conf.QuotaNode,
}

err = fs.c.SetQuota(ctx, uid, gid, quotaInfo)
if err != nil {
err := errors.Wrap(err, "eosfs: error setting quota")
return err
}

return nil
}

Expand Down Expand Up @@ -987,6 +992,7 @@ func (fs *eosfs) CreateReference(ctx context.Context, p string, targetURI *url.U
if err != nil {
return nil
}

if err := fs.createUserDir(ctx, u, tmp, false); err != nil {
err = errors.Wrapf(err, "eos: error creating temporary ref file")
return err
Expand Down

0 comments on commit 5c723ea

Please sign in to comment.