From patchwork Tue Oct 9 13:17:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 981201 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="Eu+h/MoK"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42TyFy09wPz9s5c for ; Wed, 10 Oct 2018 00:08:03 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1C0963E7469 for ; Tue, 9 Oct 2018 15:08:00 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id D30C83E742D for ; Tue, 9 Oct 2018 15:07:57 +0200 (CEST) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id B292F601630 for ; Tue, 9 Oct 2018 15:07:56 +0200 (CEST) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w99D4b7B114206 for ; Tue, 9 Oct 2018 13:07:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=sGteNex6bFrkxd4S9IZCHuahOsgkk774rmmT60fSjm0=; b=Eu+h/MoKaIWtK6lNN5/179J6hkzOu60bpSqnMGPRPaqmDZZjAvz69B6Dgy/oz43j6ZVq BLnpomx3dL5wlMO/Tk/EahGT0J2Bz5nBTxPdL3zhVDFAodIzt1ghZazU5TTR6yVxfSnm ZGmsQBcQ5qbrertLG8zOohej5rQx1YZpPQcOvU3F6z3UaQdesydWB7o3cfBsP0wDoMT+ Op0izpPSS4aAFMbmysHcGTMp3TA7kyDLnMkhim83+NEfnK4MFyIN+Pty7jkR7+1OA47A nYUcek0aGaxEivY7b+oIwjMOU0dls0cQzO3eB+Ri70+eO7PYoSYo5ttgrxhZ2IaSSPXd Tw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2mxn0pw43e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 09 Oct 2018 13:07:54 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w99D7rTH027753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 9 Oct 2018 13:07:53 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w99D7rSa022844 for ; Tue, 9 Oct 2018 13:07:53 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 09 Oct 2018 13:07:53 +0000 From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 9 Oct 2018 16:17:59 +0300 Message-Id: <1539091079-21887-1-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9040 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810090130 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH] network/nfs: support default setup, use local mount X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "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 Acked-by: Petr Vorel --- 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