Skip to content

Commit bf2cec1

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 bf2cec1

4 files changed

+86
-2
lines changed

provider/win_driver_installer_test.py

+37-1
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
)
@@ -173,6 +180,9 @@ def driver_check(session, test, params):
173180
driver_name_list = [params["driver_name"]]
174181
device_name_list = [params["device_name"]]
175182
for driver_name, device_name in zip(driver_name_list, device_name_list):
183+
if params.get("boot_with_viomem", "no") == "no":
184+
if driver_name == "viomem":
185+
continue
176186
error_context.context("%s Driver Check" % driver_name, LOG_JOB.info)
177187
inf_path = win_driver_utils.get_driver_inf_path(
178188
session, test, media_type, driver_name
@@ -414,3 +424,29 @@ def fwcfg_test(test, params, vm):
414424
process.system("rm -rf %s" % dump_file, shell=True)
415425
if dump_size == 0:
416426
test.fail("The dump file is empty")
427+
428+
429+
def viomem_test(test, params, vm):
430+
"""
431+
Grow/shrink virtio-mem device.
432+
433+
:param test: kvm test object.
434+
:param params: the dict used for parameters.
435+
:param vm: vm object.
436+
"""
437+
threshold = params.get_numeric("threshold", target_type=float)
438+
for i, vmem_dev in enumerate(
439+
vm.devices.get_by_params({"driver": "virtio-mem-pci"})
440+
):
441+
device_id = vmem_dev.get_qid()
442+
requested_size_vmem = params.get("requested-size_test_vmem%d" % i)
443+
for requested_size in requested_size_vmem.split():
444+
req_size_normalized = int(float(normalize_data_size(requested_size, "B")))
445+
vm.monitor.qom_set(device_id, "requested-size", req_size_normalized)
446+
time.sleep(30)
447+
# FIXME: workaround the problem that the memory value not accurate
448+
# after shrink/grow the viomem device
449+
vm.reboot()
450+
virtio_mem_utils.check_memory_devices(
451+
device_id, requested_size, threshold, vm, test
452+
)

qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg

+44-1
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
@@ -94,7 +95,7 @@
9495
mem = 4096
9596
mem_devs = mem1
9697
backend_mem_mem1 = memory-backend-file
97-
mem-path_mem1 = /dev/shm
98+
mem-path_mem1 = /dev/shm/viofs
9899
size_mem1 = 4G
99100
use_mem_mem1 = no
100101
share_mem = yes
@@ -112,6 +113,32 @@
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 += ' vmem0'
124+
backend_mem_vmem0 = memory-backend-file
125+
mem-path_vmem0 = /dev/shm/viomem
126+
guest_numa_nodes = 'node0'
127+
numa_memdev_node0 = mem-mem1
128+
node_memory_vmem0 = "0"
129+
vm_memdev_model_vmem0 = "virtio-mem"
130+
size_mem_vmem0 = 8G
131+
requested-size_memory_vmem0 = 1G
132+
memdev_memory_vmem0 = "mem-vmem0"
133+
requested-size_test_vmem0 = "4G 8G 0"
134+
test_drivers += ' viomem'
135+
driver_test_name_viomem = "viomem"
136+
post_command = "rm -rf ${mem-path_vmem0} ${mem-path_mem1}"
137+
i386:
138+
# mainly to cover win10.i386 test without viomem
139+
boot_with_viomem = no
140+
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:
141+
boot_with_viomem = no
115142
- single_driver:
116143
serials += " vs"
117144
serial_type_vs = virtserialport
@@ -227,6 +254,22 @@
227254
input_dev_bus_type_input1 = virtio
228255
input_dev_type_input1 = keyboard
229256
key_table_file = key_to_keycode_win.json
257+
- with_viomem:
258+
no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8
259+
no i386
260+
required_virtio_win = [1.9.40.0, )
261+
maxmem_mem = 80G
262+
mem_fixed = 4096
263+
mem_devs = 'vmem0'
264+
vm_memdev_model_vmem0 = "virtio-mem"
265+
size_mem_vmem0 = 8G
266+
requested-size_memory_vmem0 = 1G
267+
memdev_memory_vmem0 = "mem-vmem0"
268+
requested-size_test_vmem0 = "4G 8G 0"
269+
driver_name = "viomem"
270+
device_name = "VirtIO Viomem Driver"
271+
device_hwid = '"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"'
272+
driver_test_names = 'viomem'
230273
variants:
231274
- installer_version_check:
232275
only all_drivers

qemu/tests/win_virtio_driver_installer_uninstall.py

+2
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

+3
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)