Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
15377b3d
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,发现更多精彩内容 >>
未验证
提交
15377b3d
编写于
1月 17, 2020
作者:
L
Longxiang Lyu
提交者:
GitHub
1月 17, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2013 from xiagao/bz1776118-bl
qemu_guest_agent: verify the blacklist of guest agent
上级
dd171464
247014d4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
65 addition
and
1 deletion
+65
-1
qemu/tests/cfg/qemu_guest_agent.cfg
qemu/tests/cfg/qemu_guest_agent.cfg
+4
-0
qemu/tests/qemu_guest_agent.py
qemu/tests/qemu_guest_agent.py
+61
-1
未找到文件。
qemu/tests/cfg/qemu_guest_agent.cfg
浏览文件 @
15377b3d
...
...
@@ -257,6 +257,10 @@
image_name_stg0 = images/storage0
image_size_stg0 = 1G
force_create_image_stg0 = yes
- gagent_check_blacklist:
only Linux
gagent_check_type = blacklist
black_list_change_cmd = "sed -i 's/BLACKLIST_RPC=.*/BLACKLIST_RPC=guest-info/g' /etc/sysconfig/qemu-ga"
- gagent_check_log:
only isa_serial
gagent_check_type = log
...
...
qemu/tests/qemu_guest_agent.py
浏览文件 @
15377b3d
...
...
@@ -215,7 +215,6 @@ class QemuGuestAgentTest(BaseVirtTest):
if
not
self
.
gagent
:
self
.
test
.
error
(
"Could not find guest agent object "
"for VM '%s'"
%
vm
.
name
)
self
.
gagent
.
verify_responsive
()
logging
.
info
(
self
.
gagent
.
cmd
(
"guest-info"
))
...
...
@@ -2393,6 +2392,67 @@ class QemuGuestAgentBasicCheck(QemuGuestAgentTest):
error_context
.
context
(
"Verify if guest agent works."
,
logging
.
info
)
self
.
gagent_verify
(
self
.
params
,
self
.
vm
)
@
error_context
.
context_aware
def
gagent_check_blacklist
(
self
,
test
,
params
,
env
):
"""
Verify the blacklist of config file, linux guest only
:param test: kvm test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def
bl_check
(
qga_cmd
):
"""
check if qga cmd is disabled.
"""
try
:
if
qga_cmd
==
"guest-file-open"
:
self
.
gagent
.
guest_file_open
(
guest_file
,
mode
=
"a+"
)
else
:
self
.
gagent
.
cmd
(
qga_cmd
)
except
guest_agent
.
VAgentCmdError
as
detail
:
if
re
.
search
(
"%s has been disabled"
%
qga_cmd
,
str
(
detail
)):
logging
.
info
(
"%s cmd is disabled."
%
qga_cmd
)
else
:
test
.
fail
(
"%s cmd failed with:"
"('%s')"
%
(
qga_cmd
,
str
(
detail
)))
else
:
test
.
fail
(
"%s cmd is not in blacklist,"
" pls have a check."
%
qga_cmd
)
session
=
self
.
_get_session
(
params
,
None
)
self
.
_open_session_list
.
append
(
session
)
error_context
.
context
(
"Try to execute guest-file-open command which"
" is in blacklist by default."
,
logging
.
info
)
randstr
=
utils_misc
.
generate_random_string
(
5
)
guest_file
=
"/tmp/qgatest"
+
randstr
bl_check
(
"guest-file-open"
)
error_context
.
context
(
"Try to execute guest-info command which is"
" not in blacklist."
,
logging
.
info
)
self
.
gagent
.
cmd
(
"guest-info"
)
error_context
.
context
(
"Change command in blacklist and restart"
" agent service."
,
logging
.
info
)
session
.
cmd
(
"cp /etc/sysconfig/qemu-ga /etc/sysconfig/qemu-ga-bk"
)
try
:
session
.
cmd
(
params
[
"black_list_change_cmd"
])
session
.
cmd
(
params
[
"gagent_restart_cmd"
])
error_context
.
context
(
"Try to execute guest-file-open and "
"guest-info commands again."
,
logging
.
info
)
ret_handle
=
int
(
self
.
gagent
.
guest_file_open
(
guest_file
,
mode
=
"a+"
))
self
.
gagent
.
guest_file_close
(
ret_handle
)
bl_check
(
"guest-info"
)
finally
:
session
.
cmd
(
"rm -rf %s"
%
guest_file
)
cmd
=
"mv -f /etc/sysconfig/qemu-ga-bk /etc/sysconfig/qemu-ga"
session
.
cmd
(
cmd
)
def
run_once
(
self
,
test
,
params
,
env
):
QemuGuestAgentTest
.
run_once
(
self
,
test
,
params
,
env
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录