From e9fcd4525ddab44890ab58ab347dadddc6f8105e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Thu, 31 May 2018 14:48:32 +0200 Subject: [PATCH] Fix storage access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ondřej Lysoněk --- tuned/plugins/plugin_scheduler.py | 9 ++++++--- tuned/plugins/plugin_sysctl.py | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tuned/plugins/plugin_scheduler.py b/tuned/plugins/plugin_scheduler.py index 6905bd1..e06a5f3 100644 --- a/tuned/plugins/plugin_scheduler.py +++ b/tuned/plugins/plugin_scheduler.py @@ -269,7 +269,8 @@ class SchedulerPlugin(base.Plugin): #vals[0] - process name, vals[1] - rule prio, vals[2] - sched, vals[3] - prio, vals[4] - affinity, #vals[5] - regex self._tune_process(instance, pid, vals[0], vals[2], vals[3], vals[4]) - self._storage.set("options", instance._scheduler_original) + storage_key = self._scheduler_storage_key(instance) + self._storage.set(storage_key, instance._scheduler_original) if self._daemon and instance._runtime_tuning: instance._thread = threading.Thread(target = self._thread_code, args = [instance]) instance._thread.start() @@ -304,13 +305,15 @@ class SchedulerPlugin(base.Plugin): log.debug("tuning new process '%s' with pid '%s' by '%s'" % (cmd, pid, str(v))) #v[0] - sched, v[1] - prio, v[2] - affinity self._tune_process(instance, pid, cmd, v[0], v[1], v[2], no_error = True) - self._storage.set("options", instance._scheduler_original) + storage_key = self._scheduler_storage_key(instance) + self._storage.set(storage_key, instance._scheduler_original) def _remove_pid(self, instance, pid): if pid in instance._scheduler_original: del instance._scheduler_original[pid] log.debug("removed PID %s from the rollback database" % pid) - self._storage.set("options", instance._scheduler_original) + storage_key = self._scheduler_storage_key(instance) + self._storage.set(storage_key, instance._scheduler_original) def _thread_code(self, instance): r = self._cmd.re_lookup_compile(instance._sched_lookup) diff --git a/tuned/plugins/plugin_sysctl.py b/tuned/plugins/plugin_sysctl.py index f98332b..18e419a 100644 --- a/tuned/plugins/plugin_sysctl.py +++ b/tuned/plugins/plugin_sysctl.py @@ -46,7 +46,8 @@ class SysctlPlugin(base.Plugin): instance._sysctl_original[option] = original_value self._write_sysctl(option, self._process_assignment_modifiers(self._variables.expand(self._cmd.unquote(value)), original_value)) - self._storage.set("options", instance._sysctl_original) + storage_key = self._sysctl_storage_key(instance) + self._storage.set(storage_key, instance._sysctl_original) if self._global_cfg.get_bool(consts.CFG_REAPPLY_SYSCTL, consts.CFG_DEF_REAPPLY_SYSCTL): log.info("reapplying system sysctl")