* [LTP] [PATCH v2 1/3] nfs_lib: Unify remote directory creation
@ 2020-03-11 17:50 Petr Vorel
2020-03-11 17:50 ` [LTP] [PATCH v2 2/3] nfs: Detect disabled UDP Petr Vorel
2020-03-11 17:50 ` [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns Petr Vorel
0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2020-03-11 17:50 UTC (permalink / raw)
To: ltp
remote directory creation can be done by tst_rhost_run() also on netns.
This simplifies code a bit.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1-v2:
* remove changes in nfs_mount() (to keep using netns)
testcases/network/nfs/nfs_stress/nfs_lib.sh | 8 --------
1 file changed, 8 deletions(-)
diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 66f2fb038..f233976c7 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -50,14 +50,6 @@ nfs_setup_server()
{
local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"
- if [ -n "$LTP_NETNS" ]; then
- if [ ! -d $remote_dir ]; then
- mkdir -p $remote_dir
- ROD $export_cmd
- fi
- return
- fi
-
if ! tst_rhost_run -c "test -d $remote_dir"; then
tst_rhost_run -s -c "mkdir -p $remote_dir; $export_cmd"
fi
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH v2 2/3] nfs: Detect disabled UDP
2020-03-11 17:50 [LTP] [PATCH v2 1/3] nfs_lib: Unify remote directory creation Petr Vorel
@ 2020-03-11 17:50 ` Petr Vorel
2020-03-11 17:50 ` [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns Petr Vorel
1 sibling, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2020-03-11 17:50 UTC (permalink / raw)
To: ltp
nfs-utils disabled serving NFS over UDP in version 2.2.1,
which produce TBROK:
nfs01 1 TBROK: 'mount -t nfs -o proto=udp,vers=3
10.0.0.2:/tmp/LTP_nfs01.3pixnljzEv/3/udp /tmp/LTP_nfs01.3pixnljzEv/3/0'
failed on '': 'mount.nfs: requested NFS version or transport protocol is
not supported'
Detect UDP enabled (parsing all configs) and return TCONF when disabled.
Also detect UDP enabled by default by default, when config has commented
default values.
NOTE: Debian based distros still use older version, once it upgrades, it
will might keep using current configuration files
(/etc/default/nfs-kernel-server, /etc/default/nfs-common), therefore
code might need to be adjusted.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1-v2:
* detect UDP also on IPv6 ("udp6")
* use Simplified regexp
testcases/network/nfs/nfs_stress/nfs_lib.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index f233976c7..3d447783d 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -46,6 +46,15 @@ get_socket_type()
done
}
+nfs_server_udp_enabled()
+{
+ local config f
+
+ 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"
+}
+
nfs_setup_server()
{
local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"
@@ -98,6 +107,10 @@ nfs_setup()
type=$(get_socket_type $n)
tst_res TINFO "setup NFSv$i, socket type $type"
+ if [ "$type" = "udp" -o "$type" = "udp6" ] && ! nfs_server_udp_enabled; then
+ tst_brk TCONF "UDP support disabled on NFS server"
+ fi
+
local_dir="$TST_TMPDIR/$i/$n"
remote_dir="$TST_TMPDIR/$i/$type"
mkdir -p $local_dir
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns
2020-03-11 17:50 [LTP] [PATCH v2 1/3] nfs_lib: Unify remote directory creation Petr Vorel
2020-03-11 17:50 ` [LTP] [PATCH v2 2/3] nfs: Detect disabled UDP Petr Vorel
@ 2020-03-11 17:50 ` Petr Vorel
2020-03-11 18:56 ` Petr Vorel
1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2020-03-11 17:50 UTC (permalink / raw)
To: ltp
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(-)
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
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns
2020-03-11 17:50 ` [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns Petr Vorel
@ 2020-03-11 18:56 ` Petr Vorel
2020-03-13 13:50 ` Alexey Kodanev
0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2020-03-11 18:56 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns
2020-03-11 18:56 ` Petr Vorel
@ 2020-03-13 13:50 ` Alexey Kodanev
2020-03-13 14:17 ` Petr Vorel
0 siblings, 1 reply; 6+ messages in thread
From: Alexey Kodanev @ 2020-03-13 13:50 UTC (permalink / raw)
To: ltp
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns
2020-03-13 13:50 ` Alexey Kodanev
@ 2020-03-13 14:17 ` Petr Vorel
0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2020-03-13 14:17 UTC (permalink / raw)
To: ltp
Hi Alexey,
> Hi Petr, the patch-series LGTM,
> Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Thank for your time, pushed!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-03-13 14:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-11 17:50 [LTP] [PATCH v2 1/3] nfs_lib: Unify remote directory creation Petr Vorel
2020-03-11 17:50 ` [LTP] [PATCH v2 2/3] nfs: Detect disabled UDP Petr Vorel
2020-03-11 17:50 ` [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns Petr Vorel
2020-03-11 18:56 ` Petr Vorel
2020-03-13 13:50 ` Alexey Kodanev
2020-03-13 14:17 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox