Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
5719988d
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,发现更多精彩内容 >>
提交
5719988d
编写于
3月 08, 2017
作者:
B
Balamuruhan S
提交者:
GitHub
3月 08, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #788 from nasastry/cpu_device
Add vCPU device based hotplug/unplug test cases
上级
f38cd747
285c9b2b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
182 addition
and
0 deletion
+182
-0
qemu/tests/cfg/cpu_device_hotplug.cfg
qemu/tests/cfg/cpu_device_hotplug.cfg
+81
-0
qemu/tests/cpu_device_hotplug.py
qemu/tests/cpu_device_hotplug.py
+101
-0
未找到文件。
qemu/tests/cfg/cpu_device_hotplug.cfg
0 → 100644
浏览文件 @
5719988d
- cpu_device_hotplug_test: install setup image_copy unattended_install.cdrom
mem = 4096
virt_test_type = qemu
type = cpu_device_hotplug
cpu_hotplug_timeout = 2000
n_cpus_add = 1
kill_vm = yes
iterations = 5
onoff_iterations = 100
login_timeout = 240
only ppc64le
kill_vm = yes
smp = 8
vcpu_maxcpus = 240
auto_cpu_model = "no"
cpu_hotplug_cmd = 'device_add CPU_MODEL-spapr-cpu-core,id=core{0},core-id={0}'
cpu_hotunplug_cmd = 'device_del core{0}'
variants:
- add_one_cpu:
- add_32_cpu:
n_cpus_add = 32
- add_64_cpu:
n_cpus_add = 64
- add_96_cpu:
n_cpus_add = 96
- add_128_cpu:
n_cpus_add = 128
- add_160_cpu:
n_cpus_add = 160
- add_192_cpu:
n_cpus_add = 192
- add_224_cpu:
n_cpus_add = 224
- add_max_cpu:
n_cpus_add = 240
- nonexist_vcpu:
type = nonexist_vcpu_hotplug
nonexist_vcpu = -1 256
- remove_one_cpu:
unplug = "yes"
- remove_32_cpu:
unplug = "yes"
n_cpus_remove = 32
- remove_64_cpu:
unplug = "yes"
n_cpus_remove = 64
- remove_96_cpu:
unplug = "yes"
n_cpus_remove = 96
- remove_128_cpu:
unplug = "yes"
n_cpus_remove = 128
- remove_160_cpu:
unplug = "yes"
n_cpus_remove = 160
- remove_192_cpu:
unplug = "yes"
n_cpus_remove = 192
- remove_224_cpu:
unplug = "yes"
n_cpus_remove = 224
- remove_max_cpu:
unplug = "yes"
n_cpus_remove = 240
variants:
- smp8_c1_t4:
smp = 8
used_cpus = 8
vcpu_cores = 1
vcpu_threads = 4
vcpu_maxcpus = 240
- smp8_c2_t2:
smp = 8
used_cpus = 8
vcpu_cores = 2
vcpu_threads = 2
vcpu_maxcpus = 240
qemu/tests/cpu_device_hotplug.py
0 → 100644
浏览文件 @
5719988d
import
logging
import
re
import
time
from
autotest.client.shared
import
error
from
virttest
import
utils_misc
@
error
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Runs vCPU hotplug tests based on CPU device:
"""
def
hotplug
(
vm
,
current_cpus
,
total_cpus
,
vcpu_threads
):
for
cpu
in
range
(
current_cpus
,
total_cpus
):
error
.
context
(
"hot-pluging vCPU %s"
%
cpu
,
logging
.
info
)
vm
.
hotplug_vcpu
(
cpu_id
=
cpu
,
plug_command
=
hotplug_cmd
)
time
.
sleep
(
0.1
)
time
.
sleep
(
5
)
def
hotunplug
(
vm
,
current_cpus
,
total_cpus
,
vcpu_threads
):
for
cpu
in
range
(
current_cpus
,
total_cpus
):
error
.
context
(
"hot-unpluging vCPU %s"
%
cpu
,
logging
.
info
)
vm
.
hotplug_vcpu
(
cpu_id
=
cpu
,
plug_command
=
unplug_cmd
,
unplug
=
"yes"
)
time
.
sleep
(
0.1
)
# Need more time to unplug, so sleeping more than hotplug.
time
.
sleep
(
10
)
def
verify
(
vm
,
total_cpus
):
output
=
vm
.
monitor
.
send_args_cmd
(
"info cpus"
)
logging
.
debug
(
"Output of info CPUs:
\n
%s"
,
output
)
cpu_regexp
=
re
.
compile
(
"CPU #(\d+)"
)
total_cpus_monitor
=
len
(
cpu_regexp
.
findall
(
output
))
if
total_cpus_monitor
!=
total_cpus
:
raise
error
.
TestFail
(
"Monitor reports %s CPUs, when VM should have"
" %s"
%
(
total_cpus_monitor
,
total_cpus
))
error
.
context
(
"hotplugging finished, let's wait a few sec and"
" check CPUs quantity in guest."
,
logging
.
info
)
if
not
utils_misc
.
wait_for
(
lambda
:
utils_misc
.
check_if_vm_vcpu_match
(
total_cpus
,
vm
),
60
+
total_cpus
,
first
=
10
,
step
=
5.0
,
text
=
"retry later"
):
raise
error
.
TestFail
(
"CPU quantity mismatch cmd after hotplug !"
)
error
.
context
(
"rebooting the vm and check CPU quantity !"
,
logging
.
info
)
session
=
vm
.
reboot
()
if
not
utils_misc
.
check_if_vm_vcpu_match
(
total_cpus
,
vm
):
raise
error
.
TestFail
(
"CPU quantity mismatch cmd after hotplug "
"and reboot !"
)
error
.
context
(
"boot the vm, with '-smp X,maxcpus=Y' option,"
"thus allow hotplug vcpu"
,
logging
.
info
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
))
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
n_cpus_add
=
int
(
params
.
get
(
"n_cpus_add"
,
1
))
n_cpus_remove
=
int
(
params
.
get
(
"n_cpus_remove"
,
1
))
maxcpus
=
int
(
params
.
get
(
"maxcpus"
,
240
))
current_cpus
=
int
(
params
.
get
(
"smp"
,
2
))
onoff_iterations
=
int
(
params
.
get
(
"onoff_iterations"
,
20
))
hotplug_cmd
=
params
.
get
(
"cpu_hotplug_cmd"
,
""
)
unplug_cmd
=
params
.
get
(
"cpu_hotunplug_cmd"
,
""
)
vcpu_cores
=
int
(
params
.
get
(
"vcpu_cores"
,
1
))
vcpu_threads
=
int
(
params
.
get
(
"vcpu_threads"
,
1
))
cpu_model
=
params
.
get
(
"cpu_model"
,
"host"
)
unplug
=
params
.
get
(
"unplug"
,
"no"
)
total_cpus
=
current_cpus
if
unplug
==
"yes"
:
n_cpus_add
=
n_cpus_remove
hotplug_cmd
=
hotplug_cmd
.
replace
(
"CPU_MODEL"
,
cpu_model
)
if
(
n_cpus_add
*
vcpu_threads
)
+
current_cpus
>
maxcpus
:
logging
.
warn
(
"CPU quantity more than maxcpus, set it to %s"
,
maxcpus
)
total_cpus
=
maxcpus
else
:
total_cpus
=
current_cpus
+
(
n_cpus_add
*
vcpu_threads
)
logging
.
info
(
"current_cpus=%s, total_cpus=%s"
,
current_cpus
,
total_cpus
)
error
.
context
(
"check if CPUs in guest matches qemu cmd "
"before hot-plug"
,
logging
.
info
)
if
not
utils_misc
.
check_if_vm_vcpu_match
(
current_cpus
,
vm
):
raise
error
.
TestError
(
"CPU quantity mismatch cmd before hotplug !"
)
hotplug
(
vm
,
current_cpus
,
total_cpus
,
vcpu_threads
)
verify
(
vm
,
total_cpus
)
if
unplug
==
"yes"
:
hotunplug
(
vm
,
current_cpus
,
total_cpus
,
vcpu_threads
)
total_cpus
=
total_cpus
-
(
n_cpus_remove
*
vcpu_threads
)
if
total_cpus
<=
0
:
total_cpus
=
current_cpus
verify
(
vm
,
total_cpus
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录