* [LTP] [PATCH] network/nfs: support default setup, use local mount
@ 2018-10-09 13:17 Alexey Kodanev
2018-10-12 16:13 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kodanev @ 2018-10-09 13:17 UTC (permalink / raw)
To: ltp
For default setup, start the server locally instead and mount
inside netns to run NFS traffic over the veth or whatever is
used for a single machine setup.
We could also use lo interface, we just need to skip the last
check in nfs_mount()/nfs_lib.sh.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/nfs/nfs_stress/nfs_lib.sh | 63 +++++++++++++++++++--------
1 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 7e11dc4..28b73e1 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -46,6 +46,47 @@ get_socket_type()
done
}
+nfs_setup_server()
+{
+ local export_cmd="exportfs -i -o 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
+}
+
+nfs_mount()
+{
+ local host_type=rhost
+ local mount_dir
+
+ [ -n "$LTP_NETNS" ] && host_type=
+
+ if [ $TST_IPV6 ]; then
+ mount_dir="[$(tst_ipaddr $host_type)]:$remote_dir"
+ else
+ mount_dir="$(tst_ipaddr $host_type):$remote_dir"
+ fi
+
+ 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
+}
+
nfs_setup()
{
# Check if current filesystem is NFS
@@ -60,35 +101,19 @@ nfs_setup()
local local_dir
local remote_dir
local mount_dir
+
for i in $VERSION; do
type=$(get_socket_type $n)
tst_res TINFO "setup NFSv$i, socket type $type"
local_dir="$TST_TMPDIR/$i/$n"
remote_dir="$TST_TMPDIR/$i/$type"
-
mkdir -p $local_dir
- tst_rhost_run -c "test -d $remote_dir"
- if [ "$?" -ne 0 ]; then
- tst_rhost_run -s -c "mkdir -p $remote_dir"
- tst_rhost_run -s -c "exportfs -i -o no_root_squash,rw \
- *:$remote_dir"
- fi
+ nfs_setup_server
opts="-o proto=$type,vers=$i"
-
- if [ $TST_IPV6 ]; then
- mount_dir="[$(tst_ipaddr rhost)]:$remote_dir"
- else
- mount_dir="$(tst_ipaddr rhost):$remote_dir"
- fi
-
-
- tst_res TINFO "Mounting NFS '$mount_dir'"
- tst_res TINFO "to '$local_dir' with options '$opts'"
-
- ROD mount -t nfs $opts $mount_dir $local_dir
+ nfs_mount
n=$(( n + 1 ))
done
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] network/nfs: support default setup, use local mount
2018-10-09 13:17 [LTP] [PATCH] network/nfs: support default setup, use local mount Alexey Kodanev
@ 2018-10-12 16:13 ` Petr Vorel
2018-10-15 16:03 ` Alexey Kodanev
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2018-10-12 16:13 UTC (permalink / raw)
To: ltp
Hi Alexey,
> For default setup, start the server locally instead and mount
> inside netns to run NFS traffic over the veth or whatever is
> used for a single machine setup.
> We could also use lo interface, we just need to skip the last
> check in nfs_mount()/nfs_lib.sh.
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
LGTM, thanks for the patch!
BTW how about split runtest/net.nfs, so it takes shorter to run?
Maybe it takes so long on my side as I still experience some problems with NFS,
which I haven't debugged yet (timeout).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] network/nfs: support default setup, use local mount
2018-10-12 16:13 ` Petr Vorel
@ 2018-10-15 16:03 ` Alexey Kodanev
0 siblings, 0 replies; 3+ messages in thread
From: Alexey Kodanev @ 2018-10-15 16:03 UTC (permalink / raw)
To: ltp
On 10/12/2018 07:13 PM, Petr Vorel wrote:
> Hi Alexey,
>
>> For default setup, start the server locally instead and mount
>> inside netns to run NFS traffic over the veth or whatever is
>> used for a single machine setup.
>
>> We could also use lo interface, we just need to skip the last
>> check in nfs_mount()/nfs_lib.sh.
>
>> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Acked-by: Petr Vorel <pvorel@suse.cz>
>
> LGTM, thanks for the patch!
>
Applied, thanks for review Petr!
> BTW how about split runtest/net.nfs, so it takes shorter to run?
> Maybe it takes so long on my side as I still experience some problems with NFS,
> which I haven't debugged yet (timeout).
Perhaps some default parameters are unreasonably large, e.g. DIR_NUM, FILE_NUM,
THREAD_NUM (nfs03, nfs05 tests)...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-15 16:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 13:17 [LTP] [PATCH] network/nfs: support default setup, use local mount Alexey Kodanev
2018-10-12 16:13 ` Petr Vorel
2018-10-15 16:03 ` Alexey Kodanev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.