Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
8153c8d2
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,发现更多精彩内容 >>
未验证
提交
8153c8d2
编写于
11月 17, 2017
作者:
X
Xu Han
提交者:
GitHub
11月 17, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1145 from vivianQizhu/bz1510732
block_stream: Add monitor method check size for qemu2.10
上级
3c28c86d
61ee0799
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
15 deletion
+27
-15
qemu/tests/block_stream.py
qemu/tests/block_stream.py
+27
-15
未找到文件。
qemu/tests/block_stream.py
浏览文件 @
8153c8d2
import
re
import
logging
from
a
utotest.client.shared
import
error
,
util
s
from
a
vocado.utils
import
proces
s
from
virttest
import
error_context
from
virttest
import
env_process
,
utils_misc
from
qemu.tests
import
blk_stream
...
...
@@ -11,16 +12,27 @@ from qemu.tests import blk_stream
class
BlockStreamTest
(
blk_stream
.
BlockStream
):
def
get_image_size
(
self
,
image_file
):
qemu_img
=
utils_misc
.
get_qemu_img_binary
(
self
.
params
)
cmd
=
"%s info %s"
%
(
qemu_img
,
image_file
)
info
=
utils
.
system_output
(
cmd
)
size
=
re
.
findall
(
"(\d+) bytes"
,
info
)
try
:
qemu_img
=
utils_misc
.
get_qemu_img_binary
(
self
.
params
)
cmd
=
"%s info %s"
%
(
qemu_img
,
image_file
)
logging
.
info
(
"Try to get image size via qemu-img info"
)
info
=
process
.
system_output
(
cmd
)
size
=
int
(
re
.
findall
(
"(\d+) bytes"
,
info
)[
0
])
except
process
.
CmdError
:
logging
.
info
(
"qemu-img info failed(it happens because later qemu"
" distributions prevent it access a running image.)."
" Now get image size via qmp interface 'query-block'"
)
blocks_info
=
self
.
vm
.
monitor
.
info
(
"block"
)
for
block
in
blocks_info
:
info
=
block
[
"inserted"
]
if
image_file
==
info
[
"file"
]:
size
=
info
[
"image"
][
"virtual-size"
]
if
size
:
return
int
(
size
[
0
])
return
size
return
0
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Test block streaming functionality.
...
...
@@ -39,23 +51,23 @@ def run(test, params, env):
stream_test
.
create_snapshots
()
backingfile
=
stream_test
.
get_backingfile
()
if
not
backingfile
:
raise
error
.
TestF
ail
(
"Backing file is not available in the "
"backdrive image"
)
test
.
f
ail
(
"Backing file is not available in the "
"backdrive image"
)
logging
.
info
(
"Image file: %s"
%
stream_test
.
get_image_file
())
logging
.
info
(
"Backing file: %s"
%
backingfile
)
stream_test
.
start
()
stream_test
.
wait_for_finished
()
backingfile
=
stream_test
.
get_backingfile
()
if
backingfile
:
raise
error
.
TestF
ail
(
"Backing file is still available in the "
"backdrive image"
)
test
.
f
ail
(
"Backing file is still available in the "
"backdrive image"
)
target_file
=
stream_test
.
get_image_file
()
target_size
=
stream_test
.
get_image_size
(
target_file
)
error
.
context
(
"Compare image size"
,
logging
.
info
)
error
_context
.
context
(
"Compare image size"
,
logging
.
info
)
if
image_size
<
target_size
:
raise
error
.
TestF
ail
(
"Compare %s image, size of %s increased"
"(%s -> %s)"
%
(
image_file
,
target_file
,
image_size
,
target_size
))
test
.
f
ail
(
"Compare %s image, size of %s increased"
"(%s -> %s)"
%
(
image_file
,
target_file
,
image_size
,
target_size
))
stream_test
.
verify_alive
()
stream_test
.
vm
.
destroy
()
vm_name
=
params
[
"main_vm"
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录