Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- virtual_network.qemu_test.netkvm_rss_test: image_copy
type = netkvm_rss_test
only Windows
only virtio_net
create_vm_libvirt = yes
kill_vm_libvirt = yes
ovmf:
kill_vm_libvirt_options = --nvram
master_images_clone = img1
remove_image_image1 = yes
smp = 4
vcpu_maxcpus = ${smp}
vcpu_dies = 1
vcpu_cores = 1
vcpu_sockets = ${smp}
win_max_vcpu_sockets = ${smp}
vcpu_threads = 1
queues_nic1 = ${smp}
vectors = 10
set_adapterrss_cmd = 'powershell -command "Set-NetAdapterRss -Name \"%s\" -NumberOfReceiveQueues ${vcpu_cores} -MaxProcessors ${vcpu_cores} -Profile Conservative"'
dst_path = "C:\Speedtest"
speedtest_path_cmd = "cd ${dst_path}\speedtest"
set_license_cmd = "speedtest --accept-license"
start_test_cmd = ".\speedtest.exe"
60 changes: 60 additions & 0 deletions libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from virttest import data_dir
from virttest import utils_net
from virttest.libvirt_xml import vm_xml


def run(test, params, env):
"""
Test net adapter after set NetAdapterrss, this case will:

1) boot up guest
2) set NetAdapterrss
3) use speedtest trigger some network traffic

:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environmen.
"""

def execute_command(command, timeout=60, omit=False):
"""
Execute command and return the output
"""
test.log.info("Sending command: %s", command)
status, output = session.cmd_status_output(command, timeout)
if status != 0 and omit is False:
test.error("execute command fail: %s" % output)
return output

vm = env.get_vm(params["main_vm"])
vm.verify_alive()
test.log.debug("vm xml:\n%s", vm_xml.VMXML.new_from_dumpxml(vm.name))
session = vm.wait_for_serial_login(timeout=360)

# Copy speedtest to guest
speedtest_host_path = data_dir.get_deps_dir("speedtest")
dst_path = params["dst_path"]
test.log.info("Copy Speedtest to guest.")
s, o = session.cmd_status_output("mkdir %s" % dst_path)
if s and "already exists" not in o:
test.error(
"Could not create Speedtest directory in "
"VM '%s', detail: '%s'" % (vm.name, o)
)
vm.copy_files_to(speedtest_host_path, dst_path)

# set up adapterrss in guest
mac = vm.get_mac_address()
ifname = utils_net.get_windows_nic_attribute(session, "macaddress", mac, "netconnectionid")
set_adapterrss_cmd = params["set_adapterrss_cmd"]
execute_command(set_adapterrss_cmd % ifname)

# start test with speedtest
speedtest_path_cmd = params["speedtest_path_cmd"]
set_license_cmd = params["set_license_cmd"]
start_test_cmd = params["start_test_cmd"]
execute_command(speedtest_path_cmd)
execute_command(set_license_cmd, omit=True)
for _i in range(10):
output = execute_command(start_test_cmd, omit=True)
test.log.info(output)