Skip to content

Commit

Permalink
Decoupling memory-backend and hugepage
Browse files Browse the repository at this point in the history
Memory: fix memory-backend cannot change if there's no hugepage when
vm_mem_backend is "memory-backend_file"

Signed-off-by: Boqiao Fu <[email protected]>
  • Loading branch information
fbq815 committed Jun 30, 2023
1 parent 6dbcb4b commit 183b6a2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,15 @@ def add_memorys(devices, params):
name = output[0]
backend_options = {}
backend_options["size_mem"] = "%sM" % params["mem"]
if params.get("vm_mem_backend"):
backend_options["backend_mem"] = params.get("vm_mem_backend")
mem_backend = params.get("vm_mem_backend")
if mem_backend:
backend_options["backend_mem"] = params["vm_mem_backend"]
if mem_backend == "memory-backend-file":
if params.get("vm_mem_backend_path") == "":
raise virt_vm.VMDeviceError("Expect vm_mem_backend_path")
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

0 comments on commit 183b6a2

Please sign in to comment.