Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
7d96b2a4
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,发现更多精彩内容 >>
提交
7d96b2a4
编写于
2月 26, 2016
作者:
S
suqinhuang
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #522 from spcui/floppy_migration
qemu/tests: Update multi host part for floppy.py
上级
f8f9f376
ee001a01
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
30 addition
and
32 deletion
+30
-32
qemu/tests/floppy.py
qemu/tests/floppy.py
+30
-32
未找到文件。
qemu/tests/floppy.py
浏览文件 @
7d96b2a4
...
...
@@ -45,7 +45,7 @@ def run(test, params, env):
:return: path to new floppy file.
"""
error
.
context
(
"creating test floppy"
)
error
.
context
(
"creating test floppy"
,
logging
.
info
)
floppy
=
params
[
"floppy_name"
]
if
not
os
.
path
.
isabs
(
floppy
):
floppy
=
os
.
path
.
join
(
data_dir
.
get_data_dir
(),
floppy
)
...
...
@@ -55,7 +55,7 @@ def run(test, params, env):
def
cleanup_floppy
(
path
):
""" Removes created floppy """
error
.
context
(
"cleaning up temp floppy images"
)
error
.
context
(
"cleaning up temp floppy images"
,
logging
.
info
)
os
.
remove
(
"%s"
%
path
)
def
lazy_copy
(
vm
,
dst_path
,
check_path
,
copy_timeout
=
None
,
dsize
=
None
):
...
...
@@ -138,8 +138,7 @@ def run(test, params, env):
error
.
context
(
"Copying file to the floppy"
)
md5_cmd
=
params
.
get
(
"md5_cmd"
)
if
md5_cmd
:
md5_source
=
self
.
session
.
cmd
(
"%s %s"
%
(
params
[
"md5_cmd"
],
source_file
))
md5_source
=
self
.
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
source_file
))
try
:
md5_source
=
md5_source
.
split
(
" "
)[
0
]
except
IndexError
:
...
...
@@ -155,8 +154,7 @@ def run(test, params, env):
error
.
context
(
"Checking if the file is unchanged after copy"
)
if
md5_cmd
:
md5_dest
=
self
.
session
.
cmd
(
"%s %s"
%
(
params
[
"md5_cmd"
],
dest_file
))
md5_dest
=
self
.
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
dest_file
))
try
:
md5_dest
=
md5_dest
.
split
(
" "
)[
0
]
except
IndexError
:
...
...
@@ -179,7 +177,7 @@ def run(test, params, env):
class
Multihost
(
MiniSubtest
):
def
test
(
self
):
error
.
context
(
"Preparing migration env and floppies."
)
error
.
context
(
"Preparing migration env and floppies."
,
logging
.
info
)
mig_protocol
=
params
.
get
(
"mig_protocol"
,
"tcp"
)
self
.
mig_type
=
utils_test
.
qemu
.
MultihostMigration
if
mig_protocol
==
"fd"
:
...
...
@@ -196,6 +194,8 @@ def run(test, params, env):
self
.
mig
=
self
.
mig_type
(
test
,
params
,
env
,
False
,
)
if
self
.
is_src
:
vm
=
env
.
get_vm
(
self
.
vms
[
0
])
vm
.
destroy
()
self
.
floppy
=
create_floppy
(
params
)
self
.
floppy_dir
=
os
.
path
.
dirname
(
self
.
floppy
)
params
[
"start_vm"
]
=
"yes"
...
...
@@ -217,6 +217,7 @@ def run(test, params, env):
def
test
(
self
):
super
(
test_multihost_write
,
self
).
test
()
copy_timeout
=
int
(
params
.
get
(
"copy_timeout"
,
480
))
self
.
mount_dir
=
params
[
"mount_dir"
]
format_floppy_cmd
=
params
[
"format_floppy_cmd"
]
...
...
@@ -227,19 +228,19 @@ def run(test, params, env):
'dst'
:
self
.
dsthost
,
"type"
:
"file_trasfer"
}
filename
=
"orig"
src_file
=
os
.
path
.
join
(
self
.
mount_dir
,
filename
)
if
self
.
is_src
:
# Starts in source
vm
=
env
.
get_vm
(
self
.
vms
[
0
])
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
if
self
.
mount_dir
:
session
.
cmd
(
"rm -f %s"
%
(
os
.
path
.
join
(
self
.
mount_dir
,
filename
)))
session
.
cmd
(
"rm -f %s"
%
(
src_file
))
session
.
cmd
(
"rm -f %s"
%
(
check_copy_path
))
# If mount_dir specified, treat guest as a Linux OS
# Some Linux distribution does not load floppy at boot
# and Windows needs time to load and init floppy driver
error
.
context
(
"Prepare floppy for writing."
)
error
.
context
(
"Prepare floppy for writing."
,
logging
.
info
)
if
self
.
mount_dir
:
lsmod
=
session
.
cmd
(
"lsmod"
)
if
'floppy'
not
in
lsmod
:
...
...
@@ -249,16 +250,15 @@ def run(test, params, env):
session
.
cmd
(
format_floppy_cmd
)
error
.
context
(
"Mount and copy data
"
)
error
.
context
(
"Mount and copy data
."
,
logging
.
info
)
if
self
.
mount_dir
:
session
.
cmd
(
"mount %s %s"
%
(
guest_floppy_path
,
self
.
mount_dir
),
timeout
=
30
)
error
.
context
(
"File copying test
"
)
error
.
context
(
"File copying test
."
,
logging
.
info
)
pid
=
lazy_copy
(
vm
,
os
.
path
.
join
(
self
.
mount_dir
,
filename
),
check_copy_path
,
copy_timeout
)
pid
=
lazy_copy
(
vm
,
src_file
,
check_copy_path
,
copy_timeout
)
sync
=
SyncData
(
self
.
mig
.
master_id
(),
self
.
mig
.
hostid
,
self
.
mig
.
hosts
,
sync_id
,
self
.
mig
.
sync_server
)
...
...
@@ -270,39 +270,36 @@ def run(test, params, env):
if
not
self
.
is_src
:
# Starts in destination
vm
=
env
.
get_vm
(
self
.
vms
[
0
])
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
error
.
context
(
"Wait for copy finishing."
)
status
=
int
(
session
.
cmd_status
(
"kill %s"
%
pid
,
timeout
=
copy_timeout
)
)
if
status
not
in
[
0
]
:
error
.
context
(
"Wait for copy finishing."
,
logging
.
info
)
status
=
session
.
cmd_status
(
"kill %s"
%
pid
,
timeout
=
copy_timeout
)
if
status
!=
0
:
raise
error
.
TestFail
(
"Copy process was terminatted with"
" error code %s"
%
(
status
))
session
.
cmd_status
(
"kill -s SIGINT %s"
%
(
pid
),
timeout
=
copy_timeout
)
error
.
context
(
"Check floppy file checksum."
)
md5_cmd
=
params
.
get
(
"md5_cmd"
)
error
.
context
(
"Check floppy file checksum."
,
logging
.
info
)
md5_cmd
=
params
.
get
(
"md5_cmd"
,
"md5sum"
)
if
md5_cmd
:
md5_floppy
=
session
.
cmd
(
"%s %s"
%
(
params
.
get
(
"md5_cmd"
),
os
.
path
.
join
(
self
.
mount_dir
,
filename
)))
md5_floppy
=
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
src_file
))
try
:
md5_floppy
=
md5_floppy
.
split
(
" "
)[
0
]
except
IndexError
:
error
.
TestError
(
"Failed to get md5 from source file,"
" output: '%s'"
%
md5_floppy
)
md5_check
=
session
.
cmd
(
"%s %s"
%
(
params
.
get
(
"md5_cmd"
),
check_copy_path
))
md5_check
=
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
check_copy_path
))
try
:
md5_check
=
md5_check
.
split
(
" "
)[
0
]
except
IndexError
:
error
.
TestError
(
"Failed to get md5 from
source
file,"
error
.
TestError
(
"Failed to get md5 from
dst
file,"
" output: '%s'"
%
md5_floppy
)
if
md5_check
!=
md5_floppy
:
raise
error
.
TestFail
(
"There is mistake in copying,"
"
it is possible to check file on vm."
)
raise
error
.
TestFail
(
"There is mistake in copying,
"
"it is possible to check file on vm."
)
session
.
cmd
(
"rm -f %s"
%
(
os
.
path
.
join
(
self
.
mount_dir
,
filename
)))
session
.
cmd
(
"rm -f %s"
%
(
src_file
))
session
.
cmd
(
"rm -f %s"
%
(
check_copy_path
))
self
.
mig
.
_hosts_barrier
(
self
.
mig
.
hosts
,
self
.
mig
.
hosts
,
...
...
@@ -315,6 +312,7 @@ def run(test, params, env):
def
test
(
self
):
super
(
test_multihost_eject
,
self
).
test
()
self
.
mount_dir
=
params
.
get
(
"mount_dir"
,
None
)
format_floppy_cmd
=
params
[
"format_floppy_cmd"
]
floppy
=
params
[
"floppy_name"
]
...
...
@@ -332,18 +330,18 @@ def run(test, params, env):
'dst'
:
self
.
dsthost
,
"type"
:
"file_trasfer"
}
filename
=
"orig"
src_file
=
os
.
path
.
join
(
self
.
mount_dir
,
filename
)
if
self
.
is_src
:
# Starts in source
vm
=
env
.
get_vm
(
self
.
vms
[
0
])
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
if
self
.
mount_dir
:
# If linux
session
.
cmd
(
"rm -f %s"
%
(
os
.
path
.
join
(
self
.
mount_dir
,
filename
)))
session
.
cmd
(
"rm -f %s"
%
(
src_file
))
# If mount_dir specified, treat guest as a Linux OS
# Some Linux distribution does not load floppy at boot
# and Windows needs time to load and init floppy driver
error
.
context
(
"Prepare floppy for writing."
)
error
.
context
(
"Prepare floppy for writing."
,
logging
.
info
)
if
self
.
mount_dir
:
# If linux
lsmod
=
session
.
cmd
(
"lsmod"
)
if
'floppy'
not
in
lsmod
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录