NFStest提供一组用于测试NFS客户端或NFS服务器的工具,包含以下测试组件
工具名称 |
功能 |
使用版本 |
nfstest_alloc |
验证空间预留的正确功能,使应用程序能够为文件预留或取消预留空间。 |
NFSv4.2 及以上版本 |
nfstest_cache |
NFS客户端端缓存测试 通过改变acregmin、acregmax、acdirmin、acdirmax和actimo来验证属性缓存的一致性。通过改变acregmin、acregmax、acdirmin、acdirmax和actimo来验证数据缓存的一致性。 |
适用于任何版本的NFS |
nfstest_delegation |
Delegation tests |
NFS v4 新特性 |
nfstest_dio |
Direct I/O tests |
适用于NFSv4.0和NFSv4.1,包括pNFS |
nfstest_interop |
NFS互操作性测试,验证使用不同版本的NFS编写的文件是否正确 |
适用于任何版本的NFS |
nfstest_lock |
文件锁测试 |
适用于任何版本的NFS |
nfstest_pnfs |
基本pNFS功能测试(并行文件系统) |
仅在启用pNFS的情况下使用NFSv4.1有效,并且需要文件布局类型 |
nfstest_posix |
文件系统POSIX语义测试 |
适用于任何版本的NFS |
nfstest_sparse |
稀疏文件测试 |
适用于NFSv4.2及更高版本。 |
nfstest_ssc |
服务器端拷贝 |
NFS v4 新特性 |
安装
有多种安装方式,介绍其中一种
Get the latest tarball from http://wiki.linux-nfs.org/wiki/index.php/NFStest
# tar -zxvf NFStest-2.1.tar.gz
Or install to standard python site-packages and executable directories:
# cd ~/NFStest-2.1
# sudo python setup.py install
对于NFS v3主要测试posix语义和文件锁功能,常见参数如下表
-s SERVER, --server=SERVER |
Server name or IP address |
-e EXPORT, --export=EXPORT |
Exported file system to mount [default: '/'] |
--nfsversion=NFSVERSION |
NFS version, e.g., 3, 4, 4.1, etc. [default: 4.1] |
--tverbose=TVERBOSE |
Verbose level for test messages [default: '1'] |
--runtest=RUNTEST |
Comma separated list of tests to run, if list starts with a '^' then all tests are run except the ones listed [default: 'all'] |
nfstest_posix使用
运行所有的posix用例
# nfstest_posix --server 10.253.x.x -e /nfs1 --nfsversion=3 --tverbose verbose
运行指定的用例
# nfstest_posix --server 10.253.x.x -e /nfs1 --nfsversion=3 --runtest=mkdir
文件锁工具nfstest_lock使用
提供了比较丰富文件锁测试用例,涵盖基本的锁语义、两个进程间加锁、两个client间加锁等。
optest02 |
process1: |------------------| process2: |------------------| |
octest03 |
client1: |------------------| client2: |------------------|
|
... |
更多信息: nfstest_lock --help |
运行所有的用例
# nfstest_lock --server 10.253.x.x -e /nfs1 --nfsversion=3
运行指定的用例
#nfstest_lock --server 10.253.x.x -e /nfs1 --nfsversion=3 --runtest=optest02
NFStest还提供了nfstest_io、nfstest_file等工具,更多使用信息参考thombashi/NFStest: NFStest mirror with command help wiki. (github.com)