Details
Description
It would be useful to allow names to be mapped to projid numbers using the /etc/projid file (projid.5), as is used by the XFS quota utility (xfs_quota.8):
usera:1 userc:3
There should be a new function struct ll_project *llapi_getprjname(const char *name) function that is called by lfs and lctl to read the /etc/projid file and lookup the name and return the projid, while struct ll_project *llapi_getprjid(__u32 prjid) would lookup the numeric project ID and return the name:
struct ll_project { __u32 lp_projid; char *lp_name; };
Returning the struct instead of a single value (name or prjid) allows expanding this interface in the future (e.g. to list which users are allowed to use/change the group, passwords for the group, etc. as with getgrnam(), getgrgid(), getpwnam(), getpwuid()).
It isn't very clear what benefit the /etc/projects file (projects.5) provides, so I'm not yet sure whether we need to implement support for this or not.
This should be available for use by lfs project -p, lfs find -projid, lfs quota -p, lfs setquota -p.
Attachments
Issue Links
- has to be done before
-
LU-18659 add new 'lfs projectadd' command to add project entries to the /etc/projid file
-
- Open
-
-
LU-18638 print project name with 'lfs project'
-
- Open
-
-
LU-18640 add option for 'lfs project' to do project name and id lookup only
-
- Open
-
- is related to
-
LU-14915 Add project flags to manage the project's directories and files
-
- Open
-
-
LU-14968 add password for project files
-
- Open
-
-
LU-17702 'lfs quota -u $USER' should print quota for all Lustre mountpoints
-
- Resolved
-
- is related to
-
LU-12056 tar doesn't support project id
-
- Resolved
-
-
LU-18661 allow enable/disable projname->username fallback
-
- Open
-
nathand, native LDAP projid support would require extensions to the glibc /etc/nsswitch and sssd functionality to allow a "project" database lookup, which is mostly out of scope for this feature. It would be useful to develop in the future, as proposed in my previous comment-322655:
In the absence of sssd "project" database functionality, my previous proposal in comment-311464 was to overload the "passwd" database to do network-managed name->ID lookups, since many sites I'm familar with are using PROJID=UID for the user "home/" directories, and some mapping like "PROJID=(UID+1000000)" for "project/" and "PROJID=(UID+2000000)" for "scratch/" or similar:
It is reasonable that this fallback to use the passwd database to do UID->PROJID mapping should be configurable/disabled in /etc/projid, so that this functionality can be avoided if it is undesirable (e.g. there is no consistent UID->PROJID mapping, or network database access from the compute nodes is undesirable, or whatever is the reason as I don't like imposing arbitrary policy on the end user).
Alternately, this could be opt-in by specifying a "project name" like "-p u:adilger" or "-p g:adilger" to do a user or group database lookup, respectively, and use the resulting UID or GID for the PROJID. This puts a bit more burden on the admin to specify the database prefix correctly each time. I don't think it is valid to have a ':' in the username because /etc/passwd already uses this as a field separator, so that shouldn't cause any compatibility issues.
I don't mind having both mechanisms available, and it is up to the admin to use the one that they prefer, since this is only "lfs" internal complexity (and not very much at that), and the filesystem still only sees a single number as the end result.