Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread-context: support new object thread-context #3726

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions virttest/qemu_devices/qcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2896,6 +2896,20 @@ def throttle_group_define_by_params(self, group_params, name):
props = json.loads(group_params.get("throttle_group_parameters", "{}"))
return QThrottleGroup(name, props)

def thread_context_define_by_params(self, params, name):
"""
Create thread-context object from params.
"""
tc_params = Params()
prefix = 'vm_thread_context_'
for key in params:
if key.startswith(prefix):
new_key = key.rsplit(prefix)[1]
tc_params[new_key] = params[key]
dev = qdevices.QObject("thread-context", params=tc_params)
dev.set_param("id", "%s-%s" % ("thread_context", name))
mcasquer marked this conversation as resolved.
Show resolved Hide resolved
return dev

def memory_object_define_by_params(self, params, name):
"""
Create memory object from params, default backend type is
Expand Down
12 changes: 12 additions & 0 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,15 @@ def set_value(opt_string, key, fallback=None):

return secret_cmdline + " -spice %s" % (",".join(spice_opts))

def add_thread_context(devices, params):
for thread_context in params.objects("vm_thread_contexts"):
thread_context_params = params.object_params(thread_context)
dev = devices.thread_context_define_by_params(thread_context_params, thread_context)
set_cmdline_format_by_cfg(dev, self._get_cmdline_format_cfg(),
"thread_contexts")
devices.insert(dev)
return devices

def add_qxl(qxl_nr, base_addr=29):
"""
adds extra qxl devices
Expand Down Expand Up @@ -1766,6 +1775,9 @@ def add_secure_guest_descriptor(params):
add_memorys(devices, params)
mem = int(params.get("mem", 0))

# Add thread context object
add_thread_context(devices, params)

# Get cpu model, before add smp, to determine cpu topology
cpu_model = params.get("cpu_model", "")
use_default_cpu_model = True
Expand Down
Loading