Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
5b19239f
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,发现更多精彩内容 >>
提交
5b19239f
编写于
6月 14, 2016
作者:
V
vivianQizhu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update drive_mirror test cases
上级
d47a7de5
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
195 addition
and
87 deletion
+195
-87
qemu/tests/cfg/drive_mirror.cfg
qemu/tests/cfg/drive_mirror.cfg
+64
-82
qemu/tests/cfg/drive_mirror_negtive_tests.cfg
qemu/tests/cfg/drive_mirror_negtive_tests.cfg
+86
-0
qemu/tests/drive_mirror.py
qemu/tests/drive_mirror.py
+42
-3
qemu/tests/drive_mirror_cancel.py
qemu/tests/drive_mirror_cancel.py
+1
-1
qemu/tests/drive_mirror_complete.py
qemu/tests/drive_mirror_complete.py
+2
-1
未找到文件。
qemu/tests/cfg/drive_mirror.cfg
浏览文件 @
5b19239f
...
...
@@ -2,8 +2,8 @@
no Host_RHEL.m5
no Host_RHEL.m6.u1
no Host_RHEL.m6.u2
no
raw
qed vmdk
type = drive_mirror
no qed vmdk
type = drive_mirror
_simple
monitor_type = qmp
monitors = qmp1
main_monitor = qmp1
...
...
@@ -17,7 +17,7 @@
# config file if that is going to be tested
#block_mirror_cmd = "__com.redhat_drive-mirror"
#block_reopen_cmd = "__com.redhat_drive-reopen"
wait_timeout =
36
00
wait_timeout =
60
00
# wait_timeout: wait xx seconds for block mirror job go into steady status, aka offset equal image length
source_images = "image1"
target_image_image1 = "target"
...
...
@@ -26,39 +26,21 @@
#for full image or top most
default_speed_image1 = 0
# default speed unit is B/s, for 10MB/s please set speed to '10M'
image_format_target = "qcow2"
create_mode_target = "absolute-paths"
image_name_target = "images/target1"
check_event = no
tmp_dir = "/tmp"
variants:
- simple_test:
type = drive_mirror_simple
repeat_times = 3
cancel_timeout = 5
variants:
- cancel:
before_steady = "cancel"
cancel_timeout_image1 = 3
- set_speed:
max_speed_image1 = 10M
before_steady = "set_speed"
- reset_speed:
default_speed_image1 = 10M
max_speed_image1 = 1M
before_steady = "set_speed"
- query:
before_steady = "query_status"
default_speed_image1 = 3M
max_speed_image1 = 10M
- mirroring:
variants:
- block_job_complete:
type = drive_mirror_complete
- 2qcow2:
image_format_target = "qcow2"
- 2raw:
image_format_target = "raw"
variants:
- target_i
n_localfs:
- @o
n_localfs:
boot_target_image = no
- target_i
n_nfs:
- o
n_nfs:
image_type_target = nfs
nfs_mount_dir = "/mnt/nfs"
image_name_target = "${nfs_mount_dir}/target1"
...
...
@@ -67,8 +49,9 @@
export_options = "rw,no_root_squash,async"
setup_local_nfs = yes
boot_target_image = yes
- target_to_iscsi:
image_format_target = qcow2
start_firewall_cmd = "iptables -A INPUT -p tcp -d 127.0.0.1 --dport 2049 -j DROP"
- on_iscsi:
image_format_target = raw
# target_image will ingore, target_image will generate automatically
image_type_target = iscsi
force_cleanup_target = yes
...
...
@@ -78,14 +61,39 @@
portal_ip_target = "192.168.1.2"
initiator_target = "iqn.2010-07.test.org:kvmautotest"
target_target = "iqn.2001-05.com.equallogic:0-8a0906-db31f7d03-470263b05654c204-kvm-test"
start_firewall_cmd = "iptables -A INPUT -p tcp -d ${portal_ip_target} --dport 3260 -j DROP"
# End
- negative_test:
negative_test = yes
variants:
- readonly_target:
create_mode_target = existing
before_start = readonly_target
before_cleanup = clear_readonly_bit
- job_cancel:
before_steady = "cancel"
cancel_timeout_image1 = 3
- set_job_speed:
max_speed_image1 = 10M
before_steady = "set_speed"
- reset_job_speed:
default_speed_image1 = 10M
max_speed_image1 = 1M
before_steady = "set_speed"
- query_job_status:
before_steady = "query_status"
default_speed_image1 = 3M
max_speed_image1 = 10M
- job_complete:
type = drive_mirror_complete
boot_target_image = no
variants:
- granularity:
when_steady = check_granularity
variants:
- 512:
granularity = 512
buf_count = 10
- 67108864:
granularity = 67108864
buf_count = 2
- node_name:
after_reopen = check_node_name
node_name = "node2"
- with_stress:
type = drive_mirror_stress
reopen_timeout = 600
...
...
@@ -140,29 +148,3 @@
before_start = "load_stress"
when_steady = "powerdown"
after_reopen ="verify_alive"
- cancel_blocked_jobs:
type = drive_mirror_cancel
cancel_timeout = 10
pre_command = "service iptables restart || systemctl restart iptables.service"
stop_firewall_cmd = "iptables -F"
post_command = "iptables -F"
variants:
- target_in_nfs:
image_type_target = nfs
nfs_mount_dir = "/mnt/nfs"
image_name_target = "${nfs_mount_dir}/target1"
nfs_mount_options = "rw"
export_dir = "/home/nfs"
export_options = "rw,no_root_squash,async"
setup_local_nfs = yes
start_firewall_cmd = "iptables -A INPUT -p tcp -d 127.0.0.1 --dport 2049 -j DROP"
- target_to_iscsi:
# target_image will ingore, target_image will generate automatically
image_type_target = iscsi
force_cleanup_target = yes
host_setup_flag_target = 2
# Please replace below iscsi connection params before start your testing
portal_ip_target = "192.168.1.2"
initiator_target = "iqn.2010-07.test.org:kvmautotest"
target_target = "iqn.2001-05.com.equallogic:0-8a0906-db31f7d03-470263b05654c204-kvm-test"
start_firewall_cmd = "iptables -A INPUT -p tcp -d ${portal_ip_target} --dport 3260 -j DROP"
qemu/tests/cfg/drive_mirror_negtive_tests.cfg
0 → 100644
浏览文件 @
5b19239f
- drive_mirror_negtive_tests:
no Host_RHEL.m5
no Host_RHEL.m6.u1
no Host_RHEL.m6.u2
no qed vmdk
type = drive_mirror_simple
monitor_type = qmp
monitors = qmp1
main_monitor = qmp1
backup_image_before_testing = yes
restore_image_after_testing = yes
# Recent QEMU upstream (and the variants shipped by recent distros) use
# drive-mirror and block-job-complete
block_mirror_cmd = drive-mirror
block_reopen_cmd = block-job-complete
# RHEL6 does use some different, internal commands, need to adjust on your
# config file if that is going to be tested
#block_mirror_cmd = "__com.redhat_drive-mirror"
#block_reopen_cmd = "__com.redhat_drive-reopen"
wait_timeout = 6000
# wait_timeout: wait xx seconds for block mirror job go into steady status, aka offset equal image length
source_images = "image1"
target_image_image1 = "target"
# source_images: set which image will be mirroring to target, now only a image at one time;
full_copy_image1 = "full"
#for full image or top most
default_speed_image1 = 0
# default speed unit is B/s, for 10MB/s please set speed to '10M'
create_mode_target = "absolute-paths"
image_name_target = "images/target1"
check_event = no
tmp_dir = "/tmp"
repeat_times = 3
cancel_timeout = 5
negative_test = yes
variants:
- 2qcow2:
image_format_target = "qcow2"
- 2raw:
image_format_target = "raw"
variants:
- @on_localfs:
boot_target_image = no
- on_nfs:
image_type_target = nfs
nfs_mount_dir = "/mnt/nfs"
image_name_target = "${nfs_mount_dir}/target1"
nfs_mount_options = "rw"
export_dir = "/home/nfs"
export_options = "rw,no_root_squash,async"
setup_local_nfs = yes
boot_target_image = yes
start_firewall_cmd = "iptables -A INPUT -p tcp -d 127.0.0.1 --dport 2049 -j DROP"
- on_iscsi:
image_format_target = raw
# target_image will ingore, target_image will generate automatically
image_type_target = iscsi
force_cleanup_target = yes
host_setup_flag_target = 2
boot_target_image = yes
# Please replace below iscsi connection params before start your testing
portal_ip_target = "192.168.1.2"
initiator_target = "iqn.2010-07.test.org:kvmautotest"
target_target = "iqn.2001-05.com.equallogic:0-8a0906-db31f7d03-470263b05654c204-kvm-test"
start_firewall_cmd = "iptables -A INPUT -p tcp -d ${portal_ip_target} --dport 3260 -j DROP"
# End
variants:
- readonly_target:
only on_localfs
create_mode_target = existing
before_start = readonly_target
before_cleanup = clear_readonly_bit
- cancel_blocked_jobs:
no on_localfs
type = drive_mirror_cancel
cancel_timeout = 10
pre_command = "service iptables restart || systemctl restart iptables.service"
stop_firewall_cmd = "iptables -F"
post_command = "iptables -F"
- cancel_blocked_jobs:
no on_localfs
type = drive_mirror_cancel
cancel_timeout = 10
pre_command = "service iptables restart || systemctl restart iptables.service"
stop_firewall_cmd = "iptables -F"
post_command = "iptables -F"
qemu/tests/drive_mirror.py
浏览文件 @
5b19239f
...
...
@@ -65,6 +65,37 @@ class DriveMirror(block_copy.BlockCopy):
image_file
=
storage
.
get_image_filename
(
params
,
self
.
data_dir
)
return
self
.
vm
.
get_block
({
"file"
:
image_file
})
@
error
.
context_aware
def
check_granularity
(
self
):
"""
Check granularity value as set.
"""
device_id
=
self
.
get_device
()
info
=
self
.
vm
.
monitor
.
info_block
().
get
(
device_id
)
if
"granularity"
in
self
.
params
:
target_gran
=
int
(
self
.
params
[
"granularity"
])
dirty_bitmap
=
info
.
get
(
"dirty-bitmaps"
,
"0"
)
granularity
=
int
(
dirty_bitmap
[
0
].
get
(
"granularity"
,
"0"
))
if
granularity
!=
target_gran
:
raise
error
.
TestFail
(
"Granularity unmatched. Target is %d, result is %d"
%
(
target_gran
,
granularity
))
@
error
.
context_aware
def
check_node_name
(
self
):
"""
Check node name as set, after block job complete.
"""
device_id
=
self
.
vm
.
get_block
({
"file"
:
self
.
target_image
})
info
=
self
.
vm
.
monitor
.
info_block
().
get
(
device_id
)
if
"node_name"
in
self
.
params
:
node_name_exp
=
self
.
params
[
"node_name"
]
node_name
=
info
.
get
(
"node-name"
,
""
)
if
node_name
!=
node_name_exp
:
raise
error
.
TestFail
(
"node-name is: %s, while set value is: %s"
%
(
node_name
,
node_name_exp
))
@
error
.
context_aware
def
start
(
self
):
"""
...
...
@@ -77,10 +108,18 @@ class DriveMirror(block_copy.BlockCopy):
target_format
=
params
[
"image_format"
]
create_mode
=
params
[
"create_mode"
]
full_copy
=
params
[
"full_copy"
]
args
=
{
"mode"
:
create_mode
,
"speed"
:
default_speed
,
"format"
:
target_format
}
if
'granularity'
and
'buf_count'
in
params
:
granularity
=
int
(
params
[
"granularity"
])
buf_size
=
granularity
*
int
(
params
[
"buf_count"
])
args
.
update
({
"granularity"
:
granularity
,
"buf-size"
:
buf_size
})
if
'node_name'
in
params
:
args
.
update
({
"node-name"
:
params
.
get
(
"node_name"
)})
error
.
context
(
"Start to mirror block device"
,
logging
.
info
)
self
.
vm
.
block_mirror
(
device
,
target_image
,
default_speed
,
full_copy
,
target_format
,
create_mode
)
self
.
vm
.
block_mirror
(
device
,
target_image
,
full_copy
,
**
args
)
if
not
self
.
get_status
():
raise
error
.
TestFail
(
"No active mirroring job found"
)
if
params
.
get
(
"image_type"
)
!=
"iscsi"
:
...
...
qemu/tests/drive_mirror_cancel.py
浏览文件 @
5b19239f
...
...
@@ -24,7 +24,7 @@ def run_drive_mirror_cancel(test, params, env):
bg
=
utils
.
InterruptedThread
(
mirror_test
.
cancel
,)
bg
.
start
()
job
=
mirror_test
.
get_status
()
if
job
[
"type"
]
!=
"mirror"
:
if
job
.
get
(
"type"
,
"0"
)
!=
"mirror"
:
raise
error
.
TestFail
(
"Job cancel immediacatly"
)
error
.
context
(
"Cleanup rules in iptables"
,
logging
.
info
)
utils
.
run
(
params
[
"stop_firewall_cmd"
])
...
...
qemu/tests/drive_mirror_complete.py
浏览文件 @
5b19239f
...
...
@@ -31,9 +31,10 @@ def run(test, params, env):
source_image
=
mirror_test
.
get_image_file
()
target_image
=
mirror_test
.
get_target_image
()
mirror_test
.
start
()
mirror_test
.
wait_for
_steady
()
mirror_test
.
action_when
_steady
()
mirror_test
.
vm
.
pause
()
mirror_test
.
reopen
()
mirror_test
.
action_after_reopen
()
device_id
=
mirror_test
.
vm
.
get_block
({
"file"
:
target_image
})
if
device_id
!=
mirror_test
.
device
:
raise
error
.
TestError
(
"Mirrored image not being used by guest"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录