Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
bfd26ecb
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,发现更多精彩内容 >>
未验证
提交
bfd26ecb
编写于
3月 13, 2020
作者:
L
Longxiang Lyu
提交者:
GitHub
3月 13, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2138 from hellohellenmao/1811588
New case of resize_short_overlay
上级
6efb4af7
4894ed99
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
73 addition
and
0 deletion
+73
-0
qemu/tests/cfg/resize_short_overlay.cfg
qemu/tests/cfg/resize_short_overlay.cfg
+22
-0
qemu/tests/resize_short_overlay.py
qemu/tests/resize_short_overlay.py
+51
-0
未找到文件。
qemu/tests/cfg/resize_short_overlay.cfg
0 → 100644
浏览文件 @
bfd26ecb
- resize_short_overlay:
only qcow2
virt_test_type = qemu
type = resize_short_overlay
start_vm = no
force_create_image = no
remove_image = yes
images = "base mid top"
image_chain = "base mid top"
image_name_base = "images/base"
image_size_base = 2M
image_format_base = qcow2
image_name_mid = "images/mid"
image_size_mid = 1M
image_format_mid = qcow2
image_name_top = "images/top"
image_size_top = 2M
image_format_top = qcow2
# 2M - 1M ($image_size_top - $image_size_mid)
diff_size = 1M
base_cmd = "write -P1 0 ${image_size_base}"
top_cmd = "read -P0 ${image_size_mid} ${diff_size}"
qemu/tests/resize_short_overlay.py
0 → 100644
浏览文件 @
bfd26ecb
import
logging
from
avocado
import
fail_on
from
avocado.utils
import
process
from
virttest
import
data_dir
from
virttest.qemu_io
import
QemuIOSystem
from
virttest.qemu_storage
import
QemuImg
def
run
(
test
,
params
,
env
):
"""
Check the data after resizing short overlay over longer backing files.
1. Create a qcow2 base image.
2. Create a middle snapshot file with smaller size.
3. Create a top snapshot with the size as the same as the one of base.
4. Write '1' to the base image file.
5. Check the data of the top image file.
6. Commit top image file.
7. Check the data in the middle image file.
:param test: VT test object.
:param params: Dictionary with the test parameters.
:param env: Dictionary with test environment.
"""
def
_qemu_io
(
img
,
cmd
):
"""Run qemu-io cmd to a given img."""
logging
.
info
(
"Run qemu-io %s"
%
img
.
image_filename
)
try
:
QemuIOSystem
(
test
,
params
,
img
.
image_filename
).
cmd_output
(
cmd
,
120
)
except
process
.
CmdError
as
err
:
test
.
fail
(
"qemu-io to '%s' failed: %s."
%
(
img
.
image_filename
,
err
))
images
=
params
[
"image_chain"
].
split
()
root_dir
=
data_dir
.
get_data_dir
()
base
=
QemuImg
(
params
.
object_params
(
images
[
0
]),
root_dir
,
images
[
0
])
mid
=
QemuImg
(
params
.
object_params
(
images
[
1
]),
root_dir
,
images
[
1
])
top
=
QemuImg
(
params
.
object_params
(
images
[
-
1
]),
root_dir
,
images
[
-
1
])
logging
.
info
(
"Create base and snapshot files"
)
for
image
in
(
base
,
mid
,
top
):
image
.
create
(
image
.
params
)
_qemu_io
(
base
,
params
[
"base_cmd"
])
top_cmd
=
params
[
"top_cmd"
]
_qemu_io
(
top
,
top_cmd
)
logging
.
info
(
"Commit %s image file."
%
top
.
image_filename
)
fail_on
((
process
.
CmdError
,))(
top
.
commit
)()
_qemu_io
(
mid
,
top_cmd
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录