Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
8d594170
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,发现更多精彩内容 >>
提交
8d594170
编写于
1月 20, 2016
作者:
X
Xu Tian
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #489 from PandaWei/get_guest_service_status
Use API function to get service status in VM
上级
cbc98695
5ba53541
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
58 deletion
+5
-58
qemu/tests/migration_with_dst_problem.py
qemu/tests/migration_with_dst_problem.py
+2
-31
qemu/tests/sr_iov_irqbalance.py
qemu/tests/sr_iov_irqbalance.py
+3
-27
未找到文件。
qemu/tests/migration_with_dst_problem.py
浏览文件 @
8d594170
...
...
@@ -26,36 +26,6 @@ def process_output_check(process, exp_str):
return
re
.
search
(
exp_str
,
output
)
@
error
.
context_aware
def
get_guest_service_status
(
session
,
service
,
init_service
):
"""
Get service's status in guest. It will return 'active' for 'running' and
'active'. Return 'inactive' for 'stopped' and 'inactive'.
:param session: An Expect or ShellSession instance to operate on
:param service: Service name that we want to check status.
:param init_service: service name used in service command.
:return: service's status in guest. 'active' or 'inactive'
"""
try
:
session
.
cmd
(
"systemctl --version"
)
cmd
=
"systemctl status %s.service"
%
service
output
=
session
.
cmd_output
(
cmd
)
except
Exception
:
cmd
=
"service %s status"
%
init_service
output
=
session
.
cmd_output
(
cmd
)
service_status_filter
=
"running|active"
if
re
.
search
(
"running|active"
,
output
,
re
.
I
):
status
=
"active"
elif
re
.
search
(
"stopped|inactive"
,
output
,
re
.
I
):
status
=
"inactive"
else
:
msg
=
"Fail to get '%s' service status. "
%
service
msg
+=
" Command output in guest: %s"
%
output
raise
error
.
TestError
(
msg
)
return
status
@
error
.
context_aware
def
run
(
test
,
params
,
env
):
"""
...
...
@@ -121,7 +91,8 @@ def run(test, params, env):
:param action: action with service (start|stop|restart)
:param init_service: name of service for old service control.
"""
status
=
get_guest_service_status
(
session
,
service
,
init_service
)
status
=
utils_misc
.
get_guest_service_status
(
session
,
service
,
service_former
=
init_service
)
if
action
==
"start"
and
status
==
"active"
:
logging
.
debug
(
"%s already started, no need start it again."
,
service
)
...
...
qemu/tests/sr_iov_irqbalance.py
浏览文件 @
8d594170
...
...
@@ -7,6 +7,7 @@ from autotest.client.shared import utils
from
virttest
import
utils_test
from
virttest
import
utils_net
from
virttest
import
utils_misc
# The backports module will take care of using the builtin if available
from
virttest.staging.backports
import
bin
...
...
@@ -38,32 +39,6 @@ def get_first_network_devname(session, nic_interface_filter):
return
devnames
[
0
]
@
error
.
context_aware
def
get_guest_service_status
(
session
,
service
):
"""
Get service's status in guest. It will return 'active' for 'running' and
'active'. Return 'inactive' for 'stopped' and 'inactive'.
:param session: An Expect or ShellSession instance to operate on
:type devices: Expect or ShellSession class
:param service: Service name that we want to check status.
:type service: String
:return: service's status in guest. 'active' or 'inactive'
:rtype: String
"""
cmd
=
"service %s status"
%
service
output
=
session
.
cmd_output
(
cmd
)
if
re
.
search
(
"running|active"
,
output
,
re
.
I
):
status
=
"active"
elif
re
.
search
(
"stopped|inactive"
,
output
,
re
.
I
):
status
=
"inactive"
else
:
msg
=
"Fail to get '%s' service status. "
%
service
msg
+=
" Command output in guest: %s"
%
output
raise
error
.
TestError
(
msg
)
return
status
@
error
.
context_aware
def
get_irq_smp_affinity
(
session
,
irq
):
"""
...
...
@@ -237,7 +212,8 @@ def run(test, params, env):
msg
=
"Update irqbalance service status in guest if not match request."
error
.
context
(
msg
,
logging
.
info
)
irqbalance_status
=
params
.
get
(
"irqbalance_status"
,
"active"
)
status
=
get_guest_service_status
(
session
=
session
,
service
=
"irqbalance"
)
status
=
utils_misc
.
get_guest_service_status
(
session
=
session
,
service
=
"irqbalance"
)
service_cmd
=
""
if
status
==
"active"
and
irqbalance_status
==
"inactive"
:
service_cmd
=
"service irqbalance stop"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录