[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
Subject: LU-13224 utils: expose lctl functionality via lustreapi
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 4641f2b945b7f51fdd8783f0b8238a0f7c99551f

Comment by Gerrit Updater [ 20/Mar/20 ]

Gian-Carlo DeFazio (defazio1@llnl.gov) uploaded a new patch: https://review.whamcloud.com/38011
Subject: LU-13224 utils: insignificant changes to compare tests.
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: a96243e315bede22a1bfbe934e21badf2e315e6e

Comment by Gerrit Updater [ 07/Apr/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/37545/
Subject: LU-13224 utils: expose llapi_param* functions
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 9b44cf70a95b2ee97a17697dc97fbe462ad1f5b9

Comment by Gerrit Updater [ 15/Apr/20 ]

Gian-Carlo DeFazio (defazio1@llnl.gov) uploaded a new patch: https://review.whamcloud.com/38239
Subject: LU-13224 utils: expose llapi_param* functions
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: bbb9485b7d63c5aea42ad65e664b88d55a40da76

Comment by Gerrit Updater [ 21/Apr/20 ]

Gian-Carlo DeFazio (defazio1@llnl.gov) uploaded a new patch: https://review.whamcloud.com/38299
Subject: LU-13224 utils: expose llapi_param* functions
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: a3f90f10a23e14b07c9250e07b3aacc21757979d

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/
Subject: LU-13224 utils: expose llapi_param* functions
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: c1ff1110d090686833196918ccf289cf62a280d6

Generated at Sat Feb 10 02:59:27 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.