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 19, 2023
1 parent e20d6f4 commit 85915c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
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 @@ -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"

Expand Down

0 comments on commit 85915c0

Please sign in to comment.