LU-18927 lnet: Fix lnetctl fault commands
Various lnetctl fault commands are broken. It seems they never really
worked. Several fixes are made and the commands are refactored.
To faciliate refactoring the code the commands have been reworked to
drop the required --rule_type option. For example,
"lnetctl fault add --rule_type drop" is now "lnetctl fault drop add"
"lnetctl fault del --rule_type delay" is now "lnetctl fault delay del"
A couple options were missing from the add commands like message type
and portal. These are added and the getopt loop is reordered so the
cases are alphabetical.
The --all option was missing from the delete commands, this is added,
and getopt loop reordered.
Added some input validation to check that required arguments are
specified and check for some invalid combinations of options (e.g.
rate or interval must be specified, but not both).
fault_attr_nid_parse() is deleted from lnetctl.c since it is no longer
used after this refactoring.
sanity-lnet.sh has new wrappers for adding and deleting drop and delay
rules. The wrappers randomly choose to use either lctl or lnetctl to
do the add/delete.
Test-Parameters: trivial testlist=sanity-lnet
Fixes:
f1c66236c6 ("LU-10391 lnet: Fault injection add/del ioctls to netlink")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Change-Id: I81930ba9e4313e7206f474011a5c6143dd7a72d6
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58807
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Manish Regmi <mregmi@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>