Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
eb8c05fd
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,发现更多精彩内容 >>
未验证
提交
eb8c05fd
编写于
12月 27, 2017
作者:
X
Xu Han
提交者:
GitHub
12月 27, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #969 from vivianQizhu/live_snapshot
live_snapshot_integrity: Add integrity check test case for live snapshot.
上级
2f17a211
ce8606ff
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
122 addition
and
42 deletion
+122
-42
qemu/tests/block_copy.py
qemu/tests/block_copy.py
+19
-4
qemu/tests/cfg/live_backup.cfg
qemu/tests/cfg/live_backup.cfg
+7
-2
qemu/tests/cfg/live_snapshot.cfg
qemu/tests/cfg/live_snapshot.cfg
+44
-21
qemu/tests/live_backup_base.py
qemu/tests/live_backup_base.py
+1
-7
qemu/tests/live_snapshot_basic.py
qemu/tests/live_snapshot_basic.py
+3
-1
qemu/tests/live_snapshot_integrity.py
qemu/tests/live_snapshot_integrity.py
+39
-0
qemu/tests/live_snapshot_stress.py
qemu/tests/live_snapshot_stress.py
+9
-7
未找到文件。
qemu/tests/block_copy.py
浏览文件 @
eb8c05fd
...
...
@@ -425,11 +425,15 @@ class BlockCopy(object):
"""
params
=
self
.
params
session
=
self
.
get_session
()
file_create_cmd
=
params
.
get
(
"create_c
m
d"
,
"touch FILE"
)
file_create_cmd
=
params
.
get
(
"create_c
omman
d"
,
"touch FILE"
)
test_exists_cmd
=
params
.
get
(
"test_exists_cmd"
,
"test -f FILE"
)
if
session
.
cmd_status
(
test_exists_cmd
.
replace
(
"FILE"
,
file_name
)):
session
.
cmd
(
file_create_cmd
.
replace
(
"FILE"
,
file_name
))
session
.
cmd
(
"md5sum %s > %s.md5"
%
(
file_name
,
file_name
))
session
.
cmd
(
file_create_cmd
.
replace
(
"FILE"
,
file_name
),
timeout
=
200
)
session
.
cmd
(
"md5sum %s > %s.md5"
%
(
file_name
,
file_name
),
timeout
=
200
)
sync_cmd
=
params
.
get
(
"sync_cmd"
,
"sync"
)
sync_cmd
=
utils_misc
.
set_winutils_letter
(
session
,
sync_cmd
)
session
.
cmd
(
sync_cmd
)
session
.
close
()
def
verify_md5
(
self
,
file_name
):
"""
...
...
@@ -437,7 +441,18 @@ class BlockCopy(object):
:param file_name: the file need to be verified.
"""
session
=
self
.
get_session
()
status
,
output
=
session
.
cmd_status_output
(
"md5sum -c %s.md5"
%
file_name
)
status
,
output
=
session
.
cmd_status_output
(
"md5sum -c %s.md5"
%
file_name
,
timeout
=
200
)
if
status
!=
0
:
raise
error
.
TestFail
(
"File %s changed, md5sum check output: %s"
%
(
file_name
,
output
))
def
reopen
(
self
,
reopen_image
):
"""
Closing the vm and reboot it with the backup image.
:param reopen_image: the image that vm reopen with.
"""
self
.
vm
.
destroy
()
self
.
params
[
"image_name_%s"
%
self
.
tag
]
=
reopen_image
self
.
vm
.
create
(
params
=
self
.
params
)
self
.
vm
.
verify_alive
()
qemu/tests/cfg/live_backup.cfg
浏览文件 @
eb8c05fd
...
...
@@ -23,13 +23,18 @@
before_full_backup = "create_files reboot stop"
after_incremental += " verify_md5s verify_efficiency"
Linux:
create_c
m
d = "dd if=/dev/urandom of=FILE bs=128k count=100"
create_c
omman
d = "dd if=/dev/urandom of=FILE bs=128k count=100"
file_names = "/home/test.img"
test_exists_cmd = "test -f FILE"
sync_cmd = "sync && echo 3 > /proc/sys/vm/drop_caches"
Windows:
create_c
m
d = "D:\coreutils\DummyCMD.exe FILE 1073741824 1"
create_c
omman
d = "D:\coreutils\DummyCMD.exe FILE 1073741824 1"
file_names = "C:\live_backup_test"
test_exists_cmd = "dir FILE"
x86_64:
sync_cmd = "WIN_UTILS:\Sync\sync64.exe /accepteula"
i386, i686:
sync_cmd = "WIN_UTILS:\Sync\sync.exe /accepteula"
- granularity:
transaction = no
check_params = "granularity"
...
...
qemu/tests/cfg/live_snapshot.cfg
浏览文件 @
eb8c05fd
...
...
@@ -60,31 +60,30 @@
copy_file_timeout = 600
- with_payload:
type = live_snapshot_stress
Windows:
timeout = 600
autostress = yes
stress_test = win_heavyload
config_cmd = 'setx -m path "%PATH%;${install_path};"'
install_cmd = "start /wait DRIVE:\HeavyLoadSetup.exe /verysilent"
check_cmd = 'tasklist | findstr /I "heavyload.exe"'
stop_cmd = "taskkill /T /F /IM heavyload.exe"
x86_64:
install_path = "C:\Program Files (x86)\JAM Software\HeavyLoad"
i386, i686:
install_path = "C:\Program Files\JAM Software\HeavyLoad"
Linux:
stress_test = autotest_control
test_control_file = stress.control
# Use a low stress to make sure guest can response during stress
control_args = "--cpu 4 --io 4 --vm 2 --vm-bytes 256M"
test_timeout = 1800
check_cmd = 'pgrep stress'
stop_cmd = "killall -g stress"
variants:
- with_stress:
backup_image_before_testing = yes
restore_image_after_testing = yes
Windows:
timeout = 600
autostress = yes
stress_test = win_heavyload
install_path = "C:\Program Files (x86)\JAM Software\HeavyLoad"
config_cmd = 'setx -m path "%PATH%;${install_path};"'
install_cmd = "start /wait DRIVE:\HeavyLoadSetup.exe /verysilent"
check_cmd = 'tasklist | findstr /I "heavyload.exe"'
stop_cmd = "taskkill /T /F /IM heavyload.exe"
x86_64:
install_path = "C:\Program Files (x86)\JAM Software\HeavyLoad"
i386, i686:
install_path = "C:\Program Files\JAM Software\HeavyLoad"
Linux:
stress_test = autotest_control
test_control_file = stress.control
# Use a low stress to make sure guest can response during stress
control_args = "--cpu 4 --io 4 --vm 2 --vm-bytes 256M"
test_timeout = 1800
check_cmd = 'pgrep stress'
stop_cmd = "killall -g stress"
before_start = "load_stress"
after_finished = "unload_stress reboot verify_alive"
- with_stop_cont:
...
...
@@ -95,6 +94,30 @@
reboot_method = "system_reset"
when_start = "reboot"
after_finished = "verify_alive"
- data_integrity:
type = live_snapshot_integrity
#To make the integrity test innocent, use "writethrough" for cache
drive_cache = writethrough
before_start = "load_stress"
after_finished = "unload_stress"
backup_image_before_testing = yes
restore_image_after_testing = yes
Windows:
create_command = "D:\coreutils\DummyCMD.exe FILE 1073741824 1"
file_names = "C:\live_snapshot_base C:\live_snapshot_sn1"
test_exists_cmd = "dir FILE"
autostress = no
start_cmd = '"${install_path}\heavyload.exe" \CPU 1 \MEMORY 1024'
x86_64:
sync_cmd = "WIN_UTILS:\Sync\sync64.exe /accepteula"
i386, i686:
sync_cmd = "WIN_UTILS:\Sync\sync.exe /accepteula"
Linux:
create_command = "dd if=/dev/urandom of=FILE bs=128k count=100"
file_names = "/home/live_snapshot_base /home/live_snapshot_sn1"
test_exists_cmd = "test -f FILE"
control_args = "--cpu 1 --vm 1 --vm-bytes 16M"
sync_cmd = "sync"
- transaction:
type = live_snapshot_transaction
images += " sn1 sn2"
...
...
qemu/tests/live_backup_base.py
浏览文件 @
eb8c05fd
...
...
@@ -159,16 +159,10 @@ class LiveBackup(block_copy.BlockCopy):
"""
Closing the vm and reboot it with the backup image.
"""
vm
=
self
.
vm
vm
.
destroy
()
image_chain
=
self
.
image_chain
image_name
=
self
.
params
.
get
(
"image_name_%s"
%
image_chain
[
-
1
])
self
.
params
[
"image_name_%s"
%
self
.
source_image
]
=
image_name
vm
.
create
(
params
=
self
.
params
)
self
.
vm
=
vm
session
=
self
.
get_session
()
self
.
vm
.
verify_alive
()
super
(
LiveBackup
,
self
).
reopen
(
image_name
)
def
before_full_backup
(
self
):
"""
...
...
qemu/tests/live_snapshot_basic.py
浏览文件 @
eb8c05fd
...
...
@@ -51,7 +51,8 @@ class LiveSnapshot(block_copy.BlockCopy):
"""
Get path of snapshot file.
"""
snapshot_file
=
"images/%s"
%
self
.
snapshot_file
image_format
=
self
.
params
[
"image_format"
]
snapshot_file
=
"images/%s.%s"
%
(
self
.
snapshot_file
,
image_format
)
return
utils_misc
.
get_path
(
data_dir
.
get_data_dir
(),
snapshot_file
)
def
create_snapshot
(
self
):
...
...
@@ -63,6 +64,7 @@ class LiveSnapshot(block_copy.BlockCopy):
self
.
snapshot_file
=
self
.
create_image
()
else
:
self
.
snapshot_file
=
self
.
get_snapshot_file
()
self
.
trash_files
.
append
(
self
.
snapshot_file
)
logging
.
info
(
"Creating snapshot"
)
self
.
vm
.
monitor
.
live_snapshot
(
self
.
device
,
self
.
snapshot_file
,
**
self
.
snapshot_args
)
...
...
qemu/tests/live_snapshot_integrity.py
0 → 100644
浏览文件 @
eb8c05fd
from
virttest
import
error_context
from
qemu.tests
import
live_snapshot_stress
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
live_snapshot_integrity test:
1). Boot up guest with cache=writethrough.
2). Load stress in guest.
3). dd file_base inside guest, record md5.
4). do snapshot;
5). dd file_sn1 inside guest, record md5.
6). Unload stress, reboot guest with snapshot.
7). Check file_base and file_sn1 md5.
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
tag
=
params
.
get
(
"source_image"
,
"image1"
)
stress_test
=
live_snapshot_stress
.
LiveSnapshotStress
(
test
,
params
,
env
,
tag
)
try
:
stress_test
.
action_before_start
()
file_names
=
params
[
"file_names"
].
split
()
file_name_base
=
file_names
[
0
]
file_name_sn1
=
file_names
[
1
]
stress_test
.
create_file
(
file_name_base
)
stress_test
.
create_snapshot
()
stress_test
.
create_file
(
file_name_sn1
)
stress_test
.
action_after_finished
()
format_postfix
=
".%s"
%
params
[
"image_format"
]
snapshot
=
stress_test
.
snapshot_file
.
replace
(
format_postfix
,
''
)
stress_test
.
reopen
(
snapshot
)
map
(
stress_test
.
verify_md5
,
file_names
)
finally
:
stress_test
.
clean
()
qemu/tests/live_snapshot_stress.py
浏览文件 @
eb8c05fd
...
...
@@ -2,7 +2,8 @@ import logging
from
virttest
import
utils_misc
from
virttest
import
utils_test
from
autotest.client.shared
import
error
from
virttest
import
error_context
from
qemu.tests
import
live_snapshot_basic
...
...
@@ -11,20 +12,21 @@ class LiveSnapshotStress(live_snapshot_basic.LiveSnapshot):
def
__init__
(
self
,
test
,
params
,
env
,
tag
):
super
(
LiveSnapshotStress
,
self
).
__init__
(
test
,
params
,
env
,
tag
)
@
error
.
context_aware
@
error
_context
.
context_aware
def
load_stress
(
self
):
"""
load IO/CPU/Memory stress in guest;
"""
error
.
context
(
"launch stress app in guest"
,
logging
.
info
)
error
_context
.
context
(
"launch stress app in guest"
,
logging
.
info
)
args
=
(
self
.
test
,
self
.
params
,
self
.
env
,
self
.
params
[
"stress_test"
])
bg_test
=
utils_test
.
BackgroundTest
(
utils_test
.
run_virt_sub_test
,
args
)
bg_test
.
start
()
if
not
utils_misc
.
wait_for
(
bg_test
.
is_alive
,
first
=
10
,
step
=
3
,
timeout
=
100
):
raise
error
.
TestF
ail
(
"background test start failed"
)
self
.
test
.
f
ail
(
"background test start failed"
)
if
not
utils_misc
.
wait_for
(
self
.
stress_app_running
,
timeout
=
360
,
step
=
5
):
raise
error
.
TestF
ail
(
"stress app isn't running"
)
self
.
test
.
f
ail
(
"stress app isn't running"
)
@
error_context
.
context_aware
def
unload_stress
(
self
):
"""
stop stress app
...
...
@@ -35,7 +37,7 @@ class LiveSnapshotStress(live_snapshot_basic.LiveSnapshot):
session
.
sendline
(
cmd
)
return
not
self
.
stress_app_running
()
error
.
context
(
"stop stress app in guest"
,
logging
.
info
)
error
_context
.
context
(
"stop stress app in guest"
,
logging
.
info
)
utils_misc
.
wait_for
(
_unload_stress
,
first
=
2.0
,
text
=
"wait stress app quit"
,
step
=
1.0
,
timeout
=
120
)
...
...
@@ -49,7 +51,7 @@ class LiveSnapshotStress(live_snapshot_basic.LiveSnapshot):
return
status
==
0
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
live_snapshot_stress test:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录