Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-12521

print_instance() incorrect if fsname contains a dash

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • Lustre 2.14.0
    • None
    • None
    • 9223372036854775807

    Description

      As discussed on gerrit comments, llapi_getname() is hard to use.

      v2_12_0-RC3-2-gcd294a1255 added this comment that explains the problem:

      /*
       * We want to turn testfs-clilov-ffff88002738bc00 into
       * testfs-ffff88002738bc00 in a portable way that doesn't depend
       * on what is after "-clilov-" as it may change in the future.
       * Unfortunately, the "fsname" part may contain a dash, so we
       * can't just skip to the first dash, and the "instance" may be a
       * UUID in the future, so we can't necessarily go to the last dash.
       */
      

      so the string returned by llapi_getname() can contain dashes in the fsname now and might contain dashes in the instance part later on, meaning that users who need either just the fsname or just the instance will be troubled to split the string again if necessary.

      I had misread Andreas' comment as that llapi_getname() was new with v2_12_53-6-g2a4821b836 and its API could be changed but llapi_getname() itself is fairly old and we probably do not want to change it, so I assume we should at least fix print_instance to use strrchr instead of strchr for now.

      Ideally I'd want some version of llapi_getname where we could add an argument saying we want either one, the other or both informations in the returned string, or maybe have it also return the position of the beginning of the instance so the user could split it themselves if required? But I do not see how to change that cleanly without adding yet another hardly used function, so I do not think this is a good idea anymore.

      Happy to provide a patch either way if you tell me where we want to go, this also is fairly simple.

      Thanks,

      Dominique

      Attachments

        Issue Links

          Activity

            People

              adilger Andreas Dilger
              cealustre CEA
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: