Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] nfs_lib.sh: run exportfs at "server side" in LTP_NETNS case
@ 2022-01-13 16:31 Nikita Yushchenko via ltp
  2022-01-14 20:16 ` Petr Vorel
  2022-01-18 13:01 ` Petr Vorel
  0 siblings, 2 replies; 3+ messages in thread
From: Nikita Yushchenko via ltp @ 2022-01-13 16:31 UTC (permalink / raw)
  To: ltp; +Cc: Nikita Yushchenko

In LTP_NETNS case, nfs server is the root namespace and nfs client is
the ltp namespace.

Then, exportfs shall be executed locally, without tst_rhost_run.

Otherwise, things implicitly depend on /var/lib/nfs being the same in
the root namespace and the ltp namespace.

Signed-off-by: Nikita Yushchenko <nikita.yushchenko@virtuozzo.com>
---
Changes from v1:
- use tst_net_use_netns

 testcases/network/nfs/nfs_stress/nfs_lib.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 884109890..7a7cd9925 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -81,8 +81,14 @@ nfs_setup_server()
 {
 	local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"
 
-	if ! tst_rhost_run -c "test -d $remote_dir"; then
-		tst_rhost_run -s -c "mkdir -p $remote_dir; $export_cmd"
+	if tst_net_use_netns; then
+		if ! test -d $remote_dir; then
+			mkdir -p $remote_dir; $export_cmd
+		fi
+	else
+		if ! tst_rhost_run -c "test -d $remote_dir"; then
+			tst_rhost_run -s -c "mkdir -p $remote_dir; $export_cmd"
+		fi
 	fi
 }
 
-- 
2.30.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-18 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-13 16:31 [LTP] [PATCH v2] nfs_lib.sh: run exportfs at "server side" in LTP_NETNS case Nikita Yushchenko via ltp
2022-01-14 20:16 ` Petr Vorel
2022-01-18 13:01 ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox