Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
b0934c36
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,发现更多精彩内容 >>
未验证
提交
b0934c36
编写于
11月 19, 2018
作者:
H
Haotong Chen
提交者:
GitHub
11月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1545 from hereischen/thin_write_in_qemu_img_commit
added a test checks thin write in qemu-img commit
上级
6d5b5dcd
eab2b1fb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
84 addition
and
0 deletion
+84
-0
qemu/tests/cfg/thin_write_in_qemu_img_commit.cfg
qemu/tests/cfg/thin_write_in_qemu_img_commit.cfg
+18
-0
qemu/tests/thin_write_in_qemu_img_commit.py
qemu/tests/thin_write_in_qemu_img_commit.py
+66
-0
未找到文件。
qemu/tests/cfg/thin_write_in_qemu_img_commit.cfg
0 → 100644
浏览文件 @
b0934c36
- thin_write_in_qemu_img_commit:
only qcow2
virt_test_type = qemu
type = thin_write_in_qemu_img_commit
kill_vm = yes
start_vm = no
force_create_image = no
create_image = yes
remove_image = yes
images = "base"
image_chain = "base sn"
image_name_base = "images/base"
image_size_base = 1G
image_name_sn = "images/sn"
# set size to "", so during snapshot creation
# the cmdline will not have speicfed size option
image_size_sn = ""
write_size = 64K
qemu/tests/thin_write_in_qemu_img_commit.py
0 → 100644
浏览文件 @
b0934c36
import
logging
import
json
from
virttest
import
data_dir
from
virttest
import
utils_numeric
from
virttest.qemu_io
import
QemuIOSystem
from
virttest.qemu_storage
import
QemuImg
from
qemu.tests.qemu_disk_img
import
QemuImgTest
from
qemu.tests.qemu_disk_img
import
generate_base_snapshot_pair
def
run
(
test
,
params
,
env
):
"""
Check thin write in qemu-img commit.
1) write 0x1 into the entire base image through qemu-io
2) create a external snapshot sn of the base
3) write specific length zeros at the beginning of the snapshot
4) commit sn back to base
5) make sure the zeros have been committed into the base image
:param test: Qemu test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def
_get_image_object
(
tag
):
"""Get QemuImg object by tag."""
img_param
=
params
.
object_params
(
tag
)
return
QemuImg
(
img_param
,
img_root_dir
,
tag
)
def
_create_external_snapshot
(
tag
):
"""Create an external snapshot based on tag."""
logging
.
info
(
"Create external snapshot %s."
%
tag
)
qit
=
QemuImgTest
(
test
,
params
,
env
,
snapshot
)
qit
.
create_snapshot
()
def
_qemu_io
(
img
,
cmd
):
"""Run qemu-io cmd to a given img."""
logging
.
info
(
"Run qemu-io %s"
%
img
.
image_filename
)
q
=
QemuIOSystem
(
test
,
params
,
img
.
image_filename
)
q
.
cmd_output
(
cmd
,
120
)
def
_verify_map_output
(
output
):
""""Verify qemu map output."""
expected
=
{
"length"
:
int
(
utils_numeric
.
normalize_data_size
(
params
[
"write_size"
],
"B"
)),
"start"
:
0
,
"depth"
:
0
,
"zero"
:
True
,
"data"
:
False
}
if
expected
not
in
json
.
loads
(
output
.
stdout_text
):
test
.
fail
(
"Commit failed, data from 0 to %s are not zero"
%
params
[
"write_size"
])
gen
=
generate_base_snapshot_pair
(
params
[
"image_chain"
])
img_root_dir
=
data_dir
.
get_data_dir
()
base
,
snapshot
=
next
(
gen
)
img_base
=
_get_image_object
(
base
)
_qemu_io
(
img_base
,
'write -P 1 0 %s'
%
params
[
"image_size_base"
])
_create_external_snapshot
(
snapshot
)
img_sn
=
_get_image_object
(
snapshot
)
_qemu_io
(
img_sn
,
'write -z 0 %s'
%
params
[
"write_size"
])
img_sn
.
commit
()
_verify_map_output
(
img_base
.
map
(
output
=
"json"
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录