Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
045ec71b
T
tp-qemu
项目概览
openeuler
/
tp-qemu
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tp-qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
045ec71b
编写于
6月 01, 2020
作者:
Y
Yanan Fu
提交者:
GitHub
6月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2214 from huangyum/map_sync
nvdimm_mapsync: add new case to test MAP_SYNC
上级
722e536d
d6403b8d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
70 addition
and
0 deletion
+70
-0
qemu/tests/cfg/nvdimm.cfg
qemu/tests/cfg/nvdimm.cfg
+13
-0
qemu/tests/nvdimm_mapsync.py
qemu/tests/nvdimm_mapsync.py
+57
-0
未找到文件。
qemu/tests/cfg/nvdimm.cfg
浏览文件 @
045ec71b
...
...
@@ -53,3 +53,16 @@
ndctl_install_cmd = "rpm -q ndctl || yum install -y ndctl"
create_dax_cmd = "ndctl create-namespace -m dax -e namespace0.0 -f -v -a 4096"
del_dax_cmd = "ndctl create-namespace -m memory -e namespace0.0 -f -v -a 4096"
- nvdimm_mapsync:
type = nvdimm_mapsync
no Host_RHEL.m7
pmem_mem = on
nv_backend = nvdimm0
mount_dir = "/mnt/pmem"
mem-path = "${mount_dir}/${nv_backend}"
format_command = "mkfs.xfs -f ${dev_path} -m reflink=0"
mount_command = "mkdir -p ${mount_dir} && mount -o dax ${dev_path} ${mount_dir}"
truncate_command = "truncate -s ${size_mem} ${mount_dir}/${nv_backend}"
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
qemu/tests/nvdimm_mapsync.py
0 → 100644
浏览文件 @
045ec71b
import
re
import
os
import
pathlib
from
avocado.utils
import
process
from
virttest
import
env_process
from
virttest
import
error_context
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Run nvdimm cases:
1) Mount nvdimm device on host
2) Create a file in the mount point
3) Boot guest with nvdimm backed by the file
4) Check flag 'sf' is present in qemu smaps
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
dev_path
=
params
[
"dev_path"
]
p
=
pathlib
.
Path
(
dev_path
)
if
not
p
.
is_block_device
():
test
.
error
(
"There is no nvdimm device in host, please add kernel param"
"'memmap' to emulate one"
)
format_cmd
=
params
[
"format_command"
]
mount_cmd
=
params
[
"mount_command"
]
truncate_cmd
=
params
[
"truncate_command"
]
check_cmd
=
params
[
"check_command"
]
clean_cmd
=
params
[
"clean_command"
]
try
:
process
.
run
(
format_cmd
)
process
.
run
(
mount_cmd
,
shell
=
True
)
process
.
run
(
truncate_cmd
)
except
Exception
as
e
:
test
.
error
(
e
)
else
:
try
:
params
[
"start_vm"
]
=
"yes"
env_process
.
preprocess_vm
(
test
,
params
,
env
,
params
[
'main_vm'
])
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
vm
.
wait_for_login
()
vm_pid
=
vm
.
get_pid
()
output
=
process
.
system_output
(
check_cmd
%
vm_pid
).
decode
()
if
'sf'
not
in
re
.
findall
(
'(?:VmFlags: )(.*)'
,
output
)[
0
].
split
():
test
.
fail
(
"Flag 'sf' is not present in smaps file"
)
finally
:
vm
.
destroy
()
finally
:
if
os
.
path
.
ismount
(
params
[
"mount_dir"
]):
process
.
run
(
clean_cmd
,
shell
=
True
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录