aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2016-11-15 14:47:38 +0100
committerPeter Mikus <pmikus@cisco.com>2016-11-16 08:38:16 +0000
commitb0eaa32dce87ccb8749b227066b26ae9bc66cace (patch)
tree49285844586f1f991a752f456de3558cf3c0f096 /resources/libraries/python
parent7a0a0ec3986ad03444cd4864ae8d35019007be60 (diff)
CSIT-470 Add option to configure CFS scheduler priority for QEMU
Add option to configure CFS scheduler priority for QEMU Change-Id: I76da7f536e70a23a57cf5215ab60002f95532b19 Signed-off-by: pmikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/QemuUtils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py
index 76f86063e2..cfdbc7ffa4 100644
--- a/resources/libraries/python/QemuUtils.py
+++ b/resources/libraries/python/QemuUtils.py
@@ -149,6 +149,22 @@ class QemuUtils(object):
raise RuntimeError('Set affinity failed on {0}'.format(
self._node['host']))
+ def qemu_set_scheduler_policy(self):
+ """Set scheduler policy to SCHED_RR with priority 1 for all Qemu CPU
+ processes.
+
+ :raises RuntimeError: Set scheduler policy failed.
+ """
+ qemu_cpus = self._qemu_qmp_exec('query-cpus')['return']
+
+ for qemu_cpu in qemu_cpus:
+ cmd = 'chrt -r -p 1 {0}'.format(qemu_cpu['thread_id'])
+ (ret_code, _, stderr) = self._ssh.exec_command_sudo(cmd)
+ if int(ret_code) != 0:
+ logger.debug('Set SCHED_RR failed {0}'.format(stderr))
+ raise RuntimeError('Set SCHED_RR failed on {0}'.format(
+ self._node['host']))
+
def qemu_set_node(self, node):
"""Set node to run QEMU on.