Description
I was trying to create a new nodemap and used the command:
# lctl nodemap_add nodemap.1 error: invalid ioctl: 000ce040 errno: 22: Invalid argument nodemap_add: Invalid argument
This returned a rather vague "invalid argument" error, but didn't say what was wrong with the command. I tried several other variants without success:
# lctl nodemap_add --name nodemap.1 error: invalid ioctl: 000ce040 errno: 22: Invalid argument nodemap_add: Invalid argument # lctl nodemap_add --help error: invalid ioctl: 000ce040 errno: 22: Invalid argument nodemap_add: Invalid argument # lctl nodemap_add --name nodemap1 error: invalid ioctl: 000ce040 errno: 22: Invalid argument
The correct command format is:
# lctl help nodemap_add nodemap_add: add a new nodemap usage: nodemap_add <nodemap_name>
Firstly, it would be good if the usage message was printed if the command fails.
Secondly, it would be good to print a useful error message other than just "invalid argument", like "lctl nodemap_add: error: nodemap name can only contain alphanumeric characters, '-' and '_'" (or whatever the naming rules are).
Thirdly, it probably makes sense to special case nodemap names like "--name|-n" (since this is used for all of the other nodemap commands), and "--help|-h" (since this is a standard argument that users expect to actually give them some helpful information).
These changes should be reflected in the lustre/doc/lctl-nodemap_add.8 man page.