Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
ddda4d0b
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,发现更多精彩内容 >>
未验证
提交
ddda4d0b
编写于
10月 18, 2018
作者:
H
Haotong Chen
提交者:
GitHub
10月 18, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1516 from hereischen/info_plus_U
added reject_qemu_img_info cases
上级
c76e81e9
dacbf902
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
98 addition
and
0 deletion
+98
-0
qemu/tests/cfg/reject_qemu_img_info.cfg
qemu/tests/cfg/reject_qemu_img_info.cfg
+16
-0
qemu/tests/reject_qemu_img_info.py
qemu/tests/reject_qemu_img_info.py
+82
-0
未找到文件。
qemu/tests/cfg/reject_qemu_img_info.cfg
0 → 100644
浏览文件 @
ddda4d0b
- reject_qemu_img_info:
only qcow2
virt_test_type = qemu
kill_vm = yes
start_vm = no
force_create_image = no
type = reject_qemu_img_info
variants:
- info_snapshot_chain:
image_chain = "image1 sn"
image_name_sn = "images/sn"
image_format_sn = "qcow2"
create_snapshot = yes
backing_chain = yes
- info_running_img:
check_image = yes
qemu/tests/reject_qemu_img_info.py
0 → 100644
浏览文件 @
ddda4d0b
import
logging
from
avocado.utils
import
process
from
virttest
import
data_dir
from
virttest
import
error_context
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
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
'qemu-img' lock tests.
Verify it rejects to get information due to image lock.
Including two tests:
1. Create a base qcow2 image.
Create an external snapshot.
Boot vm using the base.
'qemu-info' the snapshot with option "--backing-chain".
'qemu-info' the snapshot with option "--backing-chain" and "-U".
2. Create a base qcow2 image.
Boot vm using the base.
'qemu-info' the base.
'qemu-info' the base with option "-U".
:param test: Qemu test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def
_boot_vm
(
boot_img
):
error_context
.
context
(
"Boot vm with %s."
%
boot_img
,
logging
.
info
)
vm
.
params
[
"images"
]
=
boot_img
vm
.
create
()
vm
.
verify_alive
()
def
_qemu_img_info
(
info_img
,
force_share
=
False
):
error_context
.
context
(
"Check qemu-img info with %s."
%
info_img
,
logging
.
info
)
img_param
=
params
.
object_params
(
info_img
)
img
=
QemuImg
(
img_param
,
data_dir
.
get_data_dir
(),
info_img
)
img
.
info
(
force_share
)
def
_verify_shared_write_lock_err_msg
(
e
,
img_tag
):
error_context
.
context
(
"Verify qemu-img shared write lock err msg."
,
logging
.
info
)
img_param
=
params
.
object_params
(
img_tag
)
img
=
QemuImg
(
img_param
,
data_dir
.
get_data_dir
(),
img_tag
)
msgs
=
[
'Failed to get shared "write" lock'
,
'Is another process using the image?'
,
img
.
image_filename
]
if
not
all
(
msg
in
e
.
result
.
stderr
.
decode
()
for
msg
in
msgs
):
test
.
fail
(
"Image lock information is not as expected."
)
def
_qemu_img_info_to_verify_image_lock
(
boot_img
,
info_img
,
img_tag
):
_boot_vm
(
boot_img
)
try
:
_qemu_img_info
(
info_img
)
except
process
.
CmdError
as
e
:
_verify_shared_write_lock_err_msg
(
e
,
img_tag
)
else
:
test
.
fail
(
"The image %s is not locked."
%
img_tag
)
try
:
_qemu_img_info
(
info_img
,
True
)
except
process
.
CmdError
:
test
.
fail
(
"qemu-img info %s failed."
%
info_img
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
if
params
.
get
(
"create_snapshot"
,
"no"
)
==
"yes"
:
gen
=
generate_base_snapshot_pair
(
params
[
"image_chain"
])
base
,
snapshot
=
next
(
gen
)
# workaround to assign system disk's image_name to image_name_image1
params
[
"image_name_image1"
]
=
params
[
"image_name"
]
qit
=
QemuImgTest
(
test
,
params
,
env
,
snapshot
)
qit
.
create_snapshot
()
_qemu_img_info_to_verify_image_lock
(
base
,
snapshot
,
base
)
else
:
_qemu_img_info_to_verify_image_lock
(
"image1"
,
"image1"
,
"image1"
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录