Skip to content

Commit

Permalink
Add new parameter to support changing backend mem path
Browse files Browse the repository at this point in the history
Memory: Add a new parameter "vm_mem_backend_path", this will controls
the "mem-path" in memory object

Signed-off-by: Boqiao Fu <[email protected]>
  • Loading branch information
fbq815 committed Jul 13, 2023
1 parent 6dbcb4b commit 8253461
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,12 @@ 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"]
Expand Down
3 changes: 3 additions & 0 deletions virttest/shared/cfg/base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ mem = 1024
# Pattern for check memory size inside guest
mem_chk_re_str = ([0-9]+)

# To configure the path for the memory backend by vm_mem_backend_path
# vm_mem_backend_path = /dev/shm

# To configure guest backed by hugepages, set it to "yes"
# hugepage = "no"

Expand Down

0 comments on commit 8253461

Please sign in to comment.