From 8fc07cfcd4f9920a4de41919e9fca8b2f608802b Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Fri, 18 Nov 2011 10:34:52 +0400 Subject: [PATCH] Add --scheduler option. --- man/cl-install.1 | 5 +++++ man/ru/cl-install.1 | 5 +++++ pym/cl_fill_install.py | 15 +++++++++++++-- pym/cl_install_cmd.py | 15 +++++++++++++++ pym/cl_vars_install.py | 3 +++ 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/man/cl-install.1 b/man/cl-install.1 index f2ddcee..229116e 100644 --- a/man/cl-install.1 +++ b/man/cl-install.1 @@ -135,6 +135,11 @@ Changes Xorg server resolution. Changes frame buffer resolution. .RE .PP +\fB\-\-scheduler\fR \fISCHEDULER\fR +.RS 4 +Changes I/O scheduler. +.RE +.PP \fB\-\-timezone\fR \fITIMEZONE\fR .RS 4 Changes timezone. diff --git a/man/ru/cl-install.1 b/man/ru/cl-install.1 index 6aeb790..a619a81 100644 --- a/man/ru/cl-install.1 +++ b/man/ru/cl-install.1 @@ -130,6 +130,11 @@ IPv4 адрес сети с указанием CIDR. IFACE может обозн Изменить разрешение для frame buffer. .RE .PP +\fB\-\-scheduler\fR \fISCHEDULER\fR +.RS 4 +Изменить I/O планировщик. +.RE +.PP \fB\-\-timezone\fR \fITIMEZONE\fR .RS 4 Изменить часовой пояс. diff --git a/pym/cl_fill_install.py b/pym/cl_fill_install.py index 0e2c057..a1e45d2 100644 --- a/pym/cl_fill_install.py +++ b/pym/cl_fill_install.py @@ -29,7 +29,7 @@ from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\ FStab, lspci, getInstalledVideo,getDeviceType, \ getPartitionType, getOsProberHash, getProgPath, \ getRaidPartitions, getLvmPartitions, getLvmGroups, \ - getPasswdUsers + getPasswdUsers, readFile from cl_distr import DistributiveRepository,PartitionDistributive from cl_fill import clLocale from operator import itemgetter @@ -732,7 +732,7 @@ class fillVars(object, glob_attr): root_dev = filter(lambda x: x in root_dev, self.Get('os_device_dev')) if root_dev: - root_dev = root_dev[0] + root_dev = root_dev[0].rpartition('/')[2] pathScheduler = '/sys/block/%s/queue/scheduler'%root_dev if access(pathScheduler,R_OK): res = re.search("\[([^\]]+)\]", @@ -741,6 +741,17 @@ class fillVars(object, glob_attr): return res.groups()[0] return "cfq" + def get_os_kernel_schedulers(self): + + """Get scheduler for install root device""" + root_dev = self.Get('os_device_dev') + if root_dev: + root_dev = root_dev[0].rpartition('/')[2] + pathScheduler = '/sys/block/%s/queue/scheduler'%root_dev + return map(lambda x:x.strip("[]"), + readFile(pathScheduler).strip().split()) + return [] + def get_os_install_lvm_set(self): """Using lvm""" lvm = filter(lambda x:x[1] != '' and "lvm" in x[0], diff --git a/pym/cl_install_cmd.py b/pym/cl_install_cmd.py index 7706961..20b6cbf 100644 --- a/pym/cl_install_cmd.py +++ b/pym/cl_install_cmd.py @@ -145,6 +145,10 @@ CMD_OPTIONS = [{'shortOption':"d", 'optVal':"x", 'help':_("set frame buffer resolution") }, + {'longOption':"scheduler", + 'optVal':"SCHEDULER", + 'help':_("set I/O scheduler") + }, {'longOption':"timezone", 'optVal':"TIMEZONE", 'help':_("set the timezone") @@ -315,6 +319,17 @@ class install_cmd(share_cmd): value=route, example="default:192.168.1.1")) # if system installation + if values.scheduler: + if not values.scheduler in \ + self.logicObj.clVars.Get('os_kernel_schedulers'): + self.optobj.error(self.errorWithExample.format( + optname="--scheduler", + errormess=_("%s specifing error")%"scheduler", + value=values.scheduler, + example="deadline")) + else: + self.logicObj.clVars.Set('os_install_kernel_scheduler', + values.scheduler,force=True) if not (values.install or values.uninstall or values.startup or values.live): if values.v is False and \ diff --git a/pym/cl_vars_install.py b/pym/cl_vars_install.py index 8d7f59d..1ebc6f8 100644 --- a/pym/cl_vars_install.py +++ b/pym/cl_vars_install.py @@ -155,6 +155,9 @@ class Data: # install scheduler os_install_kernel_scheduler = {} + # list of schedulers + os_kernel_schedulers = {} + # install kernel attributes os_install_kernel_attr = {}