Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
448bc130
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,发现更多精彩内容 >>
提交
448bc130
编写于
12月 06, 2016
作者:
N
Nini Gu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
balloon_service: Add linux guest into the guest-stats-polling-interval test
上级
ddee8193
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
64 addition
and
40 deletion
+64
-40
qemu/tests/balloon_service.py
qemu/tests/balloon_service.py
+41
-26
qemu/tests/cfg/balloon_service.cfg
qemu/tests/cfg/balloon_service.cfg
+23
-14
未找到文件。
qemu/tests/balloon_service.py
浏览文件 @
448bc130
...
...
@@ -11,24 +11,27 @@ from avocado.core import exceptions
from
aexpect
import
ShellCmdError
from
virttest.utils_test.qemu
import
MemoryBaseTest
from
qemu.tests.balloon_check
import
BallooningTestWin
from
qemu.tests.balloon_check
import
BallooningTestLinux
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Balloon service test
for windows gu
est.
1) boot a
windows
guest with balloon device.
2) enable and check driver verifier in guest.
3) install balloon service in guest.
Balloon service test
, i.e. guest-stats-polling-interval t
est.
1) boot a guest with balloon device.
2) enable and check driver verifier in guest
(only for windows guest)
.
3) install balloon service in guest
(only for windows guest)
.
4) enable polling in qmp.
5) evict and enlarge balloon.
6) get polling value in qmp.
7) uninstall balloon service and clear driver verifier.
5) evict / enlarge balloon.
6) get polling value in qmp, then do memory check if necessary.
7) repeat steps 5) and 6) for multi times
8) uninstall balloon service and clear driver verifier(only for
windows guest).
"""
def
get_disk_vol
(
session
):
"""
Get virtio-win disk volume letter.
Get virtio-win disk volume letter
for windows guest
.
:param session: VM session.
"""
...
...
@@ -41,7 +44,7 @@ def run(test, params, env):
def
config_balloon_service
(
session
,
drive_letter
):
"""
Check / Install balloon service.
Check / Install balloon service
for windows guest
.
:param session: VM session.
:param drive_letter: virtio-win disk volume letter.
...
...
@@ -97,17 +100,21 @@ def run(test, params, env):
(
keyname
,
guest_mem
,
stat_memory_qmp
,
check_mem_ratio
))
def
balloon_memory
(
session
,
device_path
):
def
balloon_memory
(
vm
,
device_path
,
mem_check
):
"""
Doing memory balloon in a loop and check memory status during balloon.
:param
session: VM session
.
:param
vm: VM object
.
:param device_path: balloon polling path.
:param mem_check: need to do memory check if param mem_check is 'yes'
"""
repeat_times
=
int
(
params
.
get
(
"repeat_times"
,
5
))
logging
.
info
(
"repeat times: %d"
%
repeat_times
)
if
params
[
'os_type'
]
==
'windows'
:
balloon_test
=
BallooningTestWin
(
test
,
params
,
env
)
balloon_test
=
BallooningTestWin
(
test
,
params
,
env
)
else
:
balloon_test
=
BallooningTestLinux
(
test
,
params
,
env
)
min_sz
,
max_sz
=
balloon_test
.
get_memory_boundary
()
while
repeat_times
:
for
tag
in
params
.
objects
(
'test_tags'
):
...
...
@@ -115,9 +122,11 @@ def run(test, params, env):
params_tag
=
params
.
object_params
(
tag
)
balloon_type
=
params_tag
[
'balloon_type'
]
if
balloon_type
==
'evict'
:
expect_mem
=
int
(
random
.
uniform
(
min_sz
,
balloon_test
.
get_ballooned_memory
()))
expect_mem
=
int
(
random
.
uniform
(
min_sz
,
balloon_test
.
get_ballooned_memory
()))
else
:
expect_mem
=
int
(
random
.
uniform
(
balloon_test
.
get_ballooned_memory
(),
max_sz
))
expect_mem
=
int
(
random
.
uniform
(
balloon_test
.
get_ballooned_memory
(),
max_sz
))
quit_after_test
=
balloon_test
.
run_ballooning_test
(
expect_mem
,
tag
)
...
...
@@ -125,6 +134,7 @@ def run(test, params, env):
get_polling_output
=
vm
.
monitor
.
qom_get
(
device_path
,
get_balloon_property
)
time
.
sleep
(
20
)
if
mem_check
==
"yes"
:
memory_check
(
vm
,
get_polling_output
,
'stat-free-memory'
)
if
quit_after_test
:
return
...
...
@@ -132,7 +142,7 @@ def run(test, params, env):
repeat_times
-=
1
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
))
driver_name
=
params
.
get
(
"driver_name"
,
"balloon
"
)
mem_check
=
params
.
get
(
"mem_check"
,
"yes
"
)
error_context
.
context
(
"Boot guest with balloon device"
,
logging
.
info
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
...
...
@@ -148,10 +158,13 @@ def run(test, params, env):
polling_interval
=
int
(
params
.
get
(
"polling_interval"
,
2
))
try
:
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
if
params
[
'os_type'
]
==
'windows'
:
driver_name
=
params
.
get
(
"driver_name"
,
"balloon"
)
utils_test
.
qemu
.
setup_win_driver_verifier
(
driver_name
,
vm
,
timeout
)
error_context
.
context
(
"Config balloon service in guest"
,
logging
.
info
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
error_context
.
context
(
"Config balloon service in guest"
,
logging
.
info
)
drive_letter
=
get_disk_vol
(
session
)
config_balloon_service
(
session
,
drive_letter
)
...
...
@@ -163,10 +176,12 @@ def run(test, params, env):
memory_check
(
vm
,
get_polling_output
,
'stat-total-memory'
)
error_context
.
context
(
"Balloon vm memory in loop"
,
logging
.
info
)
balloon_memory
(
session
,
device_path
)
balloon_memory
(
vm
,
device_path
,
mem_check
)
finally
:
error_context
.
context
(
"Clear balloon service in guest"
,
logging
.
info
)
if
params
[
'os_type'
]
==
'windows'
:
error_context
.
context
(
"Clear balloon service in guest"
,
logging
.
info
)
uninstall_cmd
=
params
[
"uninstall_balloon_service"
]
%
drive_letter
session
.
cmd
(
uninstall_cmd
,
ignore_all_errors
=
True
)
session
.
close
()
qemu/tests/cfg/balloon_service.cfg
浏览文件 @
448bc130
- balloon_service: install setup image_copy unattended_install.cdrom
virt_test_type = qemu
type = balloon_service
only Windows
no Win2000, Fedora.8, Fedora.9, Fedora.10, RHEL.3, RHEL.4, Unix, livecd
no Host_RHEL.m5, Host_RHEL.m6
monitor_type = "qmp"
monitors = qmp1
balloon = balloon0
balloon_dev_devid = balloon0
balloon_dev_add_bus = yes
Windows:
driver_name = "balloon"
cdroms = "cd1 winutils virtio"
drive_index_virtio = 3
cdrom_virtio = isos/windows/virtio-win-1.8.0-4.iso
# Please change following cdrom_virtio to the right version
# if necessary
cdrom_virtio = isos/windows/virtio-win-***.iso
# balloon service related cmd, which will be covered by different
# guest's paths in guest-os cfg.
install_balloon_service = "%s:\Balloon\GUEST_OS\amd64\blnsvr.exe -i"
...
...
@@ -22,11 +24,18 @@
base_path = "/machine/peripheral/"
set_balloon_property = "guest-stats-polling-interval"
get_balloon_property = "guest-stats"
polling_interval = 2
polling_sleep_time = 10
free_mem_cmd = wmic os get FreePhysicalMemory
polling_sleep_time = 20
ratio = 0.1
run_sub_test_after_balloon = no
test_tags = "evict enlarge"
balloon_type_evict = evict
balloon_type_enlarge = enlarge
variants:
- small_polling_interval:
polling_interval = 2
- large_polling_interval:
polling_interval = 21474836
# No need to check the memory if set a large polling interval
# since qmp cmd 'qom-get' output for the balloon device won't
# change for a long time
mem_check = no
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录