Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
08ea8b53
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,发现更多精彩内容 >>
未验证
提交
08ea8b53
编写于
2月 27, 2018
作者:
X
Xu Han
提交者:
GitHub
2月 27, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1155 from lijinlijin/balloon_sc_interrogate
balloon_sc_interrogate:send INTERROGATE signal to balloon service
上级
eb9da2d9
de30c2f7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
132 addition
and
0 deletion
+132
-0
qemu/tests/balloon_check.py
qemu/tests/balloon_check.py
+59
-0
qemu/tests/balloon_sc_interrogate.py
qemu/tests/balloon_sc_interrogate.py
+69
-0
qemu/tests/cfg/balloon_service.cfg
qemu/tests/cfg/balloon_service.cfg
+4
-0
未找到文件。
qemu/tests/balloon_check.py
浏览文件 @
08ea8b53
...
...
@@ -359,6 +359,65 @@ class BallooningTestWin(BallooningTest):
else
:
self
.
test
.
fail
(
"Failed to get windows guest free memory"
)
def
get_disk_vol
(
self
,
session
):
"""
Get virtio-win disk volume letter for windows guest.
:param session: VM session.
"""
key
=
"VolumeName like 'virtio-win%'"
try
:
return
utils_misc
.
get_win_disk_vol
(
session
,
condition
=
key
)
except
Exception
:
self
.
test
.
error
(
"Could not get virtio-win disk vol!"
)
@
error_context
.
context_aware
def
operate_balloon_service
(
self
,
session
,
operation
):
"""
Run/check/stop/install/uninstall balloon service in windows guest
:param session: shell Object
:param operation: operation against balloon serive, e.g. run/status/
uninstall/stop
:return: cmd execution output
"""
error_context
.
context
(
"%s Balloon Service in guest."
%
operation
,
logging
.
info
)
drive_letter
=
self
.
get_disk_vol
(
session
)
try
:
operate_cmd
=
self
.
params
[
"%s_balloon_service"
%
operation
]
%
drive_letter
if
operation
==
"status"
:
output
=
session
.
cmd_output
(
operate_cmd
)
else
:
output
=
session
.
cmd
(
operate_cmd
)
except
Exception
as
err
:
self
.
test
.
error
(
"%s balloon service failed! Error msg is:
\n
%s"
%
(
operation
,
err
))
return
output
@
error_context
.
context_aware
def
configure_balloon_service
(
self
,
session
):
"""
Check balloon service and install it if it's not running.
:param session: shell Object
:param operation: operation against balloon serive, e.g. run/status/
uninstall/stop
"""
error_context
.
context
(
"Check Balloon Service status before install"
"service"
,
logging
.
info
)
output
=
self
.
operate_balloon_service
(
session
,
"status"
)
if
re
.
search
(
"running"
,
output
.
lower
(),
re
.
M
):
logging
.
info
(
"Balloon service is already running !"
)
elif
re
.
search
(
"stop"
,
output
.
lower
(),
re
.
M
):
logging
.
info
(
"Balloon service is stopped,start it now"
)
self
.
operate_balloon_service
(
session
,
"run"
)
else
:
logging
.
info
(
"Install Balloon Service in guest."
)
self
.
operate_balloon_service
(
session
,
"install"
)
class
BallooningTestLinux
(
BallooningTest
):
...
...
qemu/tests/balloon_sc_interrogate.py
0 → 100644
浏览文件 @
08ea8b53
import
re
import
logging
from
virttest
import
utils_test
from
virttest
import
error_context
from
qemu.tests.balloon_check
import
BallooningTestWin
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Balloon service should be in running status after sc interrogate it.
1) boot a guest with balloon device.
2) check balloon driver installation status.
3) enable and check driver verifier in guest.
4) install and start balloon service in guest.
5) send INTERROGATE signal to balloon service.
6) check balloon service status again.
"""
def
interrogate_balloon_service
(
session
):
"""
Sending INTERROGATE to balloon service.
:param session: VM session.
"""
logging
.
info
(
"Send INTERROGATE to balloon service"
)
sc_interrogate_cmd
=
params
[
"sc_interrogate_cmd"
]
status
,
output
=
session
.
cmd_status_output
(
sc_interrogate_cmd
)
if
status
:
test
.
error
(
output
)
error_context
.
context
(
"Boot guest with balloon device"
,
logging
.
info
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
session
=
vm
.
wait_for_login
()
driver_name
=
params
.
get
(
"driver_name"
,
"balloon"
)
utils_test
.
qemu
.
windrv_verify_running
(
session
,
test
,
driver_name
)
utils_test
.
qemu
.
setup_win_driver_verifier
(
driver_name
,
vm
)
balloon_test
=
BallooningTestWin
(
test
,
params
,
env
)
err
=
None
try
:
# Install and start balloon service in guest
balloon_test
.
configure_balloon_service
(
session
)
# Send INTERROGATE signal to balloon service
interrogate_balloon_service
(
session
)
# Check ballloon serivce status again
output
=
balloon_test
.
operate_balloon_service
(
session
,
"status"
)
if
not
re
.
search
(
"running"
,
output
.
lower
(),
re
.
M
):
test
.
fail
(
"Balloon service is not running after sc interrogate!"
"Output is:
\n
%s"
%
output
)
except
Exception
as
err
:
pass
finally
:
try
:
error_context
.
context
(
"Clear balloon service in guest"
,
logging
.
info
)
balloon_test
.
operate_balloon_service
(
session
,
"uninstall"
)
except
Exception
as
uninst_err
:
if
not
err
:
err
=
uninst_err
else
:
logging
.
error
(
uninst_err
)
session
.
close
()
if
err
:
raise
err
# pylint: disable=E0702
qemu/tests/cfg/balloon_service.cfg
浏览文件 @
08ea8b53
...
...
@@ -38,3 +38,7 @@
# since qmp cmd 'qom-get' output for the balloon device won't
# change for a long time
mem_check = no
- sc_interrogate:
type = balloon_sc_interrogate
only Windows
sc_interrogate_cmd = "sc interrogate balloonservice"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录