提交 748dfab4 编写于 作者: Y Yumei Huang

nvdimm_mode: Add new case to test change nvdimm mode inside guest

Signed-off-by: NYumei Huang <yuhuang@redhat.com>
上级 5297865a
......@@ -66,3 +66,20 @@
check_command = "grep -A21 '${nv_backend}' /proc/%s/smaps"
clean_command = "rm -rf ${mount_dir}/${nv_backend} && umount ${mount_dir} && rm -rf ${mount_dir}"
start_vm = no
- nvdimm_mode:
type = nvdimm_mode
mem_devs = mem1 mem2
mem-path_mem1 = /tmp/test1.img
mem-path_mem2 = /tmp/test2.img
align_mem1 = 128M
align_mem2 = 128M
dimm_extra_params = "label-size=2M"
pre_command = "dd if=/dev/zero of=${mem-path_mem1} bs=1M count=1024"
pre_command += "; dd if=/dev/zero of=${mem-path_mem2} bs=1M count=1024"
post_command = "rm -rf ${mem-path_mem1} ${mem-path_mem2}"
create_dax_cmd = "ndctl create-namespace -m dax -e namespace%s.0 -f -v -a 4096"
ndctl_check_cmd = "ndctl list"
del mount_dir
del dev_path
del format_command
del mount_command
from virttest import utils_package
from virttest import error_context
@error_context.context_aware
def run(test, params, env):
"""
Run nvdimm cases:
1) Boot guest with two nvdimm devices
2) Change the two nvdimm devices to dax mode inside guest
3) Check if both devices are dax mode
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
vm = env.get_vm(params["main_vm"])
vm.verify_alive()
session = vm.wait_for_login()
if not utils_package.package_install("ndctl", session):
test.cancel("Please install ndctl inside guest to proceed")
create_dax_cmd = params["create_dax_cmd"]
nvdimm_number = len(params["mem_devs"].split())
try:
for i in range(nvdimm_number):
session.cmd(create_dax_cmd % i)
output = session.cmd_output(params["ndctl_check_cmd"])
output = eval(output)
for item in output:
if item['mode'] != 'devdax':
test.fail("Change both nvdimm to dax mode failed")
finally:
utils_package.package_remove("ndctl", session)
session.close()
vm.destroy()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册