From patchwork Fri Mar 30 02:10:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 10316721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E076560353 for ; Fri, 30 Mar 2018 02:11:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D24B32A335 for ; Fri, 30 Mar 2018 02:11:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6B5F2A566; Fri, 30 Mar 2018 02:11:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAF342A563 for ; Fri, 30 Mar 2018 02:11:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752197AbeC3CLB (ORCPT ); Thu, 29 Mar 2018 22:11:01 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:48934 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751893AbeC3CLB (ORCPT ); Thu, 29 Mar 2018 22:11:01 -0400 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R291e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01f04446; MF=eguan@linux.alibaba.com; NM=1; PH=DS; RN=3; SR=0; TI=SMTPD_---0T-KWIqb_1522375847; Received: from localhost(mailfrom:eguan@linux.alibaba.com fp:106.11.34.18) by smtp.aliyun-inc.com(127.0.0.1); Fri, 30 Mar 2018 10:10:48 +0800 From: Eryu Guan To: Theodore Ts'o Cc: fstests@vger.kernel.org, Eryu Guan Subject: [PATCH 1/2] kvm-xfstests: add virtfs/9p test support Date: Fri, 30 Mar 2018 10:10:39 +0800 Message-Id: <20180330021040.23748-1-eguan@linux.alibaba.com> X-Mailer: git-send-email 2.14.3 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add 9p test support, introduce three new configurable variables - VIRTFS_TEST_PATH: path to be exported to kvm guest as TEST_DEV - VIRTFS_SCRATCH_PATH: path to be exported to kvm guest as SCRATCH_DEV - VIRTFS_MODEL: security model, "none" as default The mount tags in guest are 9ptest and 9pscratch. Signed-off-by: Eryu Guan --- kvm-xfstests/config.kvm | 5 +++++ kvm-xfstests/kvm-xfstests | 19 +++++++++++++++++-- kvm-xfstests/test-appliance/files/root/runtests.sh | 2 +- kvm-xfstests/util/parse_cli | 12 ++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/kvm-xfstests/config.kvm b/kvm-xfstests/config.kvm index a08236fdc11e..fc20a1497ed5 100644 --- a/kvm-xfstests/config.kvm +++ b/kvm-xfstests/config.kvm @@ -48,3 +48,8 @@ CONSOLE=" -serial mon:stdio" # Native AIO is probably better for our goal which is test proofing # production systems. AIO=",aio=native" + +# Exported test/scratch dirs for 9p test in kvm guest, and virtfs security model +#VIRTFS_TEST_PATH=/tmp/9ptest +#VIRTFS_SCRATCH_PATH=/tmp/9pscratch +#VIRTFS_MODEL=mapped diff --git a/kvm-xfstests/kvm-xfstests b/kvm-xfstests/kvm-xfstests index ccc8ae96fc8e..a02beab80e71 100755 --- a/kvm-xfstests/kvm-xfstests +++ b/kvm-xfstests/kvm-xfstests @@ -78,6 +78,22 @@ fi if test -z "$VIRTFS_PATH"; then VIRTFS_PATH=/tmp/kvm-xfstests-$USER fi +VIRTFS="-fsdev local,id=v_tmp,path=$VIRTFS_PATH,security_model=none " +VIRTFS+="-device virtio-9p-pci,fsdev=v_tmp,mount_tag=v_tmp " + +if test -z "$VIRTFS_MODEL"; then + VIRTFS_MODEL=none +fi +if test -n "$VIRTFS_TEST_PATH"; then + VIRTFS+="-fsdev local,id=p9test,path=$VIRTFS_TEST_PATH," + VIRTFS+="security_model=$VIRTFS_MODEL " + VIRTFS+="-device virtio-9p-pci,fsdev=p9test,mount_tag=9ptest " +fi +if test -n "$VIRTFS_SCRATCH_PATH"; then + VIRTFS+=" -fsdev local,id=p9scratch,path=$VIRTFS_SCRATCH_PATH," + VIRTFS+="security_model=$VIRTFS_MODEL " + VIRTFS+="-device virtio-9p-pci,fsdev=p9scratch,mount_tag=9pscratch " +fi VDH=$(mktemp /tmp/kvm-upload.XXXXXXXX) trap 'rm -f "$VDH"' 0 @@ -119,8 +135,7 @@ $NO_ACTION $IONICE $QEMU -boot order=c $NET \ -drive file=$VDG,cache=none,if=virtio,format=raw$AIO \ -drive file=$VDH,if=virtio,format=raw \ -vga none -nographic -smp $NR_CPU -m $MEM \ - -fsdev local,id=v_tmp,path=$VIRTFS_PATH,security_model=none \ - -device virtio-9p-pci,fsdev=v_tmp,mount_tag=v_tmp \ + $VIRTFS \ $VIRTIO_RNG \ $CONSOLE \ $MONITOR \ diff --git a/kvm-xfstests/test-appliance/files/root/runtests.sh b/kvm-xfstests/test-appliance/files/root/runtests.sh index a44f3893a6a4..0a83c70af853 100755 --- a/kvm-xfstests/test-appliance/files/root/runtests.sh +++ b/kvm-xfstests/test-appliance/files/root/runtests.sh @@ -282,7 +282,7 @@ do fi fi case "$TEST_DEV" in - */ovl) ;; + */ovl|9p*) ;; *:/*) ;; *) if ! [ -b $TEST_DEV -o -c $TEST_DEV ]; then diff --git a/kvm-xfstests/util/parse_cli b/kvm-xfstests/util/parse_cli index 11b45758b31b..52f518a5064c 100644 --- a/kvm-xfstests/util/parse_cli +++ b/kvm-xfstests/util/parse_cli @@ -399,6 +399,18 @@ while [ "$1" != "" ]; do supported_flavors kvm VIRTFS_PATH="$1" ;; + --virtfs-test) shift + supported_flavors kvm + VIRTFS_TEST_PATH="$1" + ;; + --virtfs-scratch) shift + supported_flavors kvm + VIRTFS_SCRATCH_PATH="$1" + ;; + --virtfs-model) shift + supported_flavors kvm + VIRTFS_MODEL="$1" + ;; --archive) supported_flavors kvm DO_ARCHIVE=1