Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
54315846
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,发现更多精彩内容 >>
未验证
提交
54315846
编写于
9月 28, 2018
作者:
Q
Qianqian Zhu
提交者:
GitHub
9月 28, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1394 from pezhang/bug1566963
Add windows guest support for upload/download data via ipv6
上级
6518470f
c146435b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
48 deletion
+63
-48
qemu/tests/cfg/transfer_file_over_ipv6.cfg
qemu/tests/cfg/transfer_file_over_ipv6.cfg
+5
-2
qemu/tests/transfer_file_over_ipv6.py
qemu/tests/transfer_file_over_ipv6.py
+58
-46
未找到文件。
qemu/tests/cfg/transfer_file_over_ipv6.cfg
浏览文件 @
54315846
- bigfile_transfer_over_ipv6:
virt_test_type = qemu
only Linux
type = transfer_file_over_ipv6
vms
+= "
vm2"
vms
= "vm1
vm2"
image_snapshot = yes
filesize = 4096
file_trans_timeout = 2400
file_md5_check_timeout = 600
dd_cmd = "dd if=/dev/zero of=%s oflag=direct bs=1M count=%d"
Linux:
tmp_dir = "/var/tmp/"
Windows:
tmp_dir = "C:\\"
qemu/tests/transfer_file_over_ipv6.py
浏览文件 @
54315846
...
...
@@ -14,7 +14,10 @@ def run(test, params, env):
"""
Test Step
1. boot up two virtual machine
2. Transfer data: host <--> guest1 <--> guest2 <-->host via ipv6
2. For linux guest,Transfer data:
host <--> guest1 <--> guest2 <-->host via ipv6
For windows guest,Transfer data:
host <--> guest1&guest2 via ipv6
3. after data transfer, check data have no change
Params:
:param test: QEMU test object
...
...
@@ -26,29 +29,12 @@ def run(test, params, env):
port
=
params
.
get
(
"file_transfer_port"
)
password
=
params
.
get
(
"password"
)
username
=
params
.
get
(
"username"
)
tmp_dir
=
params
.
get
(
"tmp_dir"
,
"/tmp/"
)
tmp_dir
=
params
[
"tmp_dir"
]
filesize
=
int
(
params
.
get
(
"filesize"
,
'4096'
))
dd_cmd
=
params
.
get
(
"dd_cmd"
)
dd_cmd
=
params
[
"dd_cmd"
]
file_trans_timeout
=
int
(
params
.
get
(
"file_trans_timeout"
,
'1200'
))
file_md5_check_timeout
=
int
(
params
.
get
(
"file_md5_check_timeout"
,
'600'
))
def
get_linux_ipv6_linklocal_address
(
ifname
,
session
=
None
):
"""
Get host/guest ipv6 linklocal address via ifname
"""
if
session
is
not
None
:
o
=
session
.
cmd_output
(
"ifconfig %s"
%
ifname
)
else
:
o
=
process
.
system_output
(
"ifconfig %s"
%
ifname
)
ipv6_address_reg
=
re
.
compile
(
r
"(fe80::[^\s|/]*)"
)
if
o
:
ipv6_linklocal_address
=
ipv6_address_reg
.
findall
(
o
)
if
not
ipv6_linklocal_address
:
test
.
error
(
"Can't get %s linklocal address"
%
ifname
)
return
ipv6_linklocal_address
[
0
]
else
:
return
None
def
get_file_md5sum
(
file_name
,
session
,
timeout
):
"""
Get file md5sum from guest.
...
...
@@ -72,14 +58,26 @@ def run(test, params, env):
# config ipv6 address host and guest.
host_ifname
=
params
.
get
(
"netdst"
)
host_address
=
utils_net
.
get_host_ip_address
(
params
,
ip_ver
=
"ipv6"
,
linklocal
=
True
)
error_context
.
context
(
"Get ipv6 address of host: %s"
%
host_address
,
logging
.
info
)
for
vm
in
vms
:
vm
.
verify_alive
()
sessions
[
vm
]
=
vm
.
wait_for_login
(
timeout
=
timeout
)
inet_name
[
vm
]
=
utils_net
.
get_linux_ifname
(
sessions
[
vm
],
vm
.
get_mac_address
())
addresses
[
vm
]
=
get_linux_ipv6_linklocal_address
(
inet_name
[
vm
],
sessions
[
vm
])
if
params
.
get
(
"os_type"
)
==
"linux"
:
inet_name
[
vm
]
=
utils_net
.
get_linux_ifname
(
sessions
[
vm
],
vm
.
get_mac_address
())
addresses
[
vm
]
=
utils_net
.
get_guest_ip_addr
(
sessions
[
vm
],
vm
.
get_mac_address
(),
params
.
get
(
"os_type"
),
ip_version
=
"ipv6"
,
linklocal
=
True
)
error_context
.
context
(
"Get ipv6 address of %s: %s"
%
(
vm
.
name
,
addresses
[
vm
]),
logging
.
info
)
# prepare test data
guest_path
=
(
tmp_dir
+
"src-%s"
%
utils_misc
.
generate_random_string
(
8
))
...
...
@@ -91,6 +89,8 @@ def run(test, params, env):
try
:
src_md5
=
(
crypto
.
hash_file
(
host_path
,
algorithm
=
"md5"
))
error_context
.
context
(
"md5 value of data from src: %s"
%
src_md5
,
logging
.
info
)
# transfer data
for
vm
in
vms
:
error_context
.
context
(
"Transfer data from host to %s"
%
vm
.
name
,
...
...
@@ -102,40 +102,48 @@ def run(test, params, env):
interface
=
host_ifname
)
dst_md5
=
get_file_md5sum
(
guest_path
,
sessions
[
vm
],
timeout
=
file_md5_check_timeout
)
error_context
.
context
(
"md5 value of data in %s: %s"
%
(
vm
.
name
,
dst_md5
),
logging
.
info
)
if
dst_md5
!=
src_md5
:
test
.
fail
(
"File changed after transfer host -> %s"
%
vm
.
name
)
for
vm_src
in
addresses
:
for
vm_dst
in
addresses
:
if
vm_src
!=
vm_dst
:
error_context
.
context
(
"Transferring data from %s to %s"
%
(
vm_src
.
name
,
vm_dst
.
name
),
logging
.
info
)
remote
.
scp_between_remotes
(
addresses
[
vm_src
],
addresses
[
vm_dst
],
port
,
password
,
password
,
username
,
username
,
guest_path
,
dest_path
,
timeout
=
file_trans_timeout
,
src_inter
=
host_ifname
,
dst_inter
=
inet_name
[
vm_src
])
dst_md5
=
get_file_md5sum
(
dest_path
,
sessions
[
vm_dst
],
timeout
=
file_md5_check_timeout
)
if
dst_md5
!=
src_md5
:
test
.
fail
(
"File changed transfer %s -> %s"
%
(
vm_src
.
name
,
vm_dst
.
name
))
if
params
.
get
(
"os_type"
)
==
"linux"
:
for
vm_src
in
addresses
:
for
vm_dst
in
addresses
:
if
vm_src
!=
vm_dst
:
error_context
.
context
(
"Transferring data from %s to %s"
%
(
vm_src
.
name
,
vm_dst
.
name
),
logging
.
info
)
remote
.
scp_between_remotes
(
addresses
[
vm_src
],
addresses
[
vm_dst
],
port
,
password
,
password
,
username
,
username
,
guest_path
,
dest_path
,
timeout
=
file_trans_timeout
,
src_inter
=
host_ifname
,
dst_inter
=
inet_name
[
vm_src
])
dst_md5
=
get_file_md5sum
(
dest_path
,
sessions
[
vm_dst
],
timeout
=
file_md5_check_timeout
)
error_context
.
context
(
"md5 value of data in %s: %s"
%
(
vm
.
name
,
dst_md5
),
logging
.
info
)
if
dst_md5
!=
src_md5
:
test
.
fail
(
"File changed transfer %s -> %s"
%
(
vm_src
.
name
,
vm_dst
.
name
))
for
vm
in
vms
:
error_context
.
context
(
"Transfer data from %s to host"
%
vm
.
name
,
logging
.
info
)
remote
.
copy_files_from
(
addresses
[
vm
],
client
,
username
,
password
,
port
,
d
est_path
,
host_path
,
gu
est_path
,
host_path
,
timeout
=
file_trans_timeout
,
interface
=
host_ifname
)
error_context
.
context
(
"Check whether the file changed after trans"
,
logging
.
info
)
dst_md5
=
(
crypto
.
hash_file
(
host_path
,
algorithm
=
"md5"
))
error_context
.
context
(
"md5 value of data after copying to host: %s"
%
dst_md5
,
logging
.
info
)
if
dst_md5
!=
src_md5
:
test
.
fail
(
"File changed after transfer (md5sum mismatch)"
)
process
.
system_output
(
"rm -rf %s"
%
host_path
,
timeout
=
timeout
)
...
...
@@ -144,6 +152,10 @@ def run(test, params, env):
process
.
system
(
"rm -rf %s"
%
host_path
,
timeout
=
timeout
,
ignore_status
=
True
)
for
vm
in
vms
:
sessions
[
vm
].
cmd
(
"rm -rf %s %s || true"
%
(
guest_path
,
dest_path
),
timeout
=
timeout
,
ignore_all_errors
=
True
)
if
params
.
get
(
"os_type"
)
==
"linux"
:
sessions
[
vm
].
cmd
(
"rm -rf %s %s || true"
%
(
guest_path
,
dest_path
),
timeout
=
timeout
,
ignore_all_errors
=
True
)
else
:
sessions
[
vm
].
cmd
(
"del /f %s"
%
guest_path
,
timeout
=
timeout
,
ignore_all_errors
=
True
)
sessions
[
vm
].
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录