Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
0beb99ae
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,发现更多精彩内容 >>
提交
0beb99ae
编写于
10月 21, 2014
作者:
Y
Yiqiao Pu
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #142 from xutian/change_media_windows
qemu.tests: add change_media test windows support
上级
736371e1
8f918a12
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
14 deletion
+32
-14
qemu/tests/cfg/change_media.cfg
qemu/tests/cfg/change_media.cfg
+4
-4
qemu/tests/change_media.py
qemu/tests/change_media.py
+28
-10
未找到文件。
qemu/tests/cfg/change_media.cfg
浏览文件 @
0beb99ae
- change_media:
no Windows
only RHEL
type = change_media
virt_test_type = qemu
kill_vm = yes
monitor_type = qmp
pre_command += "dd if=/dev/urandom of=/tmp/orig bs=10M count=1 && dd if=/dev/urandom of=/tmp/new bs=10M count=1 && mkisofs -o /tmp/orig.iso /tmp/orig && mkisofs -o /tmp/new.iso /tmp/new;"
post_command += "rm -rf /tmp/orig.iso /tmp/new.iso /tmp/orig /tmp/new;"
orig_img_name = /tmp/orig.iso
new_img_name = /tmp/new.iso
cd_mount_cmd = mount %s /mnt
cd_umount_cmd = umount /mnt
cdrom_cd1 = /tmp/orig.iso
Linux:
cd_mount_cmd = mount %s /mnt
cd_umount_cmd = umount /mnt
qemu/tests/change_media.py
浏览文件 @
0beb99ae
import
logging
import
re
import
time
import
logging
from
autotest.client.shared
import
error
from
virttest
import
utils_test
,
utils_misc
from
virttest
import
utils_test
,
utils_misc
,
data_dir
@
error
.
context_aware
...
...
@@ -58,6 +59,7 @@ def run(test, params, env):
time
.
sleep
(
10
)
cdrom
=
params
.
get
(
"cdrom_cd1"
)
cdrom
=
utils_misc
.
get_path
(
data_dir
.
get_data_dir
(),
cdrom
)
device_name
=
vm
.
get_block
({
"file"
:
cdrom
})
if
device_name
is
None
:
msg
=
"Unable to detect qemu block device for cdrom %s"
%
cdrom
...
...
@@ -75,14 +77,30 @@ def run(test, params, env):
if
check_block_locked
(
device_name
):
raise
error
.
TestFail
(
"Unused device is locked."
)
error
.
context
(
"mount cdrom to make status to locked"
,
logging
.
info
)
cdrom
=
utils_test
.
get_readable_cdroms
(
params
,
session
)[
0
]
mount_cmd
=
params
.
get
(
"cd_mount_cmd"
)
%
cdrom
(
status
,
output
)
=
session
.
cmd_status_output
(
mount_cmd
,
timeout
=
360
)
if
status
:
msg
=
"Unable to mount cdrom. command: %s
\n
Output: %s"
%
(
mount_cmd
,
output
)
raise
error
.
TestError
(
msg
)
if
params
.
get
(
"os_type"
)
!=
"windows"
:
error
.
context
(
"mount cdrom to make status to locked"
,
logging
.
info
)
cdrom
=
utils_test
.
get_readable_cdroms
(
params
,
session
)[
0
]
mount_cmd
=
params
.
get
(
"cd_mount_cmd"
)
%
cdrom
(
status
,
output
)
=
session
.
cmd_status_output
(
mount_cmd
,
timeout
=
360
)
if
status
:
msg
=
"Unable to mount cdrom. "
msg
+=
"command: %s
\n
Output: %s"
%
(
mount_cmd
,
output
)
raise
error
.
TestError
(
msg
)
else
:
error
.
context
(
"lock cdrom in guest"
,
logging
.
info
)
tmp_dir
=
params
.
get
(
"tmp_dir"
,
"c:
\\
"
)
eject_tool
=
utils_misc
.
get_path
(
data_dir
.
get_deps_dir
(),
"cdrom/eject.exe"
)
vm
.
copy_files_to
(
eject_tool
,
tmp_dir
)
output
=
session
.
cmd
(
"wmic cdrom get Drive"
,
timeout
=
120
)
cd_vol
=
re
.
findall
(
"[d-z]:"
,
output
,
re
.
I
)[
0
]
lock_cmd
=
"%s
\\
eject.exe -i on %s"
%
(
tmp_dir
,
cd_vol
)
(
status
,
output
)
=
session
.
cmd_status_output
(
lock_cmd
)
if
status
:
msg
=
"Unable to lock cdrom. command: %s
\n
"
%
lock_cmd
msg
+=
"Output: %s"
%
output
raise
error
.
TestError
(
msg
)
if
not
check_block_locked
(
device_name
):
raise
error
.
TestFail
(
"device is not locked after mount it in guest."
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录