From 6eab70e4bceab1ddd3ca0f5c3a5539221abdf84e Mon Sep 17 00:00:00 2001 From: menli Date: Tue, 17 Dec 2024 10:18:25 +0800 Subject: [PATCH] win_virtio_driver_install_by_installer: support viomem test Add supoport to test viomem related from the installer. Signed-off-by: menli --- provider/win_driver_installer_test.py | 34 ++++++++++++++- ...win_virtio_driver_install_by_installer.cfg | 41 +++++++++++++++++-- .../win_virtio_driver_installer_uninstall.py | 2 + .../win_virtio_driver_update_by_installer.py | 3 ++ 4 files changed, 75 insertions(+), 5 deletions(-) diff --git a/provider/win_driver_installer_test.py b/provider/win_driver_installer_test.py index 9b033a6e64..ea5cc14c3b 100644 --- a/provider/win_driver_installer_test.py +++ b/provider/win_driver_installer_test.py @@ -6,8 +6,9 @@ from avocado.utils import process from virttest import error_context, utils_disk, utils_misc, utils_net +from virttest.utils_misc import normalize_data_size -from provider import virtio_fs_utils, win_driver_utils +from provider import virtio_fs_utils, virtio_mem_utils, win_driver_utils from provider.storage_benchmark import generate_instance from qemu.tests.virtio_serial_file_transfer import transfer_data @@ -25,6 +26,7 @@ "netkvm", "vioinput", "fwcfg", + "viomem", ] device_hwid_list = [ @@ -38,6 +40,7 @@ '"PCI\\VEN_1AF4&DEV_1000" "PCI\\VEN_1AF4&DEV_1041"', '"PCI\\VEN_1AF4&DEV_1052"', '"ACPI\\VEN_QEMU&DEV_0002"', + r'"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"', ] device_name_list = [ @@ -51,6 +54,7 @@ "Red Hat VirtIO Ethernet Adapter", "VirtIO Input Driver", "QEMU FwCfg Device", + "VirtIO Viomem Driver", ] @@ -100,6 +104,10 @@ def win_uninstall_all_drivers(session, test, params): :param test: kvm test object :param params: the dict used for parameters. """ + if not params.get("boot_with_viomem"): + driver_name_list.remove("viomem") + device_hwid_list.remove(r'"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"') + device_name_list.remove("VirtIO Viomem Driver") devcon_path = params["devcon_path"] for driver_name, device_name, device_hwid in zip( driver_name_list, device_name_list, device_hwid_list @@ -414,3 +422,27 @@ def fwcfg_test(test, params, vm): process.system("rm -rf %s" % dump_file, shell=True) if dump_size == 0: test.fail("The dump file is empty") + + +def viomem_test(test, params, vm): + """ + Grow/shrink virtio-mem device. + + :param test: kvm test object. + :param params: the dict used for parameters. + :param vm: vm object. + """ + threshold = params.get_numeric("threshold", target_type=float) + for i, vmem_dev in enumerate( + vm.devices.get_by_params({"driver": "virtio-mem-pci"}) + ): + device_id = vmem_dev.get_qid() + requested_size_vmem = params.get("requested-size_test_vmem%d" % i) + + for requested_size in requested_size_vmem.split(): + req_size_normalized = int(float(normalize_data_size(requested_size, "B"))) + vm.monitor.qom_set(device_id, "requested-size", req_size_normalized) + time.sleep(30) + virtio_mem_utils.check_memory_devices( + device_id, requested_size, threshold, vm, test + ) diff --git a/qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg b/qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg index b86c8b0b42..2f7e83a91e 100644 --- a/qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg +++ b/qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg @@ -45,6 +45,7 @@ gagent_install_cmd = "start /wait %s /quiet" gagent_pkg_info_cmd = 'wmic product where name="Qemu guest agent"' gagent_uninstall_cmd = "wmic product where name='Qemu guest agent' call uninstall" + threshold = 0.025 nic_model_nic1 = rtl8139 q35: nic_model_nic1 = e1000e @@ -97,10 +98,7 @@ mem-path_mem1 = /dev/shm size_mem1 = 4G use_mem_mem1 = no - share_mem = yes - guest_numa_nodes = shm0 - numa_memdev_shm0 = mem-mem1 - numa_nodeid_shm0 = 0 + vm_mem_share = yes fs_binary_extra_options = " -o cache=auto" test_drivers = 'balloon viostor vioscsi viorng viofs' driver_test_name_viorng = 'rng' @@ -112,6 +110,25 @@ driver_test_name_balloon = "balloon" iozone_cmd_opitons = " -azR -r 64k -n 512M -g 1G -M -I -i 0 -i 1 -b iozone.xls -f %s:\testfile" read_rng_cmd = "WIN_UTILS:\\random_%PROCESSOR_ARCHITECTURE%.exe" + x86_64: + # virtio-mem is not supported on 32-bit systems + # and viomem is supported from virtio-win-1.9.40-0.el9_4.iso + boot_with_viomem = yes + driver_test_name_viomem = "viomem" + maxmem_mem = 80G + mem_devs = 'vmem0' + vm_memdev_model_vmem0 = "virtio-mem" + size_mem_vmem0 = 8G + requested-size_memory_vmem0 = 1G + memdev_memory_vmem0 = "mem-vmem0" + requested-size_test_vmem0 = "4G 8G 0" + test_drivers += ' viomem' + driver_test_name_viomem = "viomem" + i386: + # mainly to cover win10.i386 test without viomem + boot_with_viomem = no + Host_RHEL.m7, Host_RHEL.m8, Host_RHEL.m9.u0, Host_RHEL.m9.u1, Host_RHEL.m9.u2, Host_RHEL.m9.u3, Host_RHEL.m9.u4: + boot_with_viomem = no - single_driver: serials += " vs" serial_type_vs = virtserialport @@ -227,6 +244,22 @@ input_dev_bus_type_input1 = virtio input_dev_type_input1 = keyboard key_table_file = key_to_keycode_win.json + - with_viomem: + no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8 + no i386 + required_virtio_win = [1.9.40.0, ) + maxmem_mem = 80G + mem_fixed = 4096 + mem_devs = 'vmem0' + vm_memdev_model_vmem0 = "virtio-mem" + size_mem_vmem0 = 8G + requested-size_memory_vmem0 = 1G + memdev_memory_vmem0 = "mem-vmem0" + requested-size_test_vmem0 = "4G 8G 0" + driver_name = "viomem" + device_name = "VirtIO Viomem Driver" + device_hwid = '"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"' + driver_test_names = 'viomem' variants: - installer_version_check: only all_drivers diff --git a/qemu/tests/win_virtio_driver_installer_uninstall.py b/qemu/tests/win_virtio_driver_installer_uninstall.py index d4464e5faa..1496ca8ae5 100644 --- a/qemu/tests/win_virtio_driver_installer_uninstall.py +++ b/qemu/tests/win_virtio_driver_installer_uninstall.py @@ -94,6 +94,8 @@ def run(test, params, env): "VirtIO FS Device", "QEMU FwCfg Device", ] + if params.get("boot_with_viomem", "no") == "yes": + device_name_list.append("VirtIO Viomem Driver") # viostor and vioscsi drivers can not be uninstalled by the installer for device_name in device_name_list: chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30] diff --git a/qemu/tests/win_virtio_driver_update_by_installer.py b/qemu/tests/win_virtio_driver_update_by_installer.py index ae01e925fb..f4f5b16537 100644 --- a/qemu/tests/win_virtio_driver_update_by_installer.py +++ b/qemu/tests/win_virtio_driver_update_by_installer.py @@ -120,6 +120,9 @@ def check_network_config(session_serial): win_driver_installer_test.device_name_list, win_driver_installer_test.device_hwid_list, ): + if not params.get("boot_with_viomem"): + if driver_name == "viomem": + continue win_driver_utils.install_driver_by_virtio_media( session, test, devcon_path, media_type, driver_name, device_hwid )