Whamcloud - gitweb
LU-14779 utils: no DNS lookups for NID in get_param
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 23 Jun 2021 08:20:24 +0000 (02:20 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 15 Jul 2021 03:13:58 +0000 (03:13 +0000)
commitd726d36a6ad6c77da88222d97344bb235e9b64bf
tree843c9882a74e11d4892c93c57f92adcc2a5024a4
parentaaf9d44c9523a28cffa181592a88a70935143036
LU-14779 utils: no DNS lookups for NID in get_param

Calling libcfs_str2nid() speculatively in "lctl get_param" to see
if there is a NID in the parameter name results in multiple DNS
lookups for invalid hostnames (e.g. "exports.192.168.0.10"). That
may take a very long time if there are a large number of connected
clients, and if the DNS server overloaded or is having problems.

Instead of doing these speculative NID conversions, skip the whole
NID string in the parameter name for the two known parameters that
may contain a NID ("*.exports.<NID>.*" and "*.MGC<NID>.*").  This
is considerably faster since it is only working on a local string.

If new parameters are added that contain a NID (unlikely, but
possible), then "clean_path()" would need to be updated as part
of that change.

Lustre-change: https://review.whamcloud.com/44056
Lustre-commit: f21c507fbca2afab5a5d97d4e816696a69d1c593

Test-Parameters: trivial
Fixes: 85cbe1a3ee69 ("LU-5030 util: migrate lctl params functions to use cfs_get_paths()")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I51f865e4ce3a7bc4879f9d688c4b3a68d731810f
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44281
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanity.sh
lustre/utils/lustre_cfg.c