Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
8b54bf2c
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,发现更多精彩内容 >>
未验证
提交
8b54bf2c
编写于
1月 09, 2018
作者:
X
Xu Han
提交者:
GitHub
1月 09, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1130 from aliang123/1506101
Correct logic for device's boot_fail
上级
c4e1ef0d
3e0450f3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
23 addition
and
29 deletion
+23
-29
qemu/tests/boot_from_device.py
qemu/tests/boot_from_device.py
+19
-25
qemu/tests/cfg/boot_from_device.cfg
qemu/tests/cfg/boot_from_device.cfg
+4
-4
未找到文件。
qemu/tests/boot_from_device.py
浏览文件 @
8b54bf2c
...
@@ -4,7 +4,7 @@ import time
...
@@ -4,7 +4,7 @@ import time
import
logging
import
logging
from
autotest.client
import
utils
from
autotest.client
import
utils
from
autotest.client.shared
import
error
from
virttest
import
error_context
from
virttest
import
utils_misc
from
virttest
import
utils_misc
from
virttest
import
data_dir
from
virttest
import
data_dir
...
@@ -12,7 +12,7 @@ from virttest import qemu_storage
...
@@ -12,7 +12,7 @@ from virttest import qemu_storage
from
virttest
import
env_process
from
virttest
import
env_process
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
def
run
(
test
,
params
,
env
):
"""
"""
QEMU boot from device:
QEMU boot from device:
...
@@ -74,49 +74,43 @@ def run(test, params, env):
...
@@ -74,49 +74,43 @@ def run(test, params, env):
elif
dev_name
==
"iscsi-dev"
:
elif
dev_name
==
"iscsi-dev"
:
postprocess_remote_storage
()
postprocess_remote_storage
()
def
check_boot_result
(
boot_fail_info
,
device_name
):
def
check_boot_result
(
boot_
entry_info
,
boot_
fail_info
,
device_name
):
"""
"""
Check boot result, and logout from iscsi device if boot from iscsi.
Check boot result, and logout from iscsi device if boot from iscsi.
"""
"""
logging
.
info
(
"Wait for display and check boot info."
)
logging
.
info
(
"Wait for display and check boot info."
)
infos
=
boot_fail_info
.
split
(
';'
)
start
=
time
.
time
()
start
=
time
.
time
()
while
True
:
while
True
:
try
:
try
:
output
=
vm
.
serial_console
.
get_stripped_output
()
output
=
vm
.
serial_console
.
get_stripped_output
()
except
ValueError
:
except
ValueError
:
output
=
vm
.
serial_console
.
get_output
()
output
=
vm
.
serial_console
.
get_output
()
match
=
re
.
search
(
infos
[
0
],
output
)
if
boot_fail_info
in
output
:
if
match
or
time
.
time
()
>
start
+
timeout
:
test
.
fail
(
"Could not boot from"
" '%s'"
%
device_name
)
elif
boot_entry_info
in
output
:
break
break
if
time
.
time
()
>
start
+
timeout
:
test
.
fail
(
"No device for boot after %s"
%
timeout
)
time
.
sleep
(
1
)
time
.
sleep
(
1
)
logging
.
info
(
"Try to boot from '%s'"
%
device_name
)
logging
.
info
(
"Try to boot from '%s'"
%
device_name
)
try
:
try
:
if
dev_name
==
"hard-drive"
or
(
dev_name
==
"scsi-hd"
and
not
if
dev_name
==
"hard-drive"
or
(
dev_name
==
"scsi-hd"
and
not
params
.
get
(
"image_name_stg"
)):
params
.
get
(
"image_name_stg"
)):
error
.
context
(
"Log into the guest to verify it's up"
,
error
_context
.
context
(
"Log into the guest to verify it's up"
,
logging
.
info
)
logging
.
info
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
session
.
close
()
session
.
close
()
vm
.
destroy
()
vm
.
destroy
()
return
return
try
:
output
=
vm
.
serial_console
.
get_stripped_output
()
except
ValueError
:
output
=
vm
.
serial_console
.
get_output
()
for
i
in
infos
:
if
not
re
.
search
(
i
,
output
):
raise
error
.
TestFail
(
"Could not boot from"
" '%s'"
%
device_name
)
finally
:
finally
:
cleanup
(
device_name
)
cleanup
(
device_name
)
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
))
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
))
boot_menu_key
=
params
.
get
(
"boot_menu_key"
,
'f12'
)
boot_menu_key
=
params
.
get
(
"boot_menu_key"
,
'f12'
)
boot_menu_hint
=
params
.
get
(
"boot_menu_hint"
)
boot_menu_hint
=
params
.
get
(
"boot_menu_hint"
)
boot_entry_info
=
params
.
get
(
"boot_entry_info"
)
boot_fail_info
=
params
.
get
(
"boot_fail_info"
)
boot_fail_info
=
params
.
get
(
"boot_fail_info"
)
boot_device
=
params
.
get
(
"boot_device"
)
boot_device
=
params
.
get
(
"boot_device"
)
dev_name
=
params
.
get
(
"dev_name"
)
dev_name
=
params
.
get
(
"dev_name"
)
...
@@ -151,7 +145,7 @@ def run(test, params, env):
...
@@ -151,7 +145,7 @@ def run(test, params, env):
time
.
sleep
(
1
)
time
.
sleep
(
1
)
if
not
match
:
if
not
match
:
cleanup
(
dev_name
)
cleanup
(
dev_name
)
raise
error
.
TestF
ail
(
"Could not get boot menu message. "
test
.
f
ail
(
"Could not get boot menu message. "
"Excepted Result: '%s', Actual result: '%s'"
"Excepted Result: '%s', Actual result: '%s'"
%
(
boot_menu_hint
,
console_str
))
%
(
boot_menu_hint
,
console_str
))
...
@@ -166,7 +160,7 @@ def run(test, params, env):
...
@@ -166,7 +160,7 @@ def run(test, params, env):
if
not
boot_list
:
if
not
boot_list
:
cleanup
(
dev_name
)
cleanup
(
dev_name
)
raise
error
.
TestF
ail
(
"Could not get boot entries list."
)
test
.
f
ail
(
"Could not get boot entries list."
)
logging
.
info
(
"Got boot menu entries: '%s'"
,
boot_list
)
logging
.
info
(
"Got boot menu entries: '%s'"
,
boot_list
)
for
i
,
v
in
enumerate
(
boot_list
,
start
=
1
):
for
i
,
v
in
enumerate
(
boot_list
,
start
=
1
):
...
@@ -175,7 +169,7 @@ def run(test, params, env):
...
@@ -175,7 +169,7 @@ def run(test, params, env):
vm
.
send_key
(
str
(
i
))
vm
.
send_key
(
str
(
i
))
break
break
else
:
else
:
raise
error
.
TestF
ail
(
"Could not get any boot entry match "
test
.
f
ail
(
"Could not get any boot entry match "
"pattern '%s'"
%
boot_device
)
"pattern '%s'"
%
boot_device
)
check_boot_result
(
boot_fail_info
,
dev_name
)
check_boot_result
(
boot_
entry_info
,
boot_
fail_info
,
dev_name
)
qemu/tests/cfg/boot_from_device.cfg
浏览文件 @
8b54bf2c
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
Host_RHEL.m7:
Host_RHEL.m7:
boot_menu_key = "esc"
boot_menu_key = "esc"
boot_menu_hint = "Press .*(F12|ESC) for boot menu"
boot_menu_hint = "Press .*(F12|ESC) for boot menu"
boot_
fail_info = "Booting from Hard Disk...;
"
boot_
entry_info = "Booting from Hard Disk...
"
boot_fail_info
+
= "Boot failed: not a bootable disk"
boot_fail_info = "Boot failed: not a bootable disk"
variants:
variants:
- boot_from_hard_drive:
- boot_from_hard_drive:
dev_name = hard-drive
dev_name = hard-drive
...
@@ -65,8 +65,8 @@
...
@@ -65,8 +65,8 @@
cdroms = "test"
cdroms = "test"
cdrom_test = /tmp/test.iso
cdrom_test = /tmp/test.iso
cd_format = scsi-cd
cd_format = scsi-cd
boot_
fail_info = "Booting from DVD/CD...;
"
boot_
entry_info = "Booting from DVD/CD...
"
boot_fail_info
+
= "Boot failed: Could not read from CDROM"
boot_fail_info = "Boot failed: Could not read from CDROM"
variants:
variants:
- with_local_iso:
- with_local_iso:
bootindex_test = 0
bootindex_test = 0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录