Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
a7fb112b
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,发现更多精彩内容 >>
提交
a7fb112b
编写于
10月 28, 2015
作者:
X
Xu Tian
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #407 from spcui/physical_resources_check
qemu.tests: Add more debug log to check
上级
6a81ffde
5448fd44
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
23 deletion
+27
-23
qemu/tests/physical_resources_check.py
qemu/tests/physical_resources_check.py
+27
-23
未找到文件。
qemu/tests/physical_resources_check.py
浏览文件 @
a7fb112b
...
...
@@ -14,6 +14,7 @@ from virttest import data_dir
from
virttest
import
qemu_qtree
@
error
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Check physical resources assigned to KVM virtual machines:
...
...
@@ -48,7 +49,7 @@ def run(test, params, env):
fail_log
+=
" Reported by OS: %d"
%
actual_num
f_fail
.
append
(
fail_log
)
logging
.
error
(
fail_log
)
return
expected_num
,
f_fail
return
f_fail
# Define a function for checking hard drives & NICs' model
def
chk_fmt_model
(
device
,
fmt_model
,
info_cmd
,
regexp
):
...
...
@@ -227,7 +228,10 @@ def run(test, params, env):
vm
.
verify_alive
()
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
))
chk_timeout
=
int
(
params
.
get
(
"chk_timeout"
,
240
))
error
.
context
(
"Login to the guest"
,
logging
.
info
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
qtree
=
qemu_qtree
.
QtreeContainer
()
try
:
qtree
.
parse_info_qtree
(
vm
.
monitor
.
info
(
'qtree'
))
...
...
@@ -245,7 +249,7 @@ def run(test, params, env):
image_name
=
storage
.
get_image_filename
(
params
,
data_dir
.
get_data_dir
())
# Check cpu count
logging
.
info
(
"CPU count check"
)
error
.
context
(
"CPU count check"
,
logging
.
info
)
actual_cpu_nr
=
vm
.
get_cpu_count
()
cpu_cores_num
=
get_cpu_number
(
"cores"
,
chk_timeout
)
cpu_lp_num
=
get_cpu_number
(
"logical_processors"
,
chk_timeout
)
...
...
@@ -286,7 +290,7 @@ def run(test, params, env):
logging
.
error
(
fail_log
)
# Check memory size
logging
.
info
(
"Memory size check"
)
error
.
context
(
"Memory size check"
,
logging
.
info
)
expected_mem
=
int
(
params
[
"mem"
])
actual_mem
=
vm
.
get_memory_size
()
if
actual_mem
!=
expected_mem
:
...
...
@@ -296,36 +300,36 @@ def run(test, params, env):
n_fail
.
append
(
fail_log
)
logging
.
error
(
fail_log
)
logging
.
info
(
"Hard drive count check"
)
_
,
f_fail
=
check_num
(
"images"
,
"block"
,
image_name
)
error
.
context
(
"Hard drive count check"
,
logging
.
info
)
f_fail
=
check_num
(
"images"
,
"block"
,
image_name
)
n_fail
.
extend
(
f_fail
)
logging
.
info
(
"NIC count check"
)
_
,
f_fail
=
check_num
(
"nics"
,
"network"
,
"model="
)
error
.
context
(
"NIC count check"
,
logging
.
info
)
f_fail
=
check_num
(
"nics"
,
"network"
,
"model="
)
n_fail
.
extend
(
f_fail
)
logging
.
info
(
"NICs model check"
)
error
.
context
(
"NICs model check"
,
logging
.
info
)
f_fail
=
chk_fmt_model
(
"nics"
,
"nic_model"
,
"network"
,
"model=(.*),"
)
n_fail
.
extend
(
f_fail
)
if
qtree
is
not
None
:
logging
.
info
(
"Images params check"
)
error
.
context
(
"Images params check"
,
logging
.
info
)
logging
.
debug
(
"Found devices: %s"
,
params
.
objects
(
'images'
))
qdisks
=
qemu_qtree
.
QtreeDisksContainer
(
qtree
.
get_nodes
())
_
=
sum
(
qdisks
.
parse_info_block
(
vm
.
monitor
.
info_block
()))
_
+=
qdisks
.
generate_params
()
_
+=
qdisks
.
check_disk_params
(
params
)
if
_
:
_
=
(
"Images check failed with %s errors, check the log for
"
"details"
%
_
)
logging
.
error
(
_
)
n_fail
.
append
(
_
)
disk_errors
=
sum
(
qdisks
.
parse_info_block
(
vm
.
monitor
.
info_block
()))
disk_errors
+=
qdisks
.
generate_params
()
disk_errors
+=
qdisks
.
check_disk_params
(
params
)
if
disk_errors
:
disk_errors
=
(
"Images check failed with %s errors,
"
"check the log for details"
%
disk_errors
)
logging
.
error
(
disk_errors
)
n_fail
.
append
(
"
\n
"
.
join
(
qdisks
.
errors
)
)
else
:
logging
.
info
(
"Images check param skipped (qemu monitor doesn't "
"support 'info qtree')"
)
logging
.
info
(
"Network card MAC check"
)
error
.
context
(
"Network card MAC check"
,
logging
.
info
)
o
=
""
try
:
o
=
vm
.
monitor
.
human_monitor_cmd
(
"info network"
)
...
...
@@ -346,13 +350,13 @@ def run(test, params, env):
n_fail
.
append
(
fail_log
)
logging
.
error
(
fail_log
)
logging
.
info
(
"UUID check"
)
error
.
context
(
"UUID check"
,
logging
.
info
)
if
vm
.
get_uuid
():
f_fail
=
verify_device
(
vm
.
get_uuid
(),
"UUID"
,
params
.
get
(
"catch_uuid_cmd"
))
n_fail
.
extend
(
f_fail
)
logging
.
info
(
"Hard Disk serial number check"
)
error
.
context
(
"Hard Disk serial number check"
,
logging
.
info
)
catch_serial_cmd
=
params
.
get
(
"catch_serial_cmd"
)
f_fail
=
verify_device
(
params
.
get
(
"drive_serial"
),
"Serial"
,
catch_serial_cmd
)
...
...
@@ -361,7 +365,7 @@ def run(test, params, env):
# only check if the MS Windows VirtIO driver is digital signed.
chk_cmd
=
params
.
get
(
"vio_driver_chk_cmd"
)
if
chk_cmd
:
logging
.
info
(
"Virtio Driver Check"
)
error
.
context
(
"Virtio Driver Check"
,
logging
.
info
)
chk_output
=
session
.
cmd_output
(
chk_cmd
,
timeout
=
chk_timeout
)
if
"FALSE"
in
chk_output
:
fail_log
=
"VirtIO driver is not digitally signed!"
...
...
@@ -369,7 +373,7 @@ def run(test, params, env):
n_fail
.
append
(
fail_log
)
logging
.
error
(
fail_log
)
logging
.
info
(
"Machine Type Check"
)
error
.
context
(
"Machine Type Check"
,
logging
.
info
)
f_fail
=
verify_machine_type
()
n_fail
.
extend
(
f_fail
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录