[LU-13224] Expose lctl get/set/list param functionality in lustreapi Created: 08/Feb/20 Updated: 23/Apr/20 Resolved: 21/Apr/20 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.10.8 |
| Fix Version/s: | Lustre 2.14.0, Lustre 2.12.5 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Gian-Carlo Defazio | Assignee: | Gian-Carlo Defazio |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | llnl | ||
| Environment: |
RHEL 7.5 |
||
| Rank (Obsolete): | 9223372036854775807 |
| Description |
|
Allow applications that need to access the various lustre parameters in sysfs, profs, etc. to call a function from lustreapi.h that behaves similarly to "lctl get_param <param name>" and has the option to return data to any FILE*, so that it can be further processed by the calling application. The goal is to use the same infrastructure that allows lctl to know where the correct files are without having to create an lctl process for each get, set, and list operation. The target applications are those that need to continuously monitor lustre, such as LMT. |
| Comments |
| Comment by Andreas Dilger [ 08/Feb/20 ] |
|
There are already functions in liblustreapi_param.c that do this, they just haven't been exposed publicly yet. Please take a look at get_lustre_param_path() and get_lustre_param_value(). If they seem suitable for your use, we can expose them as proper llapi_* functions. Otherwise, feedback is welcome. |
| Comment by Gian-Carlo Defazio [ 10/Feb/20 ] |
|
get_lustre_param_path() and get_lustre_param_value() do most of what I'm looking for. However, get_lustre_param_value() reads only the first line of the first file that matches some pattern. I'd like a more flexible interface that can do some of what lctl does, such as reading all lines of all files that match. The solution I've come up with moves, and slightly modifies, some functions from lustre_cfg.c to liblustreapi.c and then exposes them using lustreapi.h.}} |
| Comment by Andreas Dilger [ 11/Feb/20 ] |
|
I'm OK with changing the get_lustre_param_{path,value}() interface slightly, since those are not officially supported APIs. The new function names should preferably be something like llapi_param_get_{path,value}() so the names are more closely related. Alternately, you could add a third interface like llapi_param_get_values() or llapi_param_get_all() that returns all of the fields. What might be even more helpful would be llapi_param_get_value_matching() that can parse out matching subfields of YAML data and return only the data from one field. |
| Comment by Gerrit Updater [ 11/Feb/20 ] |
|
Gian-Carlo DeFazio (defazio1@llnl.gov) uploaded a new patch: https://review.whamcloud.com/37545 |
| Comment by Gerrit Updater [ 20/Mar/20 ] |
|
Gian-Carlo DeFazio (defazio1@llnl.gov) uploaded a new patch: https://review.whamcloud.com/38011 |
| Comment by Gerrit Updater [ 07/Apr/20 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/37545/ |
| Comment by Gerrit Updater [ 15/Apr/20 ] |
|
Gian-Carlo DeFazio (defazio1@llnl.gov) uploaded a new patch: https://review.whamcloud.com/38239 |
| Comment by Gerrit Updater [ 21/Apr/20 ] |
|
Gian-Carlo DeFazio (defazio1@llnl.gov) uploaded a new patch: https://review.whamcloud.com/38299 |
| Comment by James A Simmons [ 21/Apr/20 ] |
|
Can this be closed? |
| Comment by Andreas Dilger [ 21/Apr/20 ] |
|
Closing this issue. The backports can land independently. |
| Comment by Gerrit Updater [ 23/Apr/20 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/38239/ |