[LTP] [PATCH] nfs: Adapt the lib to allow to test in 2-host mode
Petr Vorel
pvorel@suse.cz
Sun Feb 22 21:34:42 CET 2026
Hi Sebastian,
[ Cc Martin and Cyril ]
> nfs_lib.sh checked key server_side prerequisites on the system under test.
> In 2_host setup this incorrectly required server_side tools on lhost.
> This patch keep netns behavior unchanged, but in true 2-host mode run
> server-side checks on rhost via tst_rhost_run().
First, thank you for fixing 2 host side setup.
> Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
> ---
> testcases/network/nfs/nfs_stress/nfs_lib.sh | 22 +++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
> diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> index 1ac8bd657..e52f96a5a 100644
> --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
> +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> @@ -45,7 +45,7 @@ TST_SKIP_FILESYSTEMS="exfat,ext2,ext3,fuse,ntfs,vfat,tmpfs"
> TST_MOUNT_DEVICE=1
> TST_FORMAT_DEVICE=1
> TST_NEEDS_ROOT=1
> -TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs mount.nfs"
> +TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount mount.nfs"
> TST_SETUP="${TST_SETUP:-nfs_setup}"
> TST_CLEANUP="${TST_CLEANUP:-nfs_cleanup}"
> TST_NEEDS_DRIVERS="nfsd"
> @@ -186,10 +186,24 @@ nfs_setup()
> tst_brk TCONF "Cannot run nfs-stress test on mounted NFS"
> fi
> + if tst_net_use_netns; then
> + tst_cmd_available exportfs || tst_brk TCONF "'exportfs' not found"
You would here use tst_require_cmds exportfs, but ...
> + else
> + tst_rhost_run -c "command -v exportfs >/dev/null" || tst_brk TCONF "'exportfs' not found on rhost"
> + fi
... if you remove exportfs from TST_NEEDS_CMDS you can use the same code for
both netns and 2 based setup (tst_rhost_run should work well on netns).
I was thinking about having a special variable for checking rhost only, but
given that tst_test.sh is now also deprecated, we will have to solve this in
shell loader.
> +
> if tst_cmd_available pgrep; then
> - for i in rpc.mountd rpc.statd; do
> - pgrep $i > /dev/null || tst_brk TCONF "$i not running"
> - done
> + if tst_net_use_netns; then
> + tst_res TINFO "checking rpc.mountd/rpc.statd on lhost (netns mode)"
> + for i in rpc.mountd rpc.statd; do
> + pgrep $i > /dev/null || tst_brk TCONF "$i not running"
> + done
> + else
> + tst_res TINFO "checking rpc.mountd/rpc.statd on rhost (2-host mode)"
> + for i in rpc.mountd rpc.statd; do
> + tst_rhost_run -c "pgrep $i > /dev/null" || tst_brk TCONF "$i not running on rhost"
> + done
> + fi
And here of course as well use tst_rhost_run for both.
Kind regards,
Petr
More information about the ltp
mailing list