1
0
Fork 0

refs #21, disk: fix scheduler reading and applying

This commit is contained in:
Jan Vcelak 2012-11-27 17:11:13 +01:00
parent ee34338cc2
commit 0501e1461e
2 changed files with 10 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import base
from decorators import *
import tuned.logs
import tuned.utils.commands
import os
@ -139,9 +140,14 @@ class DiskPlugin(base.Plugin):
@command_get("elevator")
def _get_elevator(self, device):
# TODO: ticket #21, does not work
sys_file = self._elevator_file(device)
return tuned.utils.commands.read_file(sys_file)
# example of scheduler file content:
# noop deadline [cfq]
schedulers = tuned.utils.commands.read_file(sys_file).split()
for scheduler in schedulers:
if scheduler[0] == "[" and scheduler[-1] == "]":
return scheduler[1:-1]
return schedulers[0]
def _alpm_policy_files(self):
policy_files = []

View file

@ -1,9 +1,10 @@
import tuned.logs
import copy
import os
from subprocess import *
__all__ = ["write_to_file", "read_file", "execute"]
log = tuned.logs.get()
def write_to_file(f, data):