Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
b466805a
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,发现更多精彩内容 >>
提交
b466805a
编写于
10月 26, 2017
作者:
X
Xu Han
提交者:
GitHub
10月 26, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1093 from peixiu/bug1483853_1488351
Add iozone/reboot/shutdown test after hotplug a data disk
上级
b302d927
b1d9db90
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
22 deletion
+48
-22
qemu/tests/block_hotplug.py
qemu/tests/block_hotplug.py
+34
-19
qemu/tests/cfg/block_hotplug.cfg
qemu/tests/cfg/block_hotplug.cfg
+14
-3
未找到文件。
qemu/tests/block_hotplug.py
浏览文件 @
b466805a
...
...
@@ -5,11 +5,10 @@ import time
from
virttest
import
data_dir
from
virttest
import
storage
from
virttest
import
error_context
from
virttest
import
utils_misc
from
virttest
import
utils_test
from
virttest.qemu_devices
import
qdevices
from
avocado.core
import
exceptions
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
...
...
@@ -39,9 +38,11 @@ def run(test, params, env):
"""
if
params
.
get
(
"os_type"
)
==
"linux"
:
pattern
=
params
.
get
(
"get_disk_pattern"
,
"^/dev/vd[a-z]*$"
)
el
se
:
el
if
params
.
get
(
"os_type"
)
==
"windows"
:
pattern
=
"^\d+"
cmd
=
params
.
get
(
"get_disk_index"
,
"wmic diskdrive get index"
)
else
:
test
.
cancel
(
"Unsupported OS type '%s'"
%
params
.
get
(
"os_type"
))
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
output
=
session
.
cmd_output_safe
(
cmd
)
...
...
@@ -67,12 +68,14 @@ def run(test, params, env):
get_disk_cmd
=
params
.
get
(
"get_disk_cmd"
)
context_msg
=
"Running sub test '%s' %s"
device_list
=
[]
disk_index
=
params
.
objects
(
"disk_index"
)
disk_letter
=
params
.
objects
(
"disk_letter"
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
for
i
in
xrange
(
repeat_times
):
error_context
.
context
(
"Hotplug block device (iteration %d)"
%
i
,
for
i
teration
in
xrange
(
repeat_times
):
error_context
.
context
(
"Hotplug block device (iteration %d)"
%
i
teration
,
logging
.
info
)
sub_type
=
params
.
get
(
"sub_type_before_plug"
)
...
...
@@ -91,7 +94,7 @@ def run(test, params, env):
ver_out
=
controller
.
verify_hotplug
(
""
,
vm
.
monitor
)
if
not
ver_out
:
err
=
"%s is not in qtree after hotplug"
%
controller_model
raise
exceptions
.
TestF
ail
(
err
)
test
.
f
ail
(
err
)
disks_before_plug
=
find_disk
(
vm
,
get_disk_cmd
)
...
...
@@ -107,7 +110,7 @@ def run(test, params, env):
ver_out
=
device
.
verify_hotplug
(
""
,
vm
.
monitor
)
if
not
ver_out
:
err
=
"%s is not in qtree after hotplug"
%
pci_type
raise
exceptions
.
TestF
ail
(
err
)
test
.
f
ail
(
err
)
time
.
sleep
(
pause
)
disks_after_plug
=
find_disk
(
vm
,
get_disk_cmd
)
...
...
@@ -121,33 +124,45 @@ def run(test, params, env):
device_list
.
append
(
device
)
if
not
new_disks
:
raise
exceptions
.
TestF
ail
(
"Cannot find new disk after hotplug."
)
test
.
f
ail
(
"Cannot find new disk after hotplug."
)
if
params
.
get
(
"need_plug"
)
==
"yes"
:
disk
=
new_disks
[
0
]
else
:
disk
=
new_disks
[
num
]
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
if
params
.
get
(
"os_type"
)
==
"windows"
:
if
iteration
==
0
:
error_context
.
context
(
"Format disk"
,
logging
.
info
)
utils_misc
.
format_windows_disk
(
session
,
disk_index
[
num
],
mountpoint
=
disk_letter
[
num
])
error_context
.
context
(
"Check block device after hotplug."
,
logging
.
info
)
if
params
.
get
(
"
pci_test
_cmd"
):
if
params
.
get
(
"
disk_op
_cmd"
):
if
params
.
get
(
"os_type"
)
==
"linux"
:
test_cmd
=
params
.
get
(
"pci_test_cmd"
)
%
(
disk
,
disk
)
test_cmd
=
params
.
get
(
"disk_op_cmd"
)
%
(
disk
,
disk
)
elif
params
.
get
(
"os_type"
)
==
"windows"
:
test_cmd
=
params
.
get
(
"disk_op_cmd"
)
%
(
disk_letter
[
num
],
disk_letter
[
num
])
test_cmd
=
utils_misc
.
set_winutils_letter
(
session
,
test_cmd
)
else
:
test
_cmd
=
re
.
sub
(
"PCI_NUM"
,
"%s"
%
(
num
+
1
),
params
.
get
(
"pci_test_cmd"
))
s
ession
=
vm
.
wait_for_login
(
timeout
=
timeout
)
s
,
o
=
session
.
cmd_status_output
(
test_cmd
,
timeout
=
disk_op_timeout
)
session
.
close
()
if
s
:
raise
exceptions
.
TestFail
(
"Check for block device failed "
"after hotplug, Output: %r"
%
o
)
test
.
cancel
(
"Unsupported OS type '%s'"
%
params
.
get
(
"os_type"
))
s
tatus
,
output
=
session
.
cmd_status_output
(
test_cmd
,
timeout
=
disk_op_timeout
)
if
status
:
test
.
fail
(
"Check for block device failed "
"after hotplug, Output: %r"
%
output
)
session
.
close
(
)
sub_type
=
params
.
get
(
"sub_type_after_plug"
)
if
sub_type
:
error_context
.
context
(
context_msg
%
(
sub_type
,
"after hotplug"
),
logging
.
info
)
utils_test
.
run_virt_sub_test
(
test
,
params
,
env
,
sub_type
)
if
vm
.
is_dead
():
return
sub_type
=
params
.
get
(
"sub_type_before_unplug"
)
if
sub_type
:
...
...
@@ -156,7 +171,7 @@ def run(test, params, env):
utils_test
.
run_virt_sub_test
(
test
,
params
,
env
,
sub_type
)
for
num
in
xrange
(
blk_num
):
error_context
.
context
(
"Unplug block device (iteration %d)"
%
i
,
error_context
.
context
(
"Unplug block device (iteration %d)"
%
i
teration
,
logging
.
info
)
device_list
[
num
].
unplug
(
vm
.
monitor
)
device_list
[
num
].
verify_unplug
(
""
,
vm
.
monitor
)
...
...
qemu/tests/cfg/block_hotplug.cfg
浏览文件 @
b466805a
...
...
@@ -11,10 +11,16 @@
remove_image_stg0 = yes
force_create_image_stg0 = yes
get_disk_cmd = "ls /dev/[hsv]d[a-z]* | sort"
pci_test
_cmd = "dd if=%s of=/dev/null bs=1k count=1000 iflag=direct &&"
pci_test
_cmd += " dd if=/dev/zero of=%s bs=1k count=1000 oflag=direct"
disk_op
_cmd = "dd if=%s of=/dev/null bs=1k count=1000 iflag=direct &&"
disk_op
_cmd += " dd if=/dev/zero of=%s bs=1k count=1000 oflag=direct"
kill_vm_on_error = yes
Windows:
disk_index = "1 2"
disk_letter = "I J"
disk_op_cmd = "WIN_UTILS:\Iozone\iozone.exe -azR -r 64k -n 125M -g 512M -M -i 0"
disk_op_cmd += " -i 1 -b %s:\iozone_test -f %s:\testfile"
variants:
- one_pci:
blk_num = 1
...
...
@@ -34,10 +40,15 @@
- with_repetition:
repeat_times = 300
- with_reboot:
sub_type_after_plug = boot
sub_type_after_unplug = boot
reboot_method = shell
- with_shutdown:
sub_type_after_unplug = shutdown
variants:
- after_plug:
sub_type_after_plug = shutdown
- after_unplug:
sub_type_after_unplug = shutdown
shutdown_method = shell
check_img = yes
repeat_times = 1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录