Skip to content

Commit

Permalink
win_virtio_driver_install_by_installer: support viomem test
Browse files Browse the repository at this point in the history
Add supoport to test viomem related from
the installer.

Signed-off-by: menli <[email protected]>
  • Loading branch information
menli820 committed Jan 15, 2025
1 parent e7bdede commit a581470
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1 deletion.
37 changes: 36 additions & 1 deletion provider/win_driver_installer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -25,6 +26,7 @@
"netkvm",
"vioinput",
"fwcfg",
"viomem",
]

device_hwid_list = [
Expand All @@ -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 = [
Expand All @@ -51,6 +54,7 @@
"Red Hat VirtIO Ethernet Adapter",
"VirtIO Input Driver",
"QEMU FwCfg Device",
"VirtIO Viomem Driver",
]


Expand Down Expand Up @@ -104,6 +108,9 @@ def win_uninstall_all_drivers(session, test, params):
for driver_name, device_name, device_hwid in zip(
driver_name_list, device_name_list, device_hwid_list
):
if params.get("boot_with_viomem", "no") == "no":
if driver_name == "viomem":
continue
win_driver_utils.uninstall_driver(
session, test, devcon_path, driver_name, device_name, device_hwid
)
Expand Down Expand Up @@ -414,3 +421,31 @@ 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)
os_type = params["os_type"]
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)
# FIXME: workaround the problem that the memory value not accurate
# after shrink/grow the viomem device
if os_type == "windows":
vm.reboot()
virtio_mem_utils.check_memory_devices(
device_id, requested_size, threshold, vm, test
)
46 changes: 46 additions & 0 deletions qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -112,6 +113,35 @@
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 1.9.40-0
boot_with_viomem = yes
driver_test_name_viomem = "viomem"
slots_mem = 20
maxmem_mem = 80G
mem_devs = 'mem0 vmem0'
backend_mem_mem0 = memory-backend-file
backend_mem_vmem0 = memory-backend-file
mem-path_mem0 = /dev/shm
mem-path_vmem0 = /dev/shm
guest_numa_nodes = 'node0'
numa_memdev_node0 = mem-mem0
node_memory_vmem0 = "0"
size_mem_mem0 = 4G
use_mem_mem0 = no
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
Expand Down Expand Up @@ -227,6 +257,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
Expand Down
2 changes: 2 additions & 0 deletions qemu/tests/win_virtio_driver_installer_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions qemu/tests/win_virtio_driver_update_by_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 params.get("boot_with_viomem", "no") == "no":
if driver_name == "viomem":
continue
win_driver_utils.install_driver_by_virtio_media(
session, test, devcon_path, media_type, driver_name, device_hwid
)
Expand Down

0 comments on commit a581470

Please sign in to comment.