diff --git a/deps/speedtest/speedtest.exe b/deps/speedtest/speedtest.exe new file mode 100644 index 0000000000..a94c51efe7 Binary files /dev/null and b/deps/speedtest/speedtest.exe differ diff --git a/libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg b/libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg new file mode 100644 index 0000000000..d3d9fbdc19 --- /dev/null +++ b/libvirt/tests/cfg/virtual_network/qemu/netkvm_rss_test.cfg @@ -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" diff --git a/libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py b/libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py new file mode 100644 index 0000000000..ae330524d1 --- /dev/null +++ b/libvirt/tests/src/virtual_network/qemu/netkvm_rss_test.py @@ -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)