Skip to content

Commit a581470

Browse files
committed
win_virtio_driver_install_by_installer: support viomem test
Add supoport to test viomem related from the installer. Signed-off-by: menli <[email protected]>
1 parent e7bdede commit a581470

4 files changed

+87
-1
lines changed

provider/win_driver_installer_test.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
from avocado.utils import process
88
from virttest import error_context, utils_disk, utils_misc, utils_net
9+
from virttest.utils_misc import normalize_data_size
910

10-
from provider import virtio_fs_utils, win_driver_utils
11+
from provider import virtio_fs_utils, virtio_mem_utils, win_driver_utils
1112
from provider.storage_benchmark import generate_instance
1213
from qemu.tests.virtio_serial_file_transfer import transfer_data
1314

@@ -25,6 +26,7 @@
2526
"netkvm",
2627
"vioinput",
2728
"fwcfg",
29+
"viomem",
2830
]
2931

3032
device_hwid_list = [
@@ -38,6 +40,7 @@
3840
'"PCI\\VEN_1AF4&DEV_1000" "PCI\\VEN_1AF4&DEV_1041"',
3941
'"PCI\\VEN_1AF4&DEV_1052"',
4042
'"ACPI\\VEN_QEMU&DEV_0002"',
43+
r'"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"',
4144
]
4245

4346
device_name_list = [
@@ -51,6 +54,7 @@
5154
"Red Hat VirtIO Ethernet Adapter",
5255
"VirtIO Input Driver",
5356
"QEMU FwCfg Device",
57+
"VirtIO Viomem Driver",
5458
]
5559

5660

@@ -104,6 +108,9 @@ def win_uninstall_all_drivers(session, test, params):
104108
for driver_name, device_name, device_hwid in zip(
105109
driver_name_list, device_name_list, device_hwid_list
106110
):
111+
if params.get("boot_with_viomem", "no") == "no":
112+
if driver_name == "viomem":
113+
continue
107114
win_driver_utils.uninstall_driver(
108115
session, test, devcon_path, driver_name, device_name, device_hwid
109116
)
@@ -414,3 +421,31 @@ def fwcfg_test(test, params, vm):
414421
process.system("rm -rf %s" % dump_file, shell=True)
415422
if dump_size == 0:
416423
test.fail("The dump file is empty")
424+
425+
426+
def viomem_test(test, params, vm):
427+
"""
428+
Grow/shrink virtio-mem device.
429+
430+
:param test: kvm test object.
431+
:param params: the dict used for parameters.
432+
:param vm: vm object.
433+
"""
434+
threshold = params.get_numeric("threshold", target_type=float)
435+
os_type = params["os_type"]
436+
for i, vmem_dev in enumerate(
437+
vm.devices.get_by_params({"driver": "virtio-mem-pci"})
438+
):
439+
device_id = vmem_dev.get_qid()
440+
requested_size_vmem = params.get("requested-size_test_vmem%d" % i)
441+
for requested_size in requested_size_vmem.split():
442+
req_size_normalized = int(float(normalize_data_size(requested_size, "B")))
443+
vm.monitor.qom_set(device_id, "requested-size", req_size_normalized)
444+
time.sleep(30)
445+
# FIXME: workaround the problem that the memory value not accurate
446+
# after shrink/grow the viomem device
447+
if os_type == "windows":
448+
vm.reboot()
449+
virtio_mem_utils.check_memory_devices(
450+
device_id, requested_size, threshold, vm, test
451+
)

qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
gagent_install_cmd = "start /wait %s /quiet"
4646
gagent_pkg_info_cmd = 'wmic product where name="Qemu guest agent"'
4747
gagent_uninstall_cmd = "wmic product where name='Qemu guest agent' call uninstall"
48+
threshold = 0.025
4849
nic_model_nic1 = rtl8139
4950
q35:
5051
nic_model_nic1 = e1000e
@@ -112,6 +113,35 @@
112113
driver_test_name_balloon = "balloon"
113114
iozone_cmd_opitons = " -azR -r 64k -n 512M -g 1G -M -I -i 0 -i 1 -b iozone.xls -f %s:\testfile"
114115
read_rng_cmd = "WIN_UTILS:\\random_%PROCESSOR_ARCHITECTURE%.exe"
116+
x86_64:
117+
# virtio-mem is not supported on 32-bit systems
118+
# and viomem is supported from 1.9.40-0
119+
boot_with_viomem = yes
120+
driver_test_name_viomem = "viomem"
121+
slots_mem = 20
122+
maxmem_mem = 80G
123+
mem_devs = 'mem0 vmem0'
124+
backend_mem_mem0 = memory-backend-file
125+
backend_mem_vmem0 = memory-backend-file
126+
mem-path_mem0 = /dev/shm
127+
mem-path_vmem0 = /dev/shm
128+
guest_numa_nodes = 'node0'
129+
numa_memdev_node0 = mem-mem0
130+
node_memory_vmem0 = "0"
131+
size_mem_mem0 = 4G
132+
use_mem_mem0 = no
133+
vm_memdev_model_vmem0 = "virtio-mem"
134+
size_mem_vmem0 = 8G
135+
requested-size_memory_vmem0 = 1G
136+
memdev_memory_vmem0 = "mem-vmem0"
137+
requested-size_test_vmem0 = "4G 8G 0"
138+
test_drivers += ' viomem'
139+
driver_test_name_viomem = "viomem"
140+
i386:
141+
# mainly to cover win10.i386 test without viomem
142+
boot_with_viomem = no
143+
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:
144+
boot_with_viomem = no
115145
- single_driver:
116146
serials += " vs"
117147
serial_type_vs = virtserialport
@@ -227,6 +257,22 @@
227257
input_dev_bus_type_input1 = virtio
228258
input_dev_type_input1 = keyboard
229259
key_table_file = key_to_keycode_win.json
260+
- with_viomem:
261+
no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8
262+
no i386
263+
required_virtio_win = [1.9.40.0, )
264+
maxmem_mem = 80G
265+
mem_fixed = 4096
266+
mem_devs = 'vmem0'
267+
vm_memdev_model_vmem0 = "virtio-mem"
268+
size_mem_vmem0 = 8G
269+
requested-size_memory_vmem0 = 1G
270+
memdev_memory_vmem0 = "mem-vmem0"
271+
requested-size_test_vmem0 = "4G 8G 0"
272+
driver_name = "viomem"
273+
device_name = "VirtIO Viomem Driver"
274+
device_hwid = '"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"'
275+
driver_test_names = 'viomem'
230276
variants:
231277
- installer_version_check:
232278
only all_drivers

qemu/tests/win_virtio_driver_installer_uninstall.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def run(test, params, env):
9494
"VirtIO FS Device",
9595
"QEMU FwCfg Device",
9696
]
97+
if params.get("boot_with_viomem", "no") == "yes":
98+
device_name_list.append("VirtIO Viomem Driver")
9799
# viostor and vioscsi drivers can not be uninstalled by the installer
98100
for device_name in device_name_list:
99101
chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]

qemu/tests/win_virtio_driver_update_by_installer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def check_network_config(session_serial):
120120
win_driver_installer_test.device_name_list,
121121
win_driver_installer_test.device_hwid_list,
122122
):
123+
if params.get("boot_with_viomem", "no") == "no":
124+
if driver_name == "viomem":
125+
continue
123126
win_driver_utils.install_driver_by_virtio_media(
124127
session, test, devcon_path, media_type, driver_name, device_hwid
125128
)

0 commit comments

Comments
 (0)