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

bash completion (for now: lctl set/get_param)

Details

    • New Feature
    • Resolution: Fixed
    • Minor
    • Lustre 2.13.0
    • None
    • 9223372036854775807

    Description

      Fairly far from lustre itself... Being used to tabbing into /proc/fs/lustre, with many files moving to various subdirectories of /sys the lctl set/get_param commands are really hard to use for me without completion.

      I wrote bash completion for the *_param commands only to start with, will push to gerrit what I have right away.

      Questions:

      • is there interest in general? If not, close this and will spare my time as well
      • can we land some partial completion (e.g. right now the first level of tab works with --list-commands, but beyond that you're on your own except for params commands), or do we want something complete-ish from the start?
      • if we start with lctl, what about lfs, lnetctl, etc etc etc...
      • if we start with bash, what about zsh, fish, etc...
      • should probably install to /usr/share/bash-completion/completions/<something>, but I'm a bit lost as to where to add this bit.

      I personally don't care much - definitely won't help with other shell completions but I'd be happy to (slowly) add up other commands and update once in a while; the most critical for me really is set/get_param completion and I've set that up in our configuration management system so this is mostly freebies / possibly call for help to finish.

      Attachments

        Issue Links

          Activity

            [LU-12734] bash completion (for now: lctl set/get_param)

            Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36483/
            Subject: LU-12734 misc: add bash completion for lctl set/get_param
            Project: fs/lustre-release
            Branch: b2_12
            Current Patch Set:
            Commit: c2ae9aa442e79b0cb6e8853bc603148791034ca7

            gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36483/ Subject: LU-12734 misc: add bash completion for lctl set/get_param Project: fs/lustre-release Branch: b2_12 Current Patch Set: Commit: c2ae9aa442e79b0cb6e8853bc603148791034ca7

            Andreas Dilger (adilger@whamcloud.com) merged in patch https://review.whamcloud.com/36459/
            Subject: LU-12734 misc: allow older bash_completion versions
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 10578849c9a7cb1e1323fb98b270349651b5bf90

            gerrit Gerrit Updater added a comment - Andreas Dilger (adilger@whamcloud.com) merged in patch https://review.whamcloud.com/36459/ Subject: LU-12734 misc: allow older bash_completion versions Project: fs/lustre-release Branch: master Current Patch Set: Commit: 10578849c9a7cb1e1323fb98b270349651b5bf90

            Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36483
            Subject: LU-12734 misc: add bash completion for lctl set/get_param
            Project: fs/lustre-release
            Branch: b2_12
            Current Patch Set: 1
            Commit: 21127722c3de7de0e2c7ea621e4b916cf820f66c

            gerrit Gerrit Updater added a comment - Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36483 Subject: LU-12734 misc: add bash completion for lctl set/get_param Project: fs/lustre-release Branch: b2_12 Current Patch Set: 1 Commit: 21127722c3de7de0e2c7ea621e4b916cf820f66c

            Dominique, I tried to install the lctl bash completion on an older client (with bash-completion-1.3), and it failed with an error "bash _init_completion: command not found".  By looking at the existing helpers installed on that system, I found that replacing _init_completion with _get_comp_words_by_ref allowed the completions to work.

            It looks like the "_get_comp_words_by_ref()" function is also available in newer versions of bash_completion (at least bash-completion-2.1 uses it internally to _init_completions()). It seems to work in my light testing, but I don't know the details of what is being missed by not using _init_completions(). Do you know if that is critical?

            PS: this functionality is quite awesome. It even works properly with things like "osc.myth-*.max<tab>" to provide the "short" list of completions rather than expanding "*" to the full list.

            adilger Andreas Dilger added a comment - Dominique, I tried to install the lctl bash completion on an older client (with bash-completion-1.3 ), and it failed with an error " bash _init_completion: command not found ".  By looking at the existing helpers installed on that system, I found that replacing _init_completion with _get_comp_words_by_ref allowed the completions to work. It looks like the " _get_comp_words_by_ref() " function is also available in newer versions of bash_completion (at least bash-completion-2.1 uses it internally to _init_completions() ). It seems to work in my light testing, but I don't know the details of what is being missed by not using _init_completions() . Do you know if that is critical? PS: this functionality is quite awesome. It even works properly with things like " osc.myth-*.max<tab> " to provide the "short" list of completions rather than expanding " * " to the full list.

            Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36459
            Subject: LU-12734 misc: allow older bash_completion versions
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: f40c0e4b7e7efaf6a1ed4cad23abbf2b70892872

            gerrit Gerrit Updater added a comment - Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36459 Subject: LU-12734 misc: allow older bash_completion versions Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: f40c0e4b7e7efaf6a1ed4cad23abbf2b70892872
            pjones Peter Jones added a comment -

            Landed for 2.13

            pjones Peter Jones added a comment - Landed for 2.13

            Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36105/
            Subject: LU-12734 misc: add bash completion for lctl set/get_param
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: f87a7f2656ceff174a00933a170032f093ecc72d

            gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36105/ Subject: LU-12734 misc: add bash completion for lctl set/get_param Project: fs/lustre-release Branch: master Current Patch Set: Commit: f87a7f2656ceff174a00933a170032f093ecc72d
            adilger Andreas Dilger added a comment - - edited

            IMHO, I think your initial patch is already very useful and worthwhile to land. This is something that I've wanted for a long time.

            I think implementing this incrementally is definitely the right way to do it. Trying to do a "full" implementation for all commands would take a lot of time and be of marginal use, since many lctl commands are rarely used. The get/set/list params have by far the most optional arguments, so users need the most help with those. Also, getting the initial functionality out to users could encourage contributions from others.

            Having bash completions for "lfs setstripe" would probably be my suggestion for the next thing to tackle.

            As for completions for other shells, I think that can be left for users who care more about them. Bash is by far the most common shell, and should get the most attention.

            adilger Andreas Dilger added a comment - - edited IMHO, I think your initial patch is already very useful and worthwhile to land. This is something that I've wanted for a long time. I think implementing this incrementally is definitely the right way to do it. Trying to do a "full" implementation for all commands would take a lot of time and be of marginal use, since many lctl commands are rarely used. The get/set/list params have by far the most optional arguments, so users need the most help with those. Also, getting the initial functionality out to users could encourage contributions from others. Having bash completions for "lfs setstripe" would probably be my suggestion for the next thing to tackle. As for completions for other shells, I think that can be left for users who care more about them. Bash is by far the most common shell, and should get the most attention.
            pjones Peter Jones added a comment -

            There was enthusiastic response to this idea on the triage call today

            pjones Peter Jones added a comment - There was enthusiastic response to this idea on the triage call today

            Dominique Martinet (dominique.martinet@cea.fr) uploaded a new patch: https://review.whamcloud.com/36105
            Subject: LU-12734 misc: add bash completion for lctl set/get_param
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 0e95b514a2ed0a0ddd4ca5b43858b6220a16f2fc

            gerrit Gerrit Updater added a comment - Dominique Martinet (dominique.martinet@cea.fr) uploaded a new patch: https://review.whamcloud.com/36105 Subject: LU-12734 misc: add bash completion for lctl set/get_param Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 0e95b514a2ed0a0ddd4ca5b43858b6220a16f2fc

            People

              martinetd Dominique Martinet (Inactive)
              cealustre CEA
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: