Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
dca0d628
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,发现更多精彩内容 >>
未验证
提交
dca0d628
编写于
11月 15, 2017
作者:
X
Xu Han
提交者:
GitHub
11月 15, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1080 from aliang123/1434263
block_hotplug: add support for data plane
上级
026e6b55
010fde8c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
11 deletion
+42
-11
qemu/tests/block_hotplug.py
qemu/tests/block_hotplug.py
+28
-9
qemu/tests/cfg/block_hotplug.cfg
qemu/tests/cfg/block_hotplug.cfg
+14
-2
未找到文件。
qemu/tests/block_hotplug.py
浏览文件 @
dca0d628
import
logging
import
re
import
time
from
virttest
import
data_dir
from
virttest
import
storage
...
...
@@ -60,7 +59,8 @@ def run(test, params, env):
img_list
=
params
.
get
(
"images"
).
split
()
img_format_type
=
params
.
get
(
"img_format_type"
,
"qcow2"
)
pci_type
=
params
.
get
(
"pci_type"
,
"virtio-blk-pci"
)
pause
=
float
(
params
.
get
(
"virtio_block_pause"
,
5.0
))
#sometimes, ppc can't get new plugged disk in 5s, so time to 10s
pause
=
float
(
params
.
get
(
"virtio_block_pause"
,
10.0
))
blk_num
=
int
(
params
.
get
(
"blk_num"
,
1
))
repeat_times
=
int
(
params
.
get
(
"repeat_times"
,
3
))
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
))
...
...
@@ -87,17 +87,24 @@ def run(test, params, env):
for
num
in
xrange
(
blk_num
):
device
=
qdevices
.
QDevice
(
pci_type
)
if
params
.
get
(
"need_plug"
)
==
"yes"
:
disks_before_plug
=
find_disk
(
vm
,
get_disk_cmd
)
if
params
.
get
(
"need_controller"
,
"no"
)
==
"yes"
:
controller_model
=
params
.
get
(
"controller_model"
)
controller
=
qdevices
.
QDevice
(
controller_model
)
bus_extra_param
=
params
.
get
(
"bus_extra_params_%s"
%
img_list
[
num
+
1
])
# TODO:Add iothread support for qdevice
if
bus_extra_param
and
"iothread"
in
bus_extra_param
:
match
=
re
.
search
(
"iothread=(\w+)"
,
bus_extra_param
)
if
match
:
qdevice_params
=
{
"iothread"
:
match
.
group
(
1
)}
controller
.
params
.
update
(
qdevice_params
)
controller
.
hotplug
(
vm
.
monitor
)
ver_out
=
controller
.
verify_hotplug
(
""
,
vm
.
monitor
)
if
not
ver_out
:
err
=
"%s is not in qtree after hotplug"
%
controller_model
test
.
fail
(
err
)
disks_before_plug
=
find_disk
(
vm
,
get_disk_cmd
)
drive
=
qdevices
.
QRHDrive
(
"block%d"
%
num
)
drive
.
set_param
(
"file"
,
find_image
(
img_list
[
num
+
1
]))
drive
.
set_param
(
"format"
,
img_format_type
)
...
...
@@ -106,15 +113,23 @@ def run(test, params, env):
device
.
set_param
(
"drive"
,
drive_id
)
device
.
set_param
(
"id"
,
"block%d"
%
num
)
blk_extra_param
=
params
.
get
(
"blk_extra_params_%s"
%
img_list
[
num
+
1
])
if
blk_extra_param
and
"iothread"
in
blk_extra_param
:
match
=
re
.
search
(
"iothread=(\w+)"
,
blk_extra_param
)
if
match
:
device
.
set_param
(
"iothread"
,
match
.
group
(
1
))
device
.
hotplug
(
vm
.
monitor
)
ver_out
=
device
.
verify_hotplug
(
""
,
vm
.
monitor
)
if
not
ver_out
:
err
=
"%s is not in qtree after hotplug"
%
pci_type
test
.
fail
(
err
)
time
.
sleep
(
pause
)
disks_after_plug
=
find_disk
(
vm
,
get_disk_cmd
)
new_disks
=
get_new_disk
(
disks_before_plug
,
disks_after_plug
)
plug_status
=
utils_misc
.
wait_for
(
lambda
:
len
(
get_new_disk
(
disks_before_plug
,
find_disk
(
vm
,
get_disk_cmd
)))
!=
0
,
pause
)
if
plug_status
:
disks_after_plug
=
find_disk
(
vm
,
get_disk_cmd
)
new_disks
=
get_new_disk
(
disks_before_plug
,
disks_after_plug
)
else
:
test
.
fail
(
"Can't get new disks"
)
else
:
if
params
.
get
(
"drive_format"
)
in
pci_type
:
get_disk_cmd
+=
" | egrep -v '^/dev/[hsv]da[0-9]*$'"
...
...
@@ -173,9 +188,13 @@ def run(test, params, env):
for
num
in
xrange
(
blk_num
):
error_context
.
context
(
"Unplug block device (iteration %d)"
%
iteration
,
logging
.
info
)
disks_before_unplug
=
find_disk
(
vm
,
get_disk_cmd
)
device_list
[
num
].
unplug
(
vm
.
monitor
)
device_list
[
num
].
verify_unplug
(
""
,
vm
.
monitor
)
time
.
sleep
(
pause
)
unplug_status
=
utils_misc
.
wait_for
(
lambda
:
len
(
get_new_disk
(
find_disk
(
vm
,
get_disk_cmd
),
disks_before_unplug
))
!=
0
,
pause
)
if
not
unplug_status
:
test
.
fail
(
"Failed to unplug disks"
)
sub_type
=
params
.
get
(
"sub_type_after_unplug"
)
if
sub_type
:
...
...
qemu/tests/cfg/block_hotplug.cfg
浏览文件 @
dca0d628
...
...
@@ -87,8 +87,6 @@
drive_format_stg0 = virtio
drive_format_stg1 = virtio
get_disk_pattern = "^/dev/vd[a-z]*$"
virtio_blk:
no ppc64 ppc64le
- block_scsi:
pci_type = scsi-hd
drive_format_stg0 = scsi-hd
...
...
@@ -97,3 +95,17 @@
virtio_blk:
need_controller = yes
controller_model = virtio-scsi-pci
variants:
- @default:
- data_plane:
no Host_RHEL.m6
only with_plug.with_system_reset.one_pci
one_pci:
repeat_times = 1
iothreads = iothread0
block_virtio:
blk_extra_params_stg0 = "iothread=${iothreads}"
block_scsi:
no Host_RHEL.m7.u0, Host_RHEL.m7.u1, Host_RHEL.m7.u2
bus_extra_params_stg0 = "iothread=${iothreads}"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录