Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_virtio_driver_install_by_installer: support viomem test #4234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
40 changes: 39 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 @@ -173,6 +180,9 @@ def driver_check(session, test, params):
driver_name_list = [params["driver_name"]]
device_name_list = [params["device_name"]]
for driver_name, device_name in zip(driver_name_list, device_name_list):
if params.get("boot_with_viomem", "no") == "no":
if driver_name == "viomem":
continue
error_context.context("%s Driver Check" % driver_name, LOG_JOB.info)
inf_path = win_driver_utils.get_driver_inf_path(
session, test, media_type, driver_name
Expand Down Expand Up @@ -414,3 +424,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
)
44 changes: 43 additions & 1 deletion 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 @@ -94,7 +95,7 @@
mem = 4096
mem_devs = mem1
backend_mem_mem1 = memory-backend-file
mem-path_mem1 = /dev/shm
mem-path_mem1 = /dev/shm/viofs
size_mem1 = 4G
use_mem_mem1 = no
share_mem = yes
Expand All @@ -112,6 +113,31 @@
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 += ' vmem0'
backend_mem_vmem0 = memory-backend-file
mem-path_vmem0 = /dev/shm/viomem
guest_numa_nodes = 'node0'
numa_memdev_node0 = mem-mem1
node_memory_vmem0 = "0"
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:
menli820 marked this conversation as resolved.
Show resolved Hide resolved
boot_with_viomem = no
menli820 marked this conversation as resolved.
Show resolved Hide resolved
- single_driver:
serials += " vs"
serial_type_vs = virtserialport
Expand Down Expand Up @@ -227,6 +253,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
Loading