Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
38c9d58e
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,发现更多精彩内容 >>
提交
38c9d58e
编写于
7月 10, 2018
作者:
S
Sitong Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
timedrift: add case to check time offset after hotplugging vcpu
Signed-off-by:
N
Sitong Liu
<
siliu@redhat.com
>
上级
2934f8df
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
73 addition
and
0 deletion
+73
-0
qemu/tests/cfg/timedrift_check_clock_offset.cfg
qemu/tests/cfg/timedrift_check_clock_offset.cfg
+12
-0
qemu/tests/timedrift_check_when_hotplug_vcpu.py
qemu/tests/timedrift_check_when_hotplug_vcpu.py
+61
-0
未找到文件。
qemu/tests/cfg/timedrift_check_clock_offset.cfg
浏览文件 @
38c9d58e
...
@@ -37,3 +37,15 @@
...
@@ -37,3 +37,15 @@
ntp_cmd = "(systemctl stop chronyd || service ntpdate stop)"
ntp_cmd = "(systemctl stop chronyd || service ntpdate stop)"
ntp_cmd += " && chronyd -q 'server clock.redhat.com iburst'"
ntp_cmd += " && chronyd -q 'server clock.redhat.com iburst'"
ntp_query_cmd = "chronyd -Q 'server clock.redhat.com iburst'"
ntp_query_cmd = "chronyd -Q 'server clock.redhat.com iburst'"
- hotplug_vcpu:
type = timedrift_check_when_hotplug_vcpu
start_vm = yes
vcpu_sockets = 2
smp = 4
vcpus_maxcpus = 6
ntp_query_cmd = "chronyd -Q 'server clock.redhat.com iburst'"
clock_sync_command = "(systemctl stop chronyd || service ntpdate stop)"
clock_sync_command += " && chronyd -q 'server clock.redhat.com iburst'"
query_internal = 600
query_times = 4
drift_threshold = 3
qemu/tests/timedrift_check_when_hotplug_vcpu.py
0 → 100644
浏览文件 @
38c9d58e
import
re
import
time
import
logging
from
avocado.utils
import
process
from
virttest
import
error_context
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Check time offset after hotplug a vcpu.
1) sync host time with ntpserver
2) boot guest with '-rtc base=utc,clock=host,driftfix=slew'
3) stop auto sync service in guest (rhel7 only)
4) sync guest system time with ntpserver
5) hotplug a vcpu by qmp command
6) query guest time offset with ntpserver for several times
:param test: QEMU test object.
:param params: Dictionary with test parameters.
:param env: Dictionary with the test environment.
"""
clock_sync_command
=
params
[
"clock_sync_command"
]
error_context
.
context
(
"Sync host system time with ntpserver"
,
logging
.
info
)
process
.
system
(
clock_sync_command
,
shell
=
True
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
session
=
vm
.
wait_for_login
()
ntp_query_cmd
=
params
.
get
(
"ntp_query_cmd"
,
""
)
query_times
=
int
(
params
.
get
(
"query_times"
,
"4"
))
query_internal
=
float
(
params
.
get
(
"query_internal"
,
"600"
))
drift_threshold
=
float
(
params
.
get
(
"drift_threshold"
,
"3"
))
error_context
.
context
(
"Sync time from guest to ntpserver"
,
logging
.
info
)
session
.
cmd
(
clock_sync_command
)
error_context
.
context
(
"Hotplug a vcpu to guest"
,
logging
.
info
)
if
int
(
params
[
"smp"
])
<
int
(
params
[
"vcpus_maxcpus"
]):
vm
.
hotplug_vcpu
()
time
.
sleep
(
1
)
else
:
test
.
error
(
"Invalid operation, valid index range 0:%d, used range 0:%d"
%
(
int
(
params
[
"vcpus_maxcpus"
])
-
1
,
int
(
params
[
"smp"
])
-
1
))
error_context
.
context
(
"Check time offset via ntp server"
,
logging
.
info
)
for
query
in
range
(
query_times
):
output
=
session
.
cmd_output
(
ntp_query_cmd
)
try
:
offset
=
re
.
findall
(
r
"([+-]*\d+\.\d+) seconds"
,
output
,
re
.
M
)[
0
]
except
IndexError
:
test
.
error
(
"Failed to get time offset"
)
if
float
(
offset
)
>=
drift_threshold
:
test
.
fail
(
"Uacceptable offset '%s', "
%
offset
+
"threshold '%s'"
%
drift_threshold
)
time
.
sleep
(
query_internal
)
session
.
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录