Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
76364bb4
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,发现更多精彩内容 >>
未验证
提交
76364bb4
编写于
10月 15, 2018
作者:
H
Haotong Chen
提交者:
GitHub
10月 15, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1513 from hereischen/support-get_info_while_running
added qemu_img_info_while_vm_running cases
上级
bbfad606
05f40684
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
105 addition
and
0 deletion
+105
-0
qemu/tests/cfg/qemu_img_info_while_running.cfg
qemu/tests/cfg/qemu_img_info_while_running.cfg
+19
-0
qemu/tests/qemu_disk_img.py
qemu/tests/qemu_disk_img.py
+15
-0
qemu/tests/qemu_img_info_while_vm_running.py
qemu/tests/qemu_img_info_while_vm_running.py
+71
-0
未找到文件。
qemu/tests/cfg/qemu_img_info_while_running.cfg
0 → 100644
浏览文件 @
76364bb4
- qemu_img_info_while_vm_running:
virt_test_type = qemu
kill_vm = yes
start_vm = no
force_create_image = no
type = qemu_img_info_while_vm_running
image_chain = "image1 sn"
image_name_sn = "images/sn"
image_format_sn = "qcow2"
create_snapshot = yes
variants:
- boot_with_base_info_snapshot:
only qcow2
- boot_with_snapshot_info_base:
only qcow2
boot_with_snapshot = yes
- boot_and_info_same_img:
only raw
create_snapshot = no
qemu/tests/qemu_disk_img.py
浏览文件 @
76364bb4
...
...
@@ -209,3 +209,18 @@ class QemuImgTest(qemu_storage.QemuImg):
def
run
(
test
,
params
,
env
):
pass
def
generate_base_snapshot_pair
(
image_chain
):
"""
Generate base and snapshot pairs according to param["image_chain"].
:param image_chain: param["image_chain"]
"""
image_chain
=
image_chain
.
split
()
n
=
len
(
image_chain
)
if
n
<
2
:
raise
ValueError
(
"Image_chain should contain at"
"least 2 items, got %s."
%
n
)
for
i
in
range
(
1
,
n
):
yield
[
image_chain
[
i
-
1
],
image_chain
[
i
]]
qemu/tests/qemu_img_info_while_vm_running.py
0 → 100644
浏览文件 @
76364bb4
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 supports to get information of a running image.
Including three tests:
1. Create a raw image.
Boot vm using this image.
'qemu-info' the image.
2. Create a base qcow2 image.
Create an external snapshot.
Boot vm using the base.
'qemu-info' the snapshot.
3. Create a base qcow2 image.
Create an external snapshot.
Boot vm using the snapshot.
'qemu-info' the base.
: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
):
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
)
try
:
img
.
info
()
except
process
.
CmdError
:
test
.
fail
(
"qemu-img info %s failed."
%
info_img
)
def
_qemu_img_info_while_vm_running
(
boot_img
,
info_img
):
_boot_vm
(
boot_img
)
_qemu_img_info
(
info_img
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
if
params
.
get
(
"create_snapshot"
,
"no"
)
==
"yes"
:
# create an external snapshot
gen
=
generate_base_snapshot_pair
(
params
[
"image_chain"
])
base_snapshot_pair
=
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
()
if
params
.
get
(
"boot_with_snapshot"
,
"no"
)
==
"yes"
:
# reverse base snap pair, so boot vm with snapshot
base_snapshot_pair
.
reverse
()
_qemu_img_info_while_vm_running
(
*
base_snapshot_pair
)
else
:
# boot and info same img, raw only
_qemu_img_info_while_vm_running
(
"image1"
,
"image1"
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录