[lustre-discuss] llapi documentation

Andreas Dilger adilger at whamcloud.com
Thu Jun 16 20:36:41 PDT 2022


On Jun 15, 2022, at 06:56, John Bauer <bauerj at iodoctors.com<mailto:bauerj at iodoctors.com>> wrote:



Andreas,

Thanks for the info.  It got me a lot farther down the road. A few comments:

1)  It appears that the values returned in the poollist argument to llapi_get_poollist() are temporary.  I used the values in poollist in the call to llapi_get_poolmembers( poollist[i],...).  Works great on the first call to get_poolmembers(), but subsequent calls fail and it appears the poollist has been overwritten.  If I make my own copy of the strings in poollist before calling get_poolmembers, everythings works well.

The pool names are stored in the passed "buffer" so if this is re-used then the old pointers will be invalid.  The reason to have a pointer array to point into the buffer is to avoid the need to alloc/free a separate pointer for each pool name on each call.

If this is indeed the case, it should be noted.

2)  There are prints to stdout or stderr resulting from calls to these llapi functions.

llapi_get_poollist generates a print of:Pools from nbp17:

llapi_get_poolmembers generates a print of:Pool: nbp17.1_ssd

Seems undesirable to have llapi doing unrequested prints.

Yes, this is a bug - the llapi_printf() calls should be moved to the callers that care about it instead of being in the library function.  In the meantime, you can hook llapi_printf() and llapi_error() with llapi_error_callback_set() and llapi_info_callback_set() respectively, so that they do not print to the console.

3)  What is the buffer argument good for ( last argument for each of the functions )?  It appears to be populated with the first value in the array.

See above.  The buffer actually holds the pool names, the pool array is just pointers into the buffer.

4)  Here is output from my test program.  There are 10 poolNames.  All works great until I get to the pool that has 64 members ( which I know from other paths ).  The 2nd argument to llapi_get_poolmembers() is a 'char *poolMembers[256]'.  Plenty of room, but the call fails

with a return value of -75.  Why?

-75 = -EOVERFLOW.  Probably the buffer is too small to hold all of the pool names.

Cheers, Andreas

Pools from nbp17:
poollist_get() nPool=10 buffer=nbp17.1_hdd
Pool: nbp17.1_hdd
poollist_get() poolNames[0]=nbp17.1_hdd 8 members buffer=nbp17-OST0000_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[0]=nbp17-OST0000_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[1]=nbp17-OST0001_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[2]=nbp17-OST0002_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[3]=nbp17-OST0003_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[4]=nbp17-OST0004_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[5]=nbp17-OST0005_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[6]=nbp17-OST0006_UUID
poollist_get()       poolNames[0]=nbp17.1_hdd members[7]=nbp17-OST0007_UUID
Pool: nbp17.1_ssd
poollist_get() poolNames[1]=nbp17.1_ssd 8 members buffer=nbp17-OST0064_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[0]=nbp17-OST0064_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[1]=nbp17-OST0065_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[2]=nbp17-OST0066_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[3]=nbp17-OST0067_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[4]=nbp17-OST0068_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[5]=nbp17-OST0069_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[6]=nbp17-OST006a_UUID
poollist_get()       poolNames[1]=nbp17.1_ssd members[7]=nbp17-OST006b_UUID
Pool: nbp17.2_hdd
poollist_get() poolNames[2]=nbp17.2_hdd 8 members buffer=nbp17-OST0008_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[0]=nbp17-OST0008_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[1]=nbp17-OST0009_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[2]=nbp17-OST000a_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[3]=nbp17-OST000b_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[4]=nbp17-OST000c_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[5]=nbp17-OST000d_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[6]=nbp17-OST000e_UUID
poollist_get()       poolNames[2]=nbp17.2_hdd members[7]=nbp17-OST000f_UUID
Pool: nbp17.2_ssd
poollist_get() poolNames[3]=nbp17.2_ssd 8 members buffer=nbp17-OST006c_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[0]=nbp17-OST006c_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[1]=nbp17-OST006d_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[2]=nbp17-OST006e_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[3]=nbp17-OST006f_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[4]=nbp17-OST0070_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[5]=nbp17-OST0071_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[6]=nbp17-OST0072_UUID
poollist_get()       poolNames[3]=nbp17.2_ssd members[7]=nbp17-OST0073_UUID
Pool: nbp17.3_hdd
poollist_get() poolNames[4]=nbp17.3_hdd 8 members buffer=nbp17-OST0010_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[0]=nbp17-OST0010_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[1]=nbp17-OST0011_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[2]=nbp17-OST0012_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[3]=nbp17-OST0013_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[4]=nbp17-OST0014_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[5]=nbp17-OST0015_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[6]=nbp17-OST0016_UUID
poollist_get()       poolNames[4]=nbp17.3_hdd members[7]=nbp17-OST0017_UUID
Pool: nbp17.3_ssd
poollist_get() poolNames[5]=nbp17.3_ssd 8 members buffer=nbp17-OST0074_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[0]=nbp17-OST0074_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[1]=nbp17-OST0075_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[2]=nbp17-OST0076_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[3]=nbp17-OST0077_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[4]=nbp17-OST0078_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[5]=nbp17-OST0079_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[6]=nbp17-OST007a_UUID
poollist_get()       poolNames[5]=nbp17.3_ssd members[7]=nbp17-OST007b_UUID
Pool: nbp17.4_hdd
poollist_get() poolNames[6]=nbp17.4_hdd 8 members buffer=nbp17-OST0018_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[0]=nbp17-OST0018_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[1]=nbp17-OST0019_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[2]=nbp17-OST001a_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[3]=nbp17-OST001b_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[4]=nbp17-OST001c_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[5]=nbp17-OST001d_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[6]=nbp17-OST001e_UUID
poollist_get()       poolNames[6]=nbp17.4_hdd members[7]=nbp17-OST001f_UUID
Pool: nbp17.4_ssd
poollist_get() poolNames[7]=nbp17.4_ssd 8 members buffer=nbp17-OST007c_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[0]=nbp17-OST007c_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[1]=nbp17-OST007d_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[2]=nbp17-OST007e_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[3]=nbp17-OST007f_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[4]=nbp17-OST0080_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[5]=nbp17-OST0081_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[6]=nbp17-OST0082_UUID
poollist_get()       poolNames[7]=nbp17.4_ssd members[7]=nbp17-OST0083_UUID
Pool: nbp17.hdd-pool
poollist_get() poolNames[8]=nbp17.hdd-pool -75 members buffer=nbp17-OST0000_UUID
Pool: nbp17.ssd-pool
poollist_get() poolNames[9]=nbp17.ssd-pool -75 members buffer=nbp17-OST0064_UUID


John

On 6/15/22 02:08, Andreas Dilger wrote:
On Jun 14, 2022, at 05:32, John Bauer <bauerj at iodoctors.com<mailto:bauerj at iodoctors.com>> wrote:

I have had little success in my search for documentation on pool functions in llapi. I've looked in:

https://wiki.lustre.org/PFL2_High_Level_Design

https://doc.lustre.org/lustre_manual.xhtml#managingstripingfreespace


I'm looking for info on llapi_get_poollist() and llapi_get_poolmembers().  I've found the prototype in /usr/include/lustre/lustreapi.h, but that's about it.

Can anyone point me to some documentation?

it looks like there aren't man pages for these functions, just the function comment blocks
in the code, and their usage internally:

/**
 * Get the list of pools in a filesystem.
 * \param name        filesystem name or path
 * \param poollist    caller-allocated array of char*
 * \param list_size   size of the poollist array
 * \param buffer      caller-allocated buffer for storing pool names
 * \param buffer_size size of the buffer
 *
 * \return number of pools retrieved for this filesystem
 * \retval -error failure
 */
int llapi_get_poollist(const char *name, char **poollist, int list_size,
                       char *buffer, int buffer_size)

/**
 * Get the list of pool members.
 * \param poolname    string of format \<fsname\>.\<poolname\>
 * \param members     caller-allocated array of char*
 * \param list_size   size of the members array
 * \param buffer      caller-allocated buffer for storing OST names
 * \param buffer_size size of the buffer
 *
 * \return number of members retrieved for this pool
 * \retval -error failure
 */
int llapi_get_poolmembers(const char *poolname, char **members,
                          int list_size, char *buffer, int buffer_size)

Patches to add llapi_get_poollist.3 and llapi_get_poolmembers.3 (and related) man
pages welcome. The pool related functions should probably be moved into a new
liblustreapi_pool.c file to reduce the size of liblustreapi.c.

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Whamcloud







On 6/15/22 02:08, Andreas Dilger wrote:
On Jun 14, 2022, at 05:32, John Bauer <bauerj at iodoctors.com<mailto:bauerj at iodoctors.com>> wrote:

I have had little success in my search for documentation on pool functions in llapi. I've looked in:

https://wiki.lustre.org/PFL2_High_Level_Design

https://doc.lustre.org/lustre_manual.xhtml#managingstripingfreespace


I'm looking for info on llapi_get_poollist() and llapi_get_poolmembers().  I've found the prototype in /usr/include/lustre/lustreapi.h, but that's about it.

Can anyone point me to some documentation?

it looks like there aren't man pages for these functions, just the function comment blocks
in the code, and their usage internally:

/**
 * Get the list of pools in a filesystem.
 * \param name        filesystem name or path
 * \param poollist    caller-allocated array of char*
 * \param list_size   size of the poollist array
 * \param buffer      caller-allocated buffer for storing pool names
 * \param buffer_size size of the buffer
 *
 * \return number of pools retrieved for this filesystem
 * \retval -error failure
 */
int llapi_get_poollist(const char *name, char **poollist, int list_size,
                       char *buffer, int buffer_size)

/**
 * Get the list of pool members.
 * \param poolname    string of format \<fsname\>.\<poolname\>
 * \param members     caller-allocated array of char*
 * \param list_size   size of the members array
 * \param buffer      caller-allocated buffer for storing OST names
 * \param buffer_size size of the buffer
 *
 * \return number of members retrieved for this pool
 * \retval -error failure
 */
int llapi_get_poolmembers(const char *poolname, char **members,
                          int list_size, char *buffer, int buffer_size)

Patches to add llapi_get_poollist.3 and llapi_get_poolmembers.3 (and related) man
pages welcome. The pool related functions should probably be moved into a new
liblustreapi_pool.c file to reduce the size of liblustreapi.c.

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Whamcloud








Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Whamcloud







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-discuss-lustre.org/attachments/20220617/1c317522/attachment-0001.htm>


More information about the lustre-discuss mailing list