Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
84283342
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,发现更多精彩内容 >>
未验证
提交
84283342
编写于
6月 28, 2020
作者:
Y
Yu Yihuang
提交者:
GitHub
6月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2245 from yanglei-rh/bug1839693
Windows nic teaming test
上级
2864f9eb
8c641d1f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
129 addition
and
0 deletion
+129
-0
qemu/tests/cfg/win_nics_teaming.cfg
qemu/tests/cfg/win_nics_teaming.cfg
+15
-0
qemu/tests/win_nics_teaming.py
qemu/tests/win_nics_teaming.py
+114
-0
未找到文件。
qemu/tests/cfg/win_nics_teaming.cfg
0 → 100644
浏览文件 @
84283342
- win_nics_teaming:
virt_test_type = qemu
only Win2016 Win2019
only x86_64
no macvtap
type = win_nics_teaming
nics = "nic1 nic2 nic3 nic4"
clone_master = yes
master_images_clone = image1
remove_image_image1 =yes
filesize = 8000
dd_cmd = "dd if=/dev/zero of=%s oflag=direct bs=1M count=${filesize}"
tmp_dir = "C:\\"
delete_cmd = "del /f %s"
setup_cmd = 'powershell -command "New-NetLbfoTeam -Name \"Team\" -TeamMembers \"%s\",\"%s\",\"%s\",\"%s\""'
qemu/tests/win_nics_teaming.py
0 → 100644
浏览文件 @
84283342
import
logging
import
time
import
os
import
random
import
aexpect
from
avocado.utils
import
crypto
,
process
from
virttest
import
utils_net
from
virttest
import
utils_misc
def
run
(
test
,
params
,
env
):
"""
Nic teaming test in guest.
1) Start guest with four nic devices.
2) Setup Team in guest.
3) Execute file transfer from host to guest.
4) Repeatedly set enable/disable interfaces by 'netsh interface set'
5) Execute file transfer from guest to host.
:param test: Kvm test object.
:param params: Dictionary with the test parameters.
:param env: Dictionary with test environment.
"""
tmp_dir
=
params
[
"tmp_dir"
]
filesize
=
params
.
get_numeric
(
"filesize"
)
dd_cmd
=
params
[
"dd_cmd"
]
delete_cmd
=
params
[
"delete_cmd"
]
login_timeout
=
params
.
get_numeric
(
"login_timeout"
,
1200
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
session_serial
=
vm
.
wait_for_serial_login
(
timeout
=
login_timeout
)
nics
=
params
.
objects
(
"nics"
)
ifnames
=
()
for
i
in
range
(
len
(
nics
)):
mac
=
vm
.
get_mac_address
(
i
)
connection_id
=
utils_net
.
get_windows_nic_attribute
(
session_serial
,
"macaddress"
,
mac
,
"netconnectionid"
)
ifnames
+=
(
connection_id
,)
# get params of teaming
setup_cmd
=
params
[
"setup_cmd"
]
status
,
output
=
session_serial
.
cmd_status_output
(
setup_cmd
%
ifnames
)
if
status
:
test
.
fail
(
"Failed to setup team nic from powershell,"
"status=%s, output=%s"
%
(
status
,
output
))
# prepare test data
guest_path
=
(
tmp_dir
+
"src-%s"
%
utils_misc
.
generate_random_string
(
8
))
host_path
=
os
.
path
.
join
(
test
.
tmpdir
,
"tmp-%s"
%
utils_misc
.
generate_random_string
(
8
))
logging
.
info
(
"Test setup: Creating %dMB file on host"
,
filesize
)
process
.
run
(
dd_cmd
%
host_path
,
shell
=
True
)
try
:
netsh_set_cmd
=
"netsh interface set interface
\"
%s
\"
%s"
# transfer data
original_md5
=
crypto
.
hash_file
(
host_path
,
algorithm
=
"md5"
)
logging
.
info
(
"md5 value of data original: %s"
%
original_md5
)
logging
.
info
(
"Failover test with file transfer"
)
transfer_thread
=
utils_misc
.
InterruptedThread
(
vm
.
copy_files_to
,
(
host_path
,
guest_path
))
transfer_thread
.
start
()
try
:
while
transfer_thread
.
isAlive
():
for
ifname
in
ifnames
:
session_serial
.
cmd
(
netsh_set_cmd
%
(
ifname
,
"disable"
))
time
.
sleep
(
random
.
randint
(
1
,
30
))
session_serial
.
cmd
(
netsh_set_cmd
%
(
ifname
,
"enable"
))
time
.
sleep
(
random
.
randint
(
1
,
30
))
except
aexpect
.
ShellProcessTerminatedError
:
transfer_thread
.
join
(
suppress_exception
=
True
)
raise
else
:
transfer_thread
.
join
()
os
.
remove
(
host_path
)
logging
.
info
(
'Cleaning temp file on host'
)
logging
.
info
(
"Failover test 2 with file transfer"
)
transfer_thread
=
utils_misc
.
InterruptedThread
(
vm
.
copy_files_from
,
(
guest_path
,
host_path
))
transfer_thread
.
start
()
try
:
nic_num
=
len
(
ifnames
)
index
=
0
while
transfer_thread
.
isAlive
():
index
=
index
%
nic_num
for
i
in
range
(
nic_num
):
session_serial
.
cmd
(
netsh_set_cmd
%
(
ifnames
[
i
],
"enable"
))
for
j
in
range
(
nic_num
):
if
i
!=
j
:
session_serial
.
cmd
(
netsh_set_cmd
%
(
ifnames
[
j
],
"disable"
))
time
.
sleep
(
random
.
randint
(
1
,
5
))
index
+=
1
except
aexpect
.
ShellProcessTerminatedError
:
transfer_thread
.
join
(
suppress_exception
=
True
)
raise
else
:
transfer_thread
.
join
()
current_md5
=
crypto
.
hash_file
(
host_path
,
algorithm
=
"md5"
)
logging
.
info
(
"md5 value of data current: %s"
%
current_md5
)
if
original_md5
!=
current_md5
:
test
.
fail
(
"File changed after transfer host -> guest "
"and guest -> host"
)
finally
:
os
.
remove
(
host_path
)
session_serial
.
cmd
(
delete_cmd
%
guest_path
,
timeout
=
login_timeout
,
ignore_all_errors
=
True
)
session_serial
.
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录