Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
c0c8bc21
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,发现更多精彩内容 >>
提交
c0c8bc21
编写于
1月 15, 2016
作者:
X
Xu Tian
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #527 from luckyh/ppc-virtblk-disk
Replace the method of getting target drive path
上级
83b9668f
f83f3367
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
63 addition
and
19 deletion
+63
-19
generic/tests/cfg/dd_test.cfg
generic/tests/cfg/dd_test.cfg
+7
-4
generic/tests/cfg/lvm.cfg
generic/tests/cfg/lvm.cfg
+5
-0
generic/tests/dd_test.py
generic/tests/dd_test.py
+7
-0
generic/tests/lvm.py
generic/tests/lvm.py
+10
-3
qemu/tests/block_resize.py
qemu/tests/block_resize.py
+8
-1
qemu/tests/cfg/block_resize.cfg
qemu/tests/cfg/block_resize.cfg
+4
-1
qemu/tests/cfg/format_disk.cfg
qemu/tests/cfg/format_disk.cfg
+8
-5
qemu/tests/format_disk.py
qemu/tests/format_disk.py
+14
-5
未找到文件。
generic/tests/cfg/dd_test.cfg
浏览文件 @
c0c8bc21
...
...
@@ -9,6 +9,9 @@
image_snapshot_stg1 = no
drive_index_stg1 = 3
image_boot_stg1 = no
blk_extra_params_stg1 = "serial=TARGET_DISK0"
Host_RHEL.m6..ide:
blk_extra_params_stg1 = "wwn=0x5000123456789abc"
dd_count = 1
# last input and output disk
dd_if_select = -1
...
...
@@ -19,9 +22,9 @@
variants:
- zero2disk:
dd_if = ZERO
dd_of =
/dev/[shv]d?
dd_of =
stg1
- disk2null:
dd_if =
/dev/[shv]d?
dd_if =
stg1
dd_of = NULL
- readonly:
# ide, ahci don't support readonly disks
...
...
@@ -30,9 +33,9 @@
variants:
- zero2disk:
dd_if = ZERO
dd_of =
/dev/[shv]d?
dd_of =
stg1
dd_stat = 1
- disk2null:
dd_if =
/dev/[shv]d?
dd_if =
stg1
dd_of = NULL
dd_stat = 0
generic/tests/cfg/lvm.cfg
浏览文件 @
c0c8bc21
...
...
@@ -17,7 +17,12 @@
- lvm_create:
type = lvm
force_create_image_stg1 = yes
blk_extra_params_stg1 = "serial=TARGET_DISK1"
force_create_image_stg2 = yes
blk_extra_params_stg2 = "serial=TARGET_DISK2"
Host_RHEL.m6..ide:
blk_extra_params_stg1 = "wwn=0x5000123456789abc"
blk_extra_params_stg2 = "wwn=0x5000cba987654321"
clean = no
- lvm_fill: lvm_create
type = fillup_disk
...
...
generic/tests/dd_test.py
浏览文件 @
c0c8bc21
...
...
@@ -8,6 +8,7 @@ import logging
import
aexpect
from
autotest.client.shared
import
error
from
virttest
import
utils_misc
@
error
.
context_aware
...
...
@@ -30,6 +31,12 @@ def run(test, params, env):
return
"/dev/random"
elif
filename
==
"URANDOM"
:
return
"/dev/urandom"
elif
filename
in
params
.
objects
(
"images"
):
drive_id
=
params
[
"blk_extra_params_%s"
%
filename
].
split
(
"="
)[
1
]
drive_path
=
utils_misc
.
get_linux_drive_path
(
session
,
drive_id
)
if
drive_path
:
return
drive_path
raise
error
.
TestError
(
"Failed to get '%s' drive path"
%
filename
)
else
:
# get all matching filenames
try
:
...
...
generic/tests/lvm.py
浏览文件 @
c0c8bc21
...
...
@@ -2,6 +2,7 @@ import os
import
logging
from
autotest.client.shared
import
error
from
virttest
import
utils_misc
@
error
.
context_aware
...
...
@@ -43,9 +44,15 @@ def run(test, params, env):
lv_path
=
"/dev/%s/%s"
%
(
vg_name
,
lv_name
)
clean
=
params
.
get
(
"clean"
,
"yes"
)
timeout
=
params
.
get
(
"lvm_timeout"
,
"600"
)
output
=
session
.
cmd_output
(
"ls /dev/[hvs]da"
)
disk_prefix
=
output
.
strip
()[:
len
(
'/dev/hd'
)]
disks
=
"%sb %sc"
%
(
disk_prefix
,
disk_prefix
)
disk_list
=
[]
for
disk
in
params
.
objects
(
"images"
)[
-
2
:]:
d_id
=
params
[
"blk_extra_params_%s"
%
disk
].
split
(
"="
)[
1
]
d_path
=
utils_misc
.
get_linux_drive_path
(
session
,
d_id
)
if
not
d_path
:
raise
error
.
TestError
(
"Failed to get '%s' drive path"
%
d_id
)
disk_list
.
append
(
d_path
)
disks
=
" "
.
join
(
disk_list
)
try
:
error
.
context
(
"adding physical volumes %s"
%
disks
,
logging
.
info
)
...
...
qemu/tests/block_resize.py
浏览文件 @
c0c8bc21
...
...
@@ -67,7 +67,14 @@ def run(test, params, env):
data_dir
.
get_data_dir
())
data_image_dev
=
vm
.
get_block
({
'file'
:
data_image_filename
})
block_size_cmd
=
params
[
"block_size_cmd"
]
drive_path
=
""
if
params
.
get
(
"os_type"
)
==
'linux'
:
drive_id
=
params
[
"blk_extra_params_%s"
%
data_image
].
split
(
"="
)[
1
]
drive_path
=
utils_misc
.
get_linux_drive_path
(
session
,
drive_id
)
if
not
drive_path
:
raise
error
.
TestError
(
"Failed to get '%s' drive path"
%
data_image
)
block_size_cmd
=
params
[
"block_size_cmd"
].
format
(
drive_path
)
block_size_pattern
=
params
.
get
(
"block_size_pattern"
)
need_reboot
=
params
.
get
(
"need_reboot"
,
"no"
)
==
"yes"
accept_ratio
=
float
(
params
.
get
(
"accept_ratio"
,
0
))
...
...
qemu/tests/cfg/block_resize.cfg
浏览文件 @
c0c8bc21
...
...
@@ -9,7 +9,10 @@
image_name_stg = images/stg
create_image_stg = yes
force_create_image_stg = yes
block_size_cmd = "fdisk -l|grep /dev/*db"
blk_extra_params_stg = "serial=TARGET_DISK0"
Host_RHEL.m6..ide:
blk_extra_params_stg = "wwn=0x5000123456789abc"
block_size_cmd = "fdisk -l | grep {0}"
block_size_pattern = ",\s+(\d+\s+b)ytes"
disk_change_ratio = "1.5 0.5"
guest_prepare_cmd = ""
...
...
qemu/tests/cfg/format_disk.cfg
浏览文件 @
c0c8bc21
...
...
@@ -5,18 +5,21 @@
boot_drive_disk1 = yes
image_name_disk1 = images/storage
image_size_disk1 = 10G
blk_extra_params_disk1 = "serial=TARGET_DISK0"
Host_RHEL.m6..ide:
blk_extra_params_disk1 = "wwn=0x5000123456789abc"
force_create_image_disk1 = yes
kill_vm = yes
cmd_timeout = 1200
# The following parameters will be overriden in guest-os config files.
create_partition_cmd = ""
format_cmd = "
cd /dev && for i in `ls | egrep [shv]db`;do yes |mkfs.ext3 $i; done
"
format_cmd = "
yes | mkfs.ext3 {0}
"
list_disk_cmd = ""
set_online_cmd = ""
show_dev_cmd = "
cd /dev && ls | egrep [shv]db
"
mount_cmd = "mkdir -p /media &&
cd /dev && ls | egrep [shv]db | xargs -I dev mount -t ext3 dev
/media"
show_mount_cmd = "mount | grep
-Eo '/dev/[shv]db'
"
umount_cmd = "
mount | grep -Eo '/dev/[shv]db' | xargs umount
"
show_dev_cmd = "
ls {0}
"
mount_cmd = "mkdir -p /media &&
mount -t ext3 {0}
/media"
show_mount_cmd = "mount | grep
{0}
"
umount_cmd = "
umount {0}
"
testfile_name = "/media/format_disk-test.txt"
writefile_cmd = "echo %s > %s"
readfile_cmd = "cat %s"
qemu/tests/format_disk.py
浏览文件 @
c0c8bc21
...
...
@@ -33,6 +33,17 @@ def run(test, params, env):
session
=
vm
.
wait_for_login
(
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
)))
cmd_timeout
=
int
(
params
.
get
(
"cmd_timeout"
,
360
))
drive_path
=
""
if
params
.
get
(
"os_type"
)
==
'linux'
:
drive_name
=
params
.
objects
(
"images"
)[
-
1
]
drive_id
=
params
[
"blk_extra_params_%s"
%
drive_name
].
split
(
"="
)[
1
]
drive_path
=
utils_misc
.
get_linux_drive_path
(
session
,
drive_id
)
if
not
drive_path
:
raise
error
.
TestError
(
"Failed to get '%s' drive path"
%
drive_name
)
show_dev_cmd
=
params
[
"show_dev_cmd"
].
format
(
drive_path
)
show_mount_cmd
=
params
[
"show_mount_cmd"
].
format
(
drive_path
)
# Create a partition on disk
create_partition_cmd
=
params
.
get
(
"create_partition_cmd"
)
if
create_partition_cmd
:
...
...
@@ -58,7 +69,7 @@ def run(test, params, env):
raise
error
.
TestFail
(
"Failed to create partition with error: %s"
%
output
)
format_cmd
=
params
.
get
(
"format_cmd"
)
format_cmd
=
params
.
get
(
"format_cmd"
)
.
format
(
drive_path
)
if
format_cmd
:
error
.
context
(
"Format the disk with cmd '%s'"
%
format_cmd
,
logging
.
info
)
...
...
@@ -67,12 +78,11 @@ def run(test, params, env):
if
status
!=
0
:
raise
error
.
TestFail
(
"Failed to format with error: %s"
%
output
)
mount_cmd
=
params
.
get
(
"mount_cmd"
)
mount_cmd
=
params
.
get
(
"mount_cmd"
)
.
format
(
drive_path
)
if
mount_cmd
:
error
.
context
(
"Mount the disk with cmd '%s'"
%
mount_cmd
,
logging
.
info
)
status
,
output
=
session
.
cmd_status_output
(
mount_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
show_dev_cmd
=
params
[
"show_dev_cmd"
]
device_list
=
session
.
cmd_output_safe
(
show_dev_cmd
)
logging
.
debug
(
"The devices which will be mounted are: %s"
%
device_list
)
raise
error
.
TestFail
(
"Failed to mount with error: %s"
%
output
)
...
...
@@ -105,12 +115,11 @@ def run(test, params, env):
raise
error
.
TestFail
(
"The content written to file has changed, "
"from: %s, to: %s"
%
(
ranstr
,
output
.
strip
()))
umount_cmd
=
params
.
get
(
"umount_cmd"
)
umount_cmd
=
params
.
get
(
"umount_cmd"
)
.
format
(
drive_path
)
if
umount_cmd
:
error
.
context
(
"Unmounting disk(s) after file write/read operation"
)
status
,
output
=
session
.
cmd_status_output
(
umount_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
show_mount_cmd
=
params
[
"show_mount_cmd"
]
mount_list
=
session
.
cmd_output_safe
(
show_mount_cmd
)
logging
.
debug
(
"The mounted devices are: %s"
%
mount_list
)
raise
error
.
TestFail
(
"Failed to umount with error: %s"
%
output
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录