Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
c2a3cb42
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,发现更多精彩内容 >>
提交
c2a3cb42
编写于
11月 25, 2016
作者:
X
Xu Tian
提交者:
GitHub
11月 25, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #756 from xutian/fix_mem_pause
Update test case to make memory hotplug/unplug when VM is paused
上级
5f7b62be
84cf33b4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
52 addition
and
25 deletion
+52
-25
qemu/tests/cfg/hotplug_mem.cfg
qemu/tests/cfg/hotplug_mem.cfg
+5
-1
qemu/tests/hotplug_mem.py
qemu/tests/hotplug_mem.py
+45
-23
qemu/tests/stop_continue.py
qemu/tests/stop_continue.py
+2
-1
未找到文件。
qemu/tests/cfg/hotplug_mem.cfg
浏览文件 @
c2a3cb42
...
...
@@ -15,6 +15,7 @@
no RHEL.5 RHEL.6
no Windows..i386
no WinXP Win2000 Win2003 WinVista
sub_test_wait_time = 0
variants numa_nodes:
- one:
guest_numa_nodes = "node0"
...
...
@@ -112,6 +113,7 @@
reboot_method = system_reset
sleep_before_reset = 0
- guest_reboot:
sub_test_wait_time = 2
sub_type = boot
reboot_method = shell
kill_vm_on_error = yes
...
...
@@ -131,9 +133,11 @@
only after
- pause_vm:
sub_type = stop_continue
pause_time =
12
0
pause_time =
30
0
wait_resume_timeout = "${pause_time}"
sub_test_wait_time = 60
- stress:
sub_test_wait_time = 60
Windows:
timeout = 600
autostress = yes
...
...
qemu/tests/hotplug_mem.py
浏览文件 @
c2a3cb42
import
logging
from
virttest.utils_test
import
BackgroundTest
from
virttest.utils_test
import
run_virt_sub_test
from
virttest.utils_test.qemu
import
MemoryHotplugTest
...
...
@@ -18,6 +19,7 @@ except ImportError:
class
MemoryHotplugSimple
(
MemoryHotplugTest
):
def
run_sub_test
(
self
):
""" Run virt sub test before/after hotplug/unplug memory device"""
if
self
.
params
.
get
(
"sub_type"
):
step
=
(
"Run sub test '%s' %s %s memory device"
%
(
self
.
params
[
"sub_test"
],
...
...
@@ -28,13 +30,18 @@ class MemoryHotplugSimple(MemoryHotplugTest):
run_virt_sub_test
(
*
args
)
def
run_background_test
(
self
):
"""Run virt sub test in backgroup"""
wait_time
=
float
(
self
.
params
.
get
(
"sub_test_wait_time"
,
0
))
args
=
(
self
.
test
,
self
.
params
,
self
.
env
,
self
.
params
[
"sub_type"
])
bg_test
=
BackgroundTest
(
run_virt_sub_test
,
args
)
bg_test
.
start
()
wait_for
(
bg_test
.
is_alive
,
first
=
10
,
step
=
3
,
timeout
=
10
0
)
wait_for
(
bg_test
.
is_alive
,
first
=
wait_time
,
step
=
3
,
timeout
=
24
0
)
return
bg_test
def
restore_memory
(
self
,
pre_vm
,
post_vm
):
"""
Compare pre_vm and post_vm, restore VM memory devices.
"""
mem_devs_post
=
set
(
post_vm
.
params
.
objects
(
"mem_devs"
))
mem_devs_origin
=
set
(
pre_vm
.
params
.
objects
(
"mem_devs"
))
if
mem_devs_post
==
mem_devs_origin
:
...
...
@@ -56,35 +63,50 @@ class MemoryHotplugSimple(MemoryHotplugTest):
devices
=
filter
(
None
,
map
(
vm
.
devices
.
get_by_qid
,
dev_ids
))
return
[
_
[
0
]
for
_
in
devices
]
def
unplug_memory
(
self
,
vm
,
target_mem
):
"""Unplug the target memory, if the memory not exists,
hotplug it, then unplug it
"""
devs
=
self
.
get_mem_by_name
(
vm
,
target_mem
)
if
not
devs
and
self
.
params
.
get
(
"strict_check"
)
!=
"yes"
:
self
.
hotplug_memory
(
vm
,
target_mem
)
return
super
(
MemoryHotplugSimple
,
self
).
unplug_memory
(
vm
,
target_mem
)
def
start_test
(
self
):
operation
=
self
.
params
[
"operation"
]
target_mem
=
self
.
params
[
"target_mem"
]
stage
=
self
.
params
.
get
(
"stage"
,
"before"
)
sub_test_runner
=
(
stage
==
'during'
and
[
self
.
run_background_test
]
or
[
self
.
run_sub_test
])[
0
]
func
=
getattr
(
self
,
"%s_memory"
%
operation
)
if
not
callable
(
func
):
raise
exceptions
.
TestError
(
"Unsupported memory operation '%s'"
%
operation
)
vm
=
self
.
env
.
get_vm
(
self
.
params
[
"main_vm"
])
try
:
if
stage
!=
"after"
:
sub_test
=
sub_test_runner
()
func
(
vm
,
target_mem
)
self
.
check_memory
(
vm
)
else
:
func
(
vm
,
target_mem
)
self
.
check_memory
(
vm
)
sub_test
=
sub_test_runner
()
if
stage
==
"during"
:
sub_test
.
join
(
timeout
=
3600
)
vm
=
self
.
env
.
get_vm
(
self
.
params
[
"main_vm"
])
if
self
.
params
.
get
(
"stage"
)
==
"before"
:
self
.
run_sub_test
()
# If unplug memory not exits and test in instrcit then hotplug it
if
operation
==
"unplug"
:
devs
=
self
.
get_mem_by_name
(
vm
,
target_mem
)
if
not
devs
and
self
.
params
.
get
(
"strict"
)
!=
"yes"
:
self
.
hotplug_memory
(
vm
,
target_mem
)
func_name
=
"%s_memory"
%
operation
func
=
getattr
(
self
,
func_name
)
if
self
.
params
.
get
(
"stage"
)
==
"during"
:
sub_test
=
self
.
run_background_test
()
func
(
vm
,
target_mem
)
self
.
check_memory
(
vm
)
if
self
.
params
.
get
(
"stage"
)
==
"during"
:
test_timeout
=
float
(
self
.
params
.
get
(
"sub_test_timeout"
,
3600
))
sub_test
.
join
(
timeout
=
test_timeout
)
if
self
.
params
.
get
(
"stage"
)
==
"after"
:
self
.
run_sub_test
()
self
.
restore_memory
(
vm
,
self
.
env
.
get_vm
(
self
.
params
[
'main_vm'
]))
vm
.
reboot
()
finally
:
try
:
self
.
restore_memory
(
vm
,
self
.
env
.
get_vm
(
self
.
params
[
'main_vm'
]))
except
Exception
,
details
:
logging
.
warn
(
"Error happen when restore vm: %s"
%
details
)
self
.
close_sessions
()
vm
=
self
.
env
.
get_vm
(
self
.
params
[
"main_vm"
])
vm
.
verify_alive
()
vm
.
reboot
()
@
step_engine
.
context_aware
...
...
qemu/tests/stop_continue.py
浏览文件 @
c2a3cb42
import
time
import
logging
from
autotest.client.shared
import
error
...
...
@@ -63,7 +64,7 @@ def run(test, params, env):
logging
.
error
(
msg
)
raise
error
.
TestFail
(
msg
)
session
.
close
()
time
.
sleep
(
float
(
params
.
get
(
"pause_time"
,
0
)))
error
.
base_context
(
"Resume the VM"
,
logging
.
info
)
vm
.
resume
()
error
.
context
(
"Verify the status of VM is 'running'"
,
logging
.
info
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录