diff mbox series

[1/2] nfs_lib: Unify testing on netns

Message ID 20200305192716.10313-1-pvorel@suse.cz
State Changes Requested
Headers show
Series [1/2] nfs_lib: Unify testing on netns | expand

Commit Message

Petr Vorel March 5, 2020, 7:27 p.m. UTC
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(-)

Comments

Alexey Kodanev March 10, 2020, 1:01 p.m. UTC | #1
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
>  }
>  
>
Petr Vorel March 10, 2020, 3:46 p.m. UTC | #2
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
Alexey Kodanev March 11, 2020, 2:35 p.m. UTC | #3
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
>
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 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
 }