提交 a0d1e4f6 编写于 作者: Y Yongxue Hong

virtio_fs_share_data: New cases to test virtio-fs by sharing data

New cases to test virtio-fs by sharing the data between host and guest.
Signed-off-by: NYongxue Hong <yhong@redhat.com>
上级 a0d5884b
- virtio_fs_share_data:
only Linux
no s390x
no RHEL.6 RHEL.7 RHEL.8.0 RHEL.8.1
no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8.u0 Host_RHEL.m8.u1
type = virtio_fs_share_data
virt_test_type = qemu
required_qemu = [4.2.0,)
kill_vm = yes
start_vm = yes
filesystems = fs
fs_driver = virtio-fs
fs_source_type = mount
fs_source_dir = virtio_fs_test/
force_create_fs_source = yes
remove_fs_source = yes
fs_target = 'myfs'
fs_driver_props = {"queue-size": 1024}
mem = 4096
mem_devs = mem1
backend_mem1 = memory-backend-file
mem-path_mem1 = /dev/shm
size_mem1 = 4G
use_mem_mem1 = no
share_mem = yes
guest_numa_nodes = shm0
numa_memdev_shm0 = mem-mem1
numa_nodeid_shm0 = 0
io_timeout = 600
fs_dest = '/mnt/${fs_target}'
variants:
- with_cache:
variants:
- auto:
fs_binary_extra_options = " -o cache=auto"
- always:
fs_binary_extra_options = " -o cache=always"
- none:
fs_binary_extra_options = " -o cache=none"
- with_no_writeback:
fs_binary_extra_options = " -o no_writeback "
variants:
- @default:
cmd_dd = 'dd if=/dev/urandom of=%s bs=1M count=2048 oflag=direct'
cmd_md5 = 'md5sum %s'
io_timeout = 120
default..with_cache.none:
io_timeout = 600
variants:
- @default:
- with_multi_fs_sources:
no with_multi_fs_sources..with_no_writeback
with_multi_fs_sources.with_cache.none:
io_timeout = 600
filesystems = fs1 fs2 fs3 fs4 fs5
fs_source_dir_fs1 = '/tmp/virtio_fs1_test'
fs_source_dir_fs2 = '/tmp/virtio_fs2_test'
fs_source_dir_fs3 = '/tmp/virtio_fs3_test'
fs_source_dir_fs4 = '/tmp/virtio_fs4_test'
fs_source_dir_fs5 = '/tmp/virtio_fs5_test'
fs_target_fs1 = 'myfs1'
fs_target_fs2 = 'myfs2'
fs_target_fs3 = 'myfs3'
fs_target_fs4 = 'myfs4'
fs_target_fs5 = 'myfs5'
fs_dest_fs1 = '/mnt/${fs_target_fs1}'
fs_dest_fs2 = '/mnt/${fs_target_fs2}'
fs_dest_fs3 = '/mnt/${fs_target_fs3}'
fs_dest_fs4 = '/mnt/${fs_target_fs4}'
fs_dest_fs5 = '/mnt/${fs_target_fs5}'
- run_stress:
variants:
- with_fio:
no with_fio..with_no_writeback
smp = 8
aarch64:
vcpu_maxcpus = 8
io_timeout = 2000
fio_options = '--name=stress --filename=%s --ioengine=libaio --rw=write --direct=1 '
fio_options += '--bs=4K --size=1G --iodepth=256 --numjobs=128 --runtime=1800'
- with_pjdfstest:
no with_pjdfstest..with_no_writeback
io_timeout = 1800
with_pjdfstest..with_cache.none:
io_timeout = 7200
pjdfstest_pkg = pjdfstest-0.1.tar.bz2
cmd_unpack = 'tar -zxvf {0}/${pjdfstest_pkg} -C {0}'
cmd_yum_deps = 'yum install -y perl-Test-Harness'
cmd_autoreconf = 'autoreconf -ifs %s/pjdfstest/'
cmd_configure = '{0}/pjdfstest/configure && '
cmd_configure += 'mv config.* {0}/pjdfstest/ && mv Makefile {0}/pjdfstest/ && mv stamp-h1 {0}/pjdfstest/'
cmd_make = 'make %s/pjdfstest/pjdfstest'
cmd_pjdfstest = 'prove -rv %s/pjdfstest/tests'
import logging
import os
from avocado.utils import process
from virttest import data_dir
from virttest import error_context
from virttest import utils_disk
from virttest import utils_misc
from virttest.remote import scp_to_remote
from provider.storage_benchmark import generate_instance
@error_context.context_aware
def run(test, params, env):
"""
Test virtio-fs by sharing the data between host and guest.
Steps:
1. Create shared directories on the host.
2. Run virtiofsd daemons on the host.
3. Boot a guest on the host with virtiofs options.
4. Log into guest then mount the virtiofs targets.
5. Generate files or run stress on the mount points inside guest.
:param test: QEMU test object.
:param params: Dictionary with the test parameters.
:param env: Dictionary with test environment.
"""
cmd_dd = params.get('cmd_dd')
cmd_md5 = params.get('cmd_md5')
cmd_pjdfstest = params.get('cmd_pjdfstest')
cmd_unpack = params.get('cmd_unpack')
cmd_yum_deps = params.get('cmd_yum_deps')
cmd_autoreconf = params.get('cmd_autoreconf')
cmd_configure = params.get('cmd_configure')
cmd_make = params.get('cmd_make')
pjdfstest_pkg = params.get('pjdfstest_pkg')
fio_options = params.get('fio_options')
io_timeout = params.get_numeric('io_timeout')
username = params.get('username')
password = params.get('password')
port = params.get('file_transfer_port')
vm = env.get_vm(params.get("main_vm"))
vm.verify_alive()
session = vm.wait_for_login()
host_addr = vm.get_address()
for fs in params.objects("filesystems"):
fs_params = params.object_params(fs)
fs_target = fs_params.get("fs_target")
fs_dest = fs_params.get("fs_dest")
fs_source = fs_params.get("fs_source_dir")
base_dir = fs_params.get("fs_source_base_dir", data_dir.get_data_dir())
if not os.path.isabs(fs_source):
fs_source = os.path.join(base_dir, fs_source)
guest_data = os.path.join(fs_dest, 'fs_test')
host_data = os.path.join(fs_source, 'fs_test')
error_context.context("Create a destination directory %s "
"inside guest." % fs_dest, logging.info)
utils_misc.make_dirs(fs_dest, session)
error_context.context("Mount virtiofs target %s to %s inside guest."
% (fs_target, fs_dest), logging.info)
utils_disk.mount(fs_target, fs_dest, 'virtiofs', session=session)
try:
if cmd_dd:
logging.info("Creating file under %s inside guest." % fs_dest)
session.cmd(cmd_dd % guest_data, io_timeout)
logging.info("Compare the md5 between guest and host.")
md5_guest = session.cmd(cmd_md5 % guest_data,
io_timeout).strip().split()[0]
logging.info(md5_guest)
md5_host = process.run(cmd_md5 % host_data,
io_timeout).stdout_text.strip().split()[0]
if md5_guest != md5_host:
test.fail('The md5 value of host is not same to guest.')
if fio_options:
error_context.context("Run fio on %s." % fs_dest, logging.info)
fio = generate_instance(params, vm, 'fio')
try:
fio.run(fio_options % guest_data, io_timeout)
finally:
fio.clean()
vm.verify_dmesg()
if cmd_pjdfstest:
error_context.context("Run pjdfstest on %s." % fs_dest, logging.info)
host_path = os.path.join(data_dir.get_deps_dir('pjdfstest'), pjdfstest_pkg)
scp_to_remote(host_addr, port, username, password, host_path, fs_dest)
session.cmd(cmd_unpack.format(fs_dest), 180)
session.cmd(cmd_yum_deps, 180)
session.cmd(cmd_autoreconf % fs_dest, 180)
session.cmd(cmd_configure.format(fs_dest), 180)
session.cmd(cmd_make % fs_dest, io_timeout)
session.cmd(cmd_pjdfstest % fs_dest, io_timeout)
finally:
utils_disk.umount(fs_target, fs_dest, 'virtiofs', session=session)
utils_misc.safe_rmdir(fs_dest, session=session)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册