Skip to content

Commit

Permalink
Decoupling memory-backend and hugepage
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 and will be replaced by hugepage_path

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

# this parameter controls the value of "mem-path" in memory-backend object
# it will be replaced by "hugepage_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 78fdebb

Please sign in to comment.