diff --git a/libvirt/tests/cfg/svirt/umask_value/svirt_umask_files_accessed_by_qemu.cfg b/libvirt/tests/cfg/svirt/umask_value/svirt_umask_files_accessed_by_qemu.cfg index fed7c58651..f38ae0a6af 100644 --- a/libvirt/tests/cfg/svirt/umask_value/svirt_umask_files_accessed_by_qemu.cfg +++ b/libvirt/tests/cfg/svirt/umask_value/svirt_umask_files_accessed_by_qemu.cfg @@ -3,8 +3,5 @@ start_vm = "no" umask_value = '027' mem_backing_attrs = {'hugepages': {}} - target_hugepages = 1024 - aarch64: - target_hugepages = 4 s390-virtio: kvm_module_parameters = "hpage=1" diff --git a/libvirt/tests/src/svirt/umask_value/svirt_umask_files_accessed_by_qemu.py b/libvirt/tests/src/svirt/umask_value/svirt_umask_files_accessed_by_qemu.py index cab63676bc..0aaceab9c3 100644 --- a/libvirt/tests/src/svirt/umask_value/svirt_umask_files_accessed_by_qemu.py +++ b/libvirt/tests/src/svirt/umask_value/svirt_umask_files_accessed_by_qemu.py @@ -7,6 +7,7 @@ from virttest import utils_libvirtd from virttest.libvirt_xml import vm_xml from virttest.libvirt_xml.vm_xml import VMXML +from avocado.utils import memory as avocado_mem def run(test, params, env): @@ -30,6 +31,13 @@ def run(test, params, env): if os.path.exists(hp_path): shutil.rmtree(hp_path) utils_libvirtd.Libvirtd().restart() + + # calculate the target_hugepage from VM memory and actual HP size + actual_hp_size = avocado_mem.get_huge_page_size() + target_hugepages = int(vmxml.memory / actual_hp_size) + params["target_hugepages"] = target_hugepages + test.log.debug(f"Requred VM memory {vmxml.memory}, calculated tareget_hugepages: {target_hugepages}") + hp_cfg = test_setup.HugePageConfig(params) hp_cfg.set_hugepages()