diff mbox series

[v2,3/3] nfs_lib: Add option to run traffic via lo on netns

Message ID 20200311175011.12171-3-pvorel@suse.cz
State Accepted
Delegated to: Alexey Kodanev
Headers show
Series [v2,1/3] nfs_lib: Unify remote directory creation | expand

Commit Message

Petr Vorel March 11, 2020, 5:50 p.m. UTC
When $LTP_NFS_NETNS_USE_LO set and test is using netns ($TST_USE_NETNS
set) NFS traffic will go through lo interface instead of ltp_ns_veth*
netns interfaces. This can be useful for debugging whether test failures
are related to veth/netns.

Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1-v2:
* new commit

 testcases/network/nfs/nfs_stress/nfs_lib.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Petr Vorel March 11, 2020, 6:56 p.m. UTC | #1
Hi Alexey,

...
> diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
...
> +# When set and test is using netns ($TST_USE_NETNS set) NFS traffic will go
> +# through lo interface instead of ltp_ns_veth* netns interfaces (useful for
> +# debugging whether test failures are related to veth/netns).
> +LTP_NFS_NETNS_USE_LO=
Sorry, this needs to be
LTP_NFS_NETNS_USE_LO=${LTP_NFS_NETNS_USE_LO:-}

+ suggest different name, if you don't like this.

Kind regards,
Petr
Alexey Kodanev March 13, 2020, 1:50 p.m. UTC | #2
On 11.03.2020 21:56, Petr Vorel wrote:
> Hi Alexey,
> 
> ...
>> diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> ...
>> +# When set and test is using netns ($TST_USE_NETNS set) NFS traffic will go
>> +# through lo interface instead of ltp_ns_veth* netns interfaces (useful for
>> +# debugging whether test failures are related to veth/netns).
>> +LTP_NFS_NETNS_USE_LO=
> Sorry, this needs to be
> LTP_NFS_NETNS_USE_LO=${LTP_NFS_NETNS_USE_LO:-}
> 
> + suggest different name, if you don't like this.
> 
> Kind regards,
> Petr
> 

Hi Petr, the patch-series LGTM,

Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Petr Vorel March 13, 2020, 2:17 p.m. UTC | #3
Hi Alexey,

> Hi Petr, the patch-series LGTM,

> Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Thank for your time, pushed!

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 3d447783d..b7c372afb 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -31,6 +31,11 @@  TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs"
 TST_SETUP="${TST_SETUP:-nfs_setup}"
 TST_CLEANUP="${TST_CLEANUP:-nfs_cleanup}"
 
+# When set and test is using netns ($TST_USE_NETNS set) NFS traffic will go
+# through lo interface instead of ltp_ns_veth* netns interfaces (useful for
+# debugging whether test failures are related to veth/netns).
+LTP_NFS_NETNS_USE_LO=
+
 . tst_net.sh
 
 get_socket_type()
@@ -52,6 +57,7 @@  nfs_server_udp_enabled()
 
 	tst_rhost_run -c "[ -f /etc/nfs.conf ]" || return 0
 	config=$(tst_rhost_run -c 'for f in $(grep ^include.*= '/etc/nfs.conf' | cut -d = -f2); do [ -f $f ] && printf "$f "; done')
+
 	tst_rhost_run -c "grep -q '^[# ]*udp *= *y' /etc/nfs.conf $config"
 }
 
@@ -80,7 +86,7 @@  nfs_mount()
 	local mnt_cmd="mount -t nfs $opts $mount_dir $local_dir"
 
 	tst_res TINFO "Mounting NFS: $mnt_cmd"
-	if [ -n "$LTP_NETNS" ]; then
+	if [ -n "$LTP_NETNS" ] && [ -z "$LTP_NFS_NETNS_USE_LO" ]; then
 		tst_rhost_run -s -c "$mnt_cmd"
 		return
 	fi