Whamcloud - gitweb
LU-17308 mgs: move pool_cmd check to the kernel 02/53202/12
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Tue, 21 Nov 2023 19:01:43 +0000 (20:01 +0100)
committerOleg Drokin <green@whamcloud.com>
Sun, 4 Feb 2024 08:28:37 +0000 (08:28 +0000)
commitce824977a212d243e15cf07e52a91984841f9b17
tree26b05fd0a97371eabe77ff30740e7cec2d996bfc
parent9fc12ca7f29bd70be19471c2b9143d50d2e24eda
LU-17308 mgs: move pool_cmd check to the kernel

Several checks for pool_cmd need to be done before touching the MGS
configuration.

e.g: the following case should be denied before adding a destroy
record in the MGS configurations:
 - The pool does not exist
 - The pool is not empty (OSTs still in the pool)

This work is done in userspace (check_pool_cmd) by checking the client
lov parameters for pools. But nothing guarantees those parameters to
be in sync. So, only the MGS configuration should be trusted for that.

This patch move those checks in the kernel. There are several reasons
for this:
 - It guarantees the pool configurations consistency even if an
   external tool is used.
 - For standalone MGS, it limits the overhead of reading the
   configuration several times.

This patch add a "-n|--nowait" option for pool_cmd to skip waiting
for pool updates on the clients. This is useful when doing a lot of
pool_cmd in a raw. And this avoids cancelling clients CONFIG lock
each times (because of mgc_requeue_timeout_min).

e.g:
  lctl pool_destroy -n lustre.old
  lctl pool_new -n lustre.test
  lctl pool_add -n lustre.test OST0001
  ...
  lctl pool_add lustre.test OST0010

check_pool_cmd_result() is modified to compute the client wait delay
with mgc_requeue_timeout_min.

Add a regression test "ost-pools 2f".

Test-Parameters: testlist=ost-pools
Test-Parameters: testlist=ost-pools
Test-Parameters: testlist=ost-pools env=ONLY=2f,ONLY_REPEAT=50
Test-Parameters: testlist=ost-pools env=ONLY=2f,ONLY_REPEAT=50
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: Ifbc49b5667bf17253716052a7480114936c65149
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53202
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Guillaume Courrier <guillaume.courrier@cea.fr>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/doc/lctl-pool_add.8
lustre/doc/lctl-pool_new.8
lustre/mgs/mgs_llog.c
lustre/tests/ost-pools.sh
lustre/utils/lctl.c
lustre/utils/obd.c