public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns
@ 2020-03-05 19:27 Petr Vorel
  2020-03-05 19:27 ` [LTP] [PATCH 2/2] nfs: Detect disabled UDP Petr Vorel
  2020-03-10 13:01 ` [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns Alexey Kodanev
  0 siblings, 2 replies; 7+ messages in thread
From: Petr Vorel @ 2020-03-05 19:27 UTC (permalink / raw)
  To: ltp

There is no need to run tests on opposite client/server when using
$TST_USE_NETNS based setup. It's enough just to set lhost IP address.
This simplifies code a bit.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/nfs/nfs_stress/nfs_lib.sh | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 66f2fb038..2d5535dc5 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
@@ -79,11 +71,6 @@ 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
-		tst_rhost_run -s -c "$mnt_cmd"
-		return
-	fi
-
 	ROD $mnt_cmd
 }
 
-- 
2.25.1


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

* [LTP] [PATCH 2/2] nfs: Detect disabled UDP
  2020-03-05 19:27 [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns Petr Vorel
@ 2020-03-05 19:27 ` Petr Vorel
  2020-03-10 13:34   ` Alexey Kodanev
  2020-03-10 13:01 ` [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns Alexey Kodanev
  1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-03-05 19:27 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 configuration (parsing all configs) and return TCONF when disabled.

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>
---
 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 2d5535dc5..2ba79dfdd 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 '^[[:space:]]*udp[[:space:]]*=[[:space:]]*y' /etc/nfs.conf $config"
+}
+
 nfs_setup_server()
 {
 	local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"
@@ -93,6 +102,10 @@ nfs_setup()
 		type=$(get_socket_type $n)
 		tst_res TINFO "setup NFSv$i, socket type $type"
 
+		if [ "$type" = "udp" ] && ! 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] 7+ messages in thread

* [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns
  2020-03-05 19:27 [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns Petr Vorel
  2020-03-05 19:27 ` [LTP] [PATCH 2/2] nfs: Detect disabled UDP Petr Vorel
@ 2020-03-10 13:01 ` Alexey Kodanev
  2020-03-10 15:46   ` Petr Vorel
  1 sibling, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2020-03-10 13:01 UTC (permalink / raw)
  To: ltp

Hi Petr,
On 05.03.2020 22:27, Petr Vorel wrote:
> There is no need to run tests on opposite client/server when using
> $TST_USE_NETNS based setup. It's enough just to set lhost IP address.
> This simplifies code a bit.

It changes the testcase, this way nfs traffic will go through
lo interface, the test won't use ltp_ns_veth* and netns.

We could add the knob for this scenario with LTP_NFS_USE_NETNS={1|0}?

> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/nfs/nfs_stress/nfs_lib.sh | 13 -------------
>  1 file changed, 13 deletions(-)
> 
> diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> index 66f2fb038..2d5535dc5 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
> @@ -79,11 +71,6 @@ 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
> -		tst_rhost_run -s -c "$mnt_cmd"
> -		return
> -	fi
> -
>  	ROD $mnt_cmd
>  }
>  
> 


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

* [LTP] [PATCH 2/2] nfs: Detect disabled UDP
  2020-03-05 19:27 ` [LTP] [PATCH 2/2] nfs: Detect disabled UDP Petr Vorel
@ 2020-03-10 13:34   ` Alexey Kodanev
  2020-03-10 16:44     ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2020-03-10 13:34 UTC (permalink / raw)
  To: ltp

On 05.03.2020 22:27, Petr Vorel wrote:
> 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 configuration (parsing all configs) and return TCONF when disabled.
> 
> 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>
> ---
>  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 2d5535dc5..2ba79dfdd 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 '^[[:space:]]*udp[[:space:]]*=[[:space:]]*y' /etc/nfs.conf $config"

Looks like the pattern doesn't detect when udp enabled by
default and the config has commented default values,
i.e. '# udp=y'.

grep '^[# ]*udp *= *y' /etc/nfs.conf $config


> +}
> +
>  nfs_setup_server()
>  {
>  	local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"
> @@ -93,6 +102,10 @@ nfs_setup()
>  		type=$(get_socket_type $n)
>  		tst_res TINFO "setup NFSv$i, socket type $type"
>  
> +		if [ "$type" = "udp" ] && ! 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
> 


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

* [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns
  2020-03-10 13:01 ` [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns Alexey Kodanev
@ 2020-03-10 15:46   ` Petr Vorel
  2020-03-11 14:35     ` Alexey Kodanev
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-03-10 15:46 UTC (permalink / raw)
  To: ltp

Hi Alexey,

thanks for your review!

> > There is no need to run tests on opposite client/server when using
> > $TST_USE_NETNS based setup. It's enough just to set lhost IP address.
> > This simplifies code a bit.

> It changes the testcase, this way nfs traffic will go through
> lo interface, the test won't use ltp_ns_veth* and netns.
Sorry, I didn't notice this.
BTW code nfs_setup_server could be run by tst_rhost_run() (code simplification),
but that's a detail.

> We could add the knob for this scenario with LTP_NFS_USE_NETNS={1|0}?
Is this scenario useful? It does not look to me as a real world scenario,
but if I'm wrong let's add it :).

Kind regards,
Petr

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

* [LTP] [PATCH 2/2] nfs: Detect disabled UDP
  2020-03-10 13:34   ` Alexey Kodanev
@ 2020-03-10 16:44     ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2020-03-10 16:44 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> > +	tst_rhost_run -c "grep -q '^[[:space:]]*udp[[:space:]]*=[[:space:]]*y' /etc/nfs.conf $config"

> Looks like the pattern doesn't detect when udp enabled by
> default and the config has commented default values,
> i.e. '# udp=y'.

> grep '^[# ]*udp *= *y' /etc/nfs.conf $config
Correct, this should be covered.
I'll send v2 with your much simpler regex, although I hoped we'd have something
error prone than just relying on content of config files. But IMHO checking
nfs-utils version cannot be easily done:

1) exportfs (which we require) does not print version (could be checked in
strings $(which exportfs), but we don't want unnecessary string dependency).
2) checking nfsstat (which will be probably presented on the server and even we
don't require it's presented, via if tst_cmd_available nfsstat && ...) can be
done, but we probably don't want to bother to parse it's version (UDP was
disabled in fbd7623d, which was in added in 2.1.2-rc2 and actually released in 2.2.1).

Kind regards,
Petr

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

* [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns
  2020-03-10 15:46   ` Petr Vorel
@ 2020-03-11 14:35     ` Alexey Kodanev
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2020-03-11 14:35 UTC (permalink / raw)
  To: ltp

Hi Petr,
On 10.03.2020 18:46, Petr Vorel wrote:
> Hi Alexey,
> 
> thanks for your review!
> 
>>> There is no need to run tests on opposite client/server when using
>>> $TST_USE_NETNS based setup. It's enough just to set lhost IP address.
>>> This simplifies code a bit.
> 
>> It changes the testcase, this way nfs traffic will go through
>> lo interface, the test won't use ltp_ns_veth* and netns.
> Sorry, I didn't notice this.
> BTW code nfs_setup_server could be run by tst_rhost_run() (code simplification),

Right

> but that's a detail.
> 
>> We could add the knob for this scenario with LTP_NFS_USE_NETNS={1|0}?
> Is this scenario useful? It does not look to me as a real world scenario,
> but if I'm wrong let's add it :).

Perhaps, it can be useful to find out if the test failure
related to veth/netns...

> 
> Kind regards,
> Petr
> 


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

end of thread, other threads:[~2020-03-11 14:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-05 19:27 [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns Petr Vorel
2020-03-05 19:27 ` [LTP] [PATCH 2/2] nfs: Detect disabled UDP Petr Vorel
2020-03-10 13:34   ` Alexey Kodanev
2020-03-10 16:44     ` Petr Vorel
2020-03-10 13:01 ` [LTP] [PATCH 1/2] nfs_lib: Unify testing on netns Alexey Kodanev
2020-03-10 15:46   ` Petr Vorel
2020-03-11 14:35     ` Alexey Kodanev

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