Whamcloud - gitweb
LU-18927 lnet: Fix lnetctl fault commands 07/58807/3
authorChris Horn <chris.horn@hpe.com>
Tue, 15 Apr 2025 15:24:58 +0000 (09:24 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 21 May 2025 05:17:46 +0000 (05:17 +0000)
commit00f35f207a464bdef27d9424211edd1515f20d6b
treee07a187223b4443c447c49f5d53229610398e326
parent2354f2f040d6c581bf6e523de9dd26f5467ae7c4
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>
lnet/lnet/net_fault.c
lnet/utils/lnetctl.c
lustre/tests/sanity-lnet.sh
lustre/tests/test-framework.sh