Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
c6332196
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,发现更多精彩内容 >>
提交
c6332196
编写于
11月 09, 2017
作者:
Y
Yumei Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
balloon_check: Fix bug when utils_misc.wait_for() timeout
Signed-off-by:
N
Yumei Huang
<
yuhuang@redhat.com
>
上级
37077ac7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
20 deletion
+25
-20
qemu/tests/balloon_check.py
qemu/tests/balloon_check.py
+25
-20
未找到文件。
qemu/tests/balloon_check.py
浏览文件 @
c6332196
...
...
@@ -2,10 +2,13 @@ import time
import
re
import
logging
import
random
from
autotest.client.shared
import
error
from
avocado.core
import
exceptions
from
virttest
import
qemu_monitor
from
virttest
import
utils_test
from
virttest
import
utils_misc
from
virttest
import
error_context
from
virttest.utils_test.qemu
import
MemoryBaseTest
...
...
@@ -49,7 +52,7 @@ class BallooningTest(MemoryBaseTest):
return
0
return
ballooned_mem
@
error
.
context_aware
@
error
_context
.
context_aware
def
memory_check
(
self
,
step
,
ballooned_mem
):
"""
Check memory status according expect values
...
...
@@ -61,7 +64,7 @@ class BallooningTest(MemoryBaseTest):
:return: memory size get from monitor and guest
:rtype: tuple
"""
error
.
context
(
"Check memory status %s"
%
step
,
logging
.
info
)
error
_context
.
context
(
"Check memory status %s"
%
step
,
logging
.
info
)
mmem
=
self
.
get_ballooned_memory
()
gmem
=
self
.
get_memory_status
()
# for windows illegal test:set windows guest balloon in (1,100),free memory will less than 50M
...
...
@@ -70,7 +73,7 @@ class BallooningTest(MemoryBaseTest):
session
=
self
.
vm
.
wait_for_login
(
timeout
=
timeout
)
try
:
if
self
.
get_win_mon_free_mem
(
session
)
>
50
:
error
.
TestF
ail
(
"Balloon_min test failed %s"
%
step
)
self
.
test
.
f
ail
(
"Balloon_min test failed %s"
%
step
)
finally
:
session
.
close
()
else
:
...
...
@@ -78,10 +81,10 @@ class BallooningTest(MemoryBaseTest):
if
(
abs
(
mmem
-
self
.
ori_mem
)
!=
ballooned_mem
or
(
abs
(
guest_ballooned_mem
-
ballooned_mem
)
>
100
)):
self
.
error_report
(
step
,
self
.
ori_mem
-
ballooned_mem
,
mmem
,
gmem
)
raise
e
rror
.
TestFail
(
"Balloon test failed %s"
%
step
)
raise
e
xceptions
.
TestFail
(
"Balloon test failed %s"
%
step
)
return
(
mmem
,
gmem
)
@
error
.
context_aware
@
error
_context
.
context_aware
def
balloon_memory
(
self
,
new_mem
):
"""
Baloon memory to new_mem and verifies on both qemu monitor and
...
...
@@ -91,13 +94,14 @@ class BallooningTest(MemoryBaseTest):
:type new_mem: int
"""
self
.
env
[
"balloon_test"
]
=
0
error
.
context
(
"Change VM memory to %s"
%
new_mem
,
logging
.
info
)
error
_context
.
context
(
"Change VM memory to %s"
%
new_mem
,
logging
.
info
)
try
:
self
.
vm
.
balloon
(
new_mem
)
self
.
env
[
"balloon_test"
]
=
1
except
Exception
,
e
:
if
self
.
params
.
get
(
'illegal_value_check'
,
'no'
)
==
'no'
and
new_mem
!=
self
.
get_ballooned_memory
():
raise
error
.
TestFail
(
"Balloon memory fail with error message: %s"
%
e
)
raise
exceptions
.
TestFail
(
"Balloon memory fail with error"
" message: %s"
%
e
)
if
new_mem
>
self
.
ori_mem
:
compare_mem
=
self
.
ori_mem
elif
new_mem
==
0
:
...
...
@@ -113,8 +117,8 @@ class BallooningTest(MemoryBaseTest):
self
.
get_ballooned_memory
()),
balloon_timeout
)
if
status
is
None
:
raise
e
rror
.
TestFail
(
"Failed to balloon memory to expect"
" value during %ss"
%
balloon_timeout
)
raise
e
xceptions
.
TestFail
(
"Failed to balloon memory to expect"
" value during %ss"
%
balloon_timeout
)
def
run_balloon_sub_test
(
self
,
test
,
params
,
env
,
test_tag
):
"""
...
...
@@ -199,7 +203,7 @@ class BallooningTest(MemoryBaseTest):
min_size
=
max
(
used_size
,
min_size
)
return
min_size
,
max_size
@
error
.
context_aware
@
error
_context
.
context_aware
def
run_ballooning_test
(
self
,
expect_mem
,
tag
):
"""
Run a loop of ballooning test
...
...
@@ -214,7 +218,7 @@ class BallooningTest(MemoryBaseTest):
def
_memory_check_after_sub_test
():
try
:
output
=
self
.
memory_check
(
"after subtest"
,
ballooned_mem
)
except
e
rror
.
TestFail
:
except
e
xceptions
.
TestFail
:
return
None
return
output
...
...
@@ -246,11 +250,12 @@ class BallooningTest(MemoryBaseTest):
ballooned_mem
=
abs
(
self
.
ori_mem
-
expect_mem
)
msg
=
"Wait memory balloon back after "
msg
+=
params_tag
[
'sub_test_after_balloon'
]
mmem
,
gmem
=
utils_misc
.
wait_for
(
_memory_check_after_sub_test
,
timeout
,
sleep_before_check
,
5
,
msg
)
self
.
current_mmem
=
mmem
self
.
current_gmem
=
gmem
ret
=
utils_misc
.
wait_for
(
_memory_check_after_sub_test
,
timeout
,
sleep_before_check
,
5
,
msg
)
if
not
ret
:
self
.
test
.
fail
(
"After sub test, memory check failed"
)
self
.
current_mmem
=
ret
[
0
]
self
.
current_gmem
=
ret
[
1
]
return
False
def
reset_memory
(
self
):
...
...
@@ -348,7 +353,7 @@ class BallooningTestWin(BallooningTest):
free
=
float
(
utils_misc
.
normalize_data_size
(
free
,
order_magnitude
=
"M"
))
return
int
(
free
)
else
:
error
.
TestF
ail
(
"Failed to get windows guest free memory"
)
self
.
test
.
f
ail
(
"Failed to get windows guest free memory"
)
class
BallooningTestLinux
(
BallooningTest
):
...
...
@@ -383,7 +388,7 @@ class BallooningTestLinux(BallooningTest):
return
int
(
self
.
get_total_mem
())
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Check Memory ballooning, use M when compare memory in this script:
...
...
@@ -402,7 +407,7 @@ def run(test, params, env):
balloon_test
=
BallooningTestLinux
(
test
,
params
,
env
)
for
tag
in
params
.
objects
(
'test_tags'
):
error
.
context
(
"Running %s test"
%
tag
,
logging
.
info
)
error
_context
.
context
(
"Running %s test"
%
tag
,
logging
.
info
)
params_tag
=
params
.
object_params
(
tag
)
if
params_tag
.
get
(
'expect_memory'
):
expect_mem
=
int
(
params_tag
.
get
(
'expect_memory'
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录