diff --git a/virttest/qemu_vm.py b/virttest/qemu_vm.py index 7396174c8c..05e03cde7c 100644 --- a/virttest/qemu_vm.py +++ b/virttest/qemu_vm.py @@ -1092,6 +1092,11 @@ def add_memorys(devices, params): backend_options["size_mem"] = "%sM" % params["mem"] if params.get("vm_mem_backend"): backend_options["backend_mem"] = params.get("vm_mem_backend") + if params.get("vm_mem_backend") == "memory-backend-file": + if not params.get("vm_mem_backend_path"): + raise virt_vm.VMConfigMissingError(self.name, + 'vm_mem_backend_path') + backend_options["mem-path_mem"] = params["vm_mem_backend_path"] if params.get("hugepage_path"): backend_options["backend_mem"] = "memory-backend-file" backend_options["mem-path_mem"] = params["hugepage_path"] diff --git a/virttest/shared/cfg/base.cfg b/virttest/shared/cfg/base.cfg index 846a98f0ed..f4b8832bd7 100644 --- a/virttest/shared/cfg/base.cfg +++ b/virttest/shared/cfg/base.cfg @@ -260,6 +260,9 @@ mem = 1024 # Pattern for check memory size inside guest mem_chk_re_str = ([0-9]+) +# To configure the 'mem-path' for the 'memory-backend' of machine +# vm_mem_backend_path = /dev/shm + # To configure guest backed by hugepages, set it to "yes" # hugepage = "no"