Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
ddcbe6c4
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,发现更多精彩内容 >>
未验证
提交
ddcbe6c4
编写于
10月 10, 2018
作者:
Q
Qianqian Zhu
提交者:
GitHub
10月 10, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1326 from YanhuiMa/hotplug_frozen
qemu_guest_agent: Add case of hotplugging disk with frozen fs
上级
a5014d83
86f51a7b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
78 addition
and
1 deletion
+78
-1
qemu/tests/cfg/qemu_guest_agent.cfg
qemu/tests/cfg/qemu_guest_agent.cfg
+11
-1
qemu/tests/qemu_guest_agent.py
qemu/tests/qemu_guest_agent.py
+67
-0
未找到文件。
qemu/tests/cfg/qemu_guest_agent.cfg
浏览文件 @
ddcbe6c4
...
@@ -85,7 +85,7 @@
...
@@ -85,7 +85,7 @@
gagent_check_type = memory_leak
gagent_check_type = memory_leak
repeats = 1000000
repeats = 1000000
test_command = guest-info
test_command = guest-info
memory_usage_cmd = "tasklist | findstr /I qemu-ga.exe"
memory_usage_cmd = "tasklist | findstr /I qemu-ga.exe"
- check_set_time:
- check_set_time:
image_snapshot = yes
image_snapshot = yes
gagent_check_type = set_time
gagent_check_type = set_time
...
@@ -139,6 +139,16 @@
...
@@ -139,6 +139,16 @@
- gagent_check_after_init:
- gagent_check_after_init:
no Windows
no Windows
gagent_check_type = after_init
gagent_check_type = after_init
- check_hotplug_frozen:
gagent_check_type = hotplug_frozen
images += " stg0"
boot_drive_stg0 = no
image_name_stg0 = images/storage0
image_size_stg0 = 1G
force_create_image_stg0 = yes
disk_write_cmd = "dd if=/dev/zero of=%s/file bs=1M count=4"
Windows:
disk_write_cmd = "cd %s:\ && echo test > a.txt"
variants:
variants:
- virtio_serial:
- virtio_serial:
gagent_serial_type = virtio
gagent_serial_type = virtio
...
...
qemu/tests/qemu_guest_agent.py
浏览文件 @
ddcbe6c4
...
@@ -13,6 +13,7 @@ from avocado.core import exceptions
...
@@ -13,6 +13,7 @@ from avocado.core import exceptions
from
virttest
import
error_context
from
virttest
import
error_context
from
virttest
import
guest_agent
from
virttest
import
guest_agent
from
virttest
import
utils_misc
from
virttest
import
utils_misc
from
virttest
import
utils_disk
from
virttest
import
env_process
from
virttest
import
env_process
...
@@ -942,6 +943,72 @@ class QemuGuestAgentBasicCheck(QemuGuestAgentTest):
...
@@ -942,6 +943,72 @@ class QemuGuestAgentBasicCheck(QemuGuestAgentTest):
test
.
fail
(
"Guest agent service is stopped after running init 3! It "
test
.
fail
(
"Guest agent service is stopped after running init 3! It "
"should be running."
)
"should be running."
)
@
error_context
.
context_aware
def
gagent_check_hotplug_frozen
(
self
,
test
,
params
,
env
):
"""
hotplug device with frozen fs
:param test: kvm test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment
"""
def
get_new_disk
(
disks_before_plug
,
disks_after_plug
):
"""
Get the new added disks by comparing two disk lists.
"""
disk
=
list
(
set
(
disks_after_plug
).
difference
(
set
(
disks_before_plug
)))
return
disk
session
=
self
.
_get_session
(
params
,
self
.
vm
)
image_size_stg0
=
params
[
"image_size_stg0"
]
try
:
if
params
.
get
(
"os_type"
)
==
"linux"
:
disks_before_plug
=
utils_disk
.
get_linux_disks
(
session
,
True
)
error_context
.
context
(
"Freeze guest fs"
,
logging
.
info
)
self
.
gagent
.
fsfreeze
()
# For linux guest, waiting for it to be frozen, for windows guest,
# waiting for it to be automatically thawed.
time
.
sleep
(
20
)
error_context
.
context
(
"Hotplug a disk to guest"
,
logging
.
info
)
image_name_plug
=
params
[
"images"
].
split
()[
1
]
image_params_plug
=
params
.
object_params
(
image_name_plug
)
devs
=
self
.
vm
.
devices
.
images_define_by_params
(
image_name_plug
,
image_params_plug
,
'disk'
)
for
dev
in
devs
:
self
.
vm
.
devices
.
simple_hotplug
(
dev
,
self
.
vm
.
monitor
)
disk_write_cmd
=
params
[
"disk_write_cmd"
]
pause
=
float
(
params
.
get
(
"virtio_block_pause"
,
10.0
))
error_context
.
context
(
"Format and write disk"
,
logging
.
info
)
if
params
.
get
(
"os_type"
)
==
"linux"
:
new_disks
=
utils_misc
.
wait_for
(
lambda
:
get_new_disk
(
disks_before_plug
.
keys
(),
utils_disk
.
get_linux_disks
(
session
,
True
).
keys
()),
pause
)
if
not
new_disks
:
test
.
fail
(
"Can't detect the new hotplugged disks in guest"
)
try
:
mnt_point
=
utils_disk
.
configure_empty_disk
(
session
,
new_disks
[
0
],
image_size_stg0
,
"linux"
,
labeltype
=
"msdos"
)
except
aexpect
.
ShellTimeoutError
:
self
.
gagent
.
fsthaw
()
mnt_point
=
utils_disk
.
configure_empty_disk
(
session
,
new_disks
[
0
],
image_size_stg0
,
"linux"
,
labeltype
=
"msdos"
)
elif
params
.
get
(
"os_type"
)
==
"windows"
:
disk_index
=
utils_misc
.
wait_for
(
lambda
:
utils_disk
.
get_windows_disks_index
(
session
,
image_size_stg0
),
120
)
if
disk_index
:
mnt_point
=
utils_disk
.
configure_empty_disk
(
session
,
disk_index
[
0
],
image_size_stg0
,
"windows"
,
labeltype
=
"msdos"
)
session
.
cmd
(
disk_write_cmd
%
mnt_point
[
0
])
error_context
.
context
(
"Unplug the added disk"
,
logging
.
info
)
self
.
vm
.
devices
.
simple_unplug
(
devs
[
0
],
self
.
vm
.
monitor
)
finally
:
if
self
.
gagent
.
get_fsfreeze_status
()
==
self
.
gagent
.
FSFREEZE_STATUS_FROZEN
:
self
.
gagent
.
fsthaw
(
check_status
=
False
)
self
.
vm
.
verify_alive
()
if
params
.
get
(
"os_type"
)
==
"linux"
:
utils_disk
.
umount
(
new_disks
[
0
],
mnt_point
[
0
],
session
=
session
)
session
.
close
()
def
run_once
(
self
,
test
,
params
,
env
):
def
run_once
(
self
,
test
,
params
,
env
):
QemuGuestAgentTest
.
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录