Skip to content

Commit

Permalink
Merge pull request avocado-framework#3756 from mcasquer/2224513_sandb…
Browse files Browse the repository at this point in the history
…ox_options_support

qemu_vm: includes support for all sandbox options
  • Loading branch information
YongxueHong authored Sep 15, 2023
2 parents 7d5d9b0 + 4943e0a commit 1809ad6
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,21 @@ def add_name(name):
return " -name '%s'" % name

def process_sandbox(devices, action):
sandbox_option = ""
if not devices.has_option("sandbox"):
return sandbox_option
if action == "add":
if devices.has_option("sandbox"):
return " -sandbox on "
sandbox_option = " -sandbox on"
elif action == "rem":
if devices.has_option("sandbox"):
return " -sandbox off "
sandbox_option = " -sandbox off"
_params = {"elevateprivileges": params.get("qemu_sandbox_elevateprivileges"),
"obsolete": params.get("qemu_sandbox_obsolete"),
"resourcecontrol": params.get("qemu_sandbox_resourcecontrol"),
"spawn": params.get("qemu_sandbox_spawn")}
for opt, val in _params.items():
if val is not None:
sandbox_option += f",{opt}={val}"
return sandbox_option

def add_human_monitor(devices, monitor_name, filename):
if not devices.has_option("chardev"):
Expand Down Expand Up @@ -1681,7 +1690,7 @@ def add_secure_guest_descriptor(params):
devices.insert(StrDev('preconfig', cmdline="--preconfig"))
# Add the VM's name
devices.insert(StrDev('vmname', cmdline=add_name(name)))

# Add sandbox option
qemu_sandbox = params.get("qemu_sandbox")
if qemu_sandbox == "on":
devices.insert(
Expand Down

0 comments on commit 1809ad6

Please sign in to comment.