[lustre-discuss] How to obtain the total number of available OSTs when poolname is empty

Andreas Dilger adilger at thelustrecollective.com
Sat Dec 20 12:13:27 PST 2025


There is a function to return the number of OSTs at a specific directory (it does not need to be the mount point of the filesystem):

int llapi_get_obd_count(char *dir, int *count, int is_mdt);

that looks like what you want.  It appears there is no man page for this, so it should be added. 

Cheers, Andreas

> On Dec 20, 2025, at 12:45, Wei-Keng Liao via lustre-discuss <lustre-discuss at lists.lustre.org> wrote:
> 
> 
> I am trying to get the total number of available OSTs given
> a folder name, through calls of Luster user C APIs, but failed
> to do so, when a layout has no pool name. I have tried the followings.
> 
> At first, call llapi_layout_get_by_fd() to obtain a folder's 'layout'.
> 
> llapi_layout_pool_name_get() returns successfully, but the returned
> pool_name is empty.
> 
> llapi_getname() returns a valid fsname.
> 
> llapi_get_poolmembers() returns -22 (i.e. -EINVAL), when using
> the 'fsname' as the argument 'poolname.'
> 
> If I appended a dot, '.', to fsname, llapi_get_poolmembers() returns
> successfully, but the returned value is 0 (number of members).
> 
> When doing my experiments on Polaris at ALCF, I have also tried
> the following lfs commands at the prompt of login node.
> 
> % lfs  pool_list /eagle
> Pools from eagle:
> 
> % lfs getname -n /eagle
> eagle
> 
> % lfs osts /eagle |wc -l
> 161
> 
> Command 'lfs osts /eagle' shows there are 160 OSTs.
> 
> On Perlmutter at NERSC, its Lustre has a pool name, and thus
> I was able to make the above Lustre user API calls to retrieve
> the total number of available OSTs.
> 
> In summary, my question is how do I properly make calls to Lustre
> user C APIs when a layout has no pool name?
> 
> 
> Wei-keng Liao
> _______________________________________________
> lustre-discuss mailing list
> lustre-discuss at lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org


More information about the lustre-discuss mailing list