If there is no hdparm command it now outputs warning to the log, disables
all hdparm related commands and no hdparm execution error is output.
Related: rhbz#1191775
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This allows runnig helper scripts from the main script by just using
the current directory './' path, e.g. to run helper_script from main script:
./helper_script
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
There is continuous integration Jenkins bind to the scratch builds.
By running scratch build during the nightly build all tests will be
run by Jenkins.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Example of recommend.conf content:
[powersave]
/etc/machine.conf=.*laptop.*
This will recommend powersave profile if there is /etc/machine.conf containing
string 'laptop'. The check will not match if the file doesn't exist.
To just check for file existence:
[powersave]
/etc/machine.conf=.*
This will match if there is /etc/machine.conf file.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
On some platforms the 'recommend' functionality doens't make sense
as there is only one product variant. On such platforms the recommend
functionality can be disabled by adding/changing the following in
the global config (/etc/tuned/tuned-main.conf):
recommend_command = 0
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
If there is no scaling governor/driver, the CPU is silently skipped when setting
governor.
Related: rhbz#1212836
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
It converts CPU list to hexadecimal CPU mask and inverts it.
Example:
[variables]
cpus = ${f:cpulist2hex_invert:1-2}
On machine with four CPUs it returns 00000009.
Related: rhbz#1225135
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
It's possible to combine CPU lists with hexmasks, but hexmask needs to be
prefixed by "0x". Hexmasks can include commas. To separate hexmask from
CPU list use double comma ',,' (there can be whitespaces between commas)
Example:
[variables]
cpus = ${f:cpulist_unpack:1-2,0x8,ffffffff,,37-39}
It's also possible to separate hexmasks and CPU list by specifying
CPU list as another argument, e.g.:
[variables]
cpus = ${f:cpulist_unpack:1-2,0x8,ffffffff:37-39}
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Now CPUs starting with 0x are taken as hexmask. As cpulist_unpack
is used as preprocessor of CPU list for other built-in functions
this also works with other functions (e.g. cpulist_invert).
Example:
[variables]
cpus = ${f:cpulist_invert:1-2,0x8}
On four CPU machines (CPUs 0-3) it expands to '0'.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Inverts list of CPUs (makes its complement). For the complement it
gets number of present CPUs from the /sys/devices/system/cpu/present,
e.g. system with 4 CPUs (0-3), the inversion of list "0,2,3" will be "1".
Related: rhbz#1225135
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Now it operates over CPU sets parsed from /sys/devices/system/cpu/online
and it no more checks each CPU from the list individually for its online
status.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Usage:
[variables]
cpus = ${f:cpulist_unpack:1,2,3-5}
The 'cpus' will be set to '1,2,3,4,5'. Also the built-in function can take
arbitrary number of arguments which will be concatenated, e.g.:
[variables]
cpus = ${f:cpulist_unpack:1-3,5:6-7,9}
This means two arguments to 'cpulist_unpack' function. The first argument:
'1-3,5' and the second '6-7,9'. The result: '1,2,3,5,6,7,9'.
Also renamed internal function 'unpack_cpulist' to 'cpulist_unpack' to be
more consistent.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Added following functions:
cpulist2hex - converts CPU list to hexadecimal mask, takes arbitrary number of
arguments, each argument can also contain "compact values",
e.g.: "${f:cpulist2hex:0-3,4:5-6}".
hex2cpulist - converts hexadecimal mask to CPU list, takes one argument,
the hexadecimal mask.
cpus_online - checks whether CPUs from the list (which is formatted the same
way as with cpulist2hex) are online, returns only those which
are online.
Example:
[variables]
cpus = ${f:hex2cpulist:0x0000001f}
online = ${f:cpus_online:${cpus}}
Related: rhbz#1225135
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Built-in functions are defined as plugins in tuned/profiles/functions.
Each function (plugin) is python code named function_NAME.py, where
NAME is the name of the built-in function defined. For example
how to implement own function see provided functions.
Functions are expanded in tuned profile configuration file during profile
load. Functions are expanded after variables. The syntax for function call is
${f:NAME:ARG1:ARG2...}. The function NAME will be called and it's result
substituted. It is possible to escape $ by \$ and : by \:. Functions are
loaded and executed on demand. Function which is once loaded during profile
application is not reloaded on multiple executions. Variables
in profile arguments are supported, but function calls aren't.
The following functions have been implemented so far:
exec:ARG1:...:ARGN - execute external command with arguments and subtitute
its output.
kb2s:ARG - converts kbytes specified as ARG to sectors.
s2kb:ARG - converts sectors specified as ARG to kbytes.
Example:
[variables]
cmd = date
curr_date = ${f:exec:${cmd}}
This commit also changed escaping of variables to be consistent with
functions. They can be now escaped by \, i.e. \${VAR} will not be expanded.
Escaping by double '$' is no more supported.
This commit also removes handler for all exceptions during profile loading.
This is not to mask real errors and ease development.
Resolves: rhbz#1225135
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This is for simple synchronization. When the message is logged it is
guranteed that everything was applied and is set in place.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
$${VAR} will be rewritten as ${VAR} and not expanded.
Only alphanumeric characters and underscores (those with matches regular
expression \w+$) are allowed in variable name.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Variables can be defined in [variables] section in profile configuration.
Variables are specified the following way:
[variables]
VARIABLE1 = VALUE1
VARIABLE2 = VALUE2
Variables are expanded on definition and assignment. Previously defined variable
is redefined by its new definition.
Variables can be referenced in plugins configuration by using '$' prefix, e.g.:
[variables]
delay = 20
[audio]
timeout = $delay
There can be also included external file with definition of variables by using
'include' directive:
[variables]
include = filename
The 'filename' is processed by ConfigObj parser. Comments are supported by '#'
character. Multiple sections are not supported and files with multiple sections
are flattened to single section configuration file.
The variables are also supported by the script plugin. It exports variables into
environment before the script is executed. The variable names are prefixed by
the 'TUNED_' string. Example:
[variables]
VARIABLE1 = VALUE1
will be exported into environment as:
TUNED_VARIABLE1 = VALUE1
If there is already TUNED_ prefix in the variable name, no other prefix is
added, i.e.:
[variables]
TUNED_VARIABLE1 = VALUE1
will be exported as:
TUNED_VARIABLE1 = VALUE1
and not TUNED_TUNED_VARIABLE1.
Resolves: rhbz#1225124
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
It is supported by 'nightly' makefile target. It creates
snapshot from the GIT HEAD, makes mockbuild,
creates repo and uploads result on the fedorapeople.
Also fixed makefile to support parallel builds, added
couple of hopefully useful targets, implemented local
RPM build target 'rpm'.
Other targets (e.g. 'srpm') can be also used to work
with snapshots. It is controlled by BUILD makefile
varible. If set to 'release' normal release is done.
If set to anything else (e.g. 'snapshot') snapshot
is done.
There is also support for GIT snapshots in the upstream
provided SPEC file. Snapshot build is done if
built with '--with snapshot', normal (release) build
is done otherwise.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
By default build as development release with build date and git suffix
added to the release number. Build without this suffix if built
--with release
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Usage:
[net]
coalesce=PARAM1 VALUE1 PARAM2 VALUE2
features=PARAM1 VALUE1 PARAM2 VALUE2
It is also possible to specify it by:
coalesce=PARAM1: VALUE1; PARAM2: VALUE2
or:
coalesce=PARAM1 VALUE1, PARAM2 VALUE2
or mix all separators.
Resolves: rhbz#1152539
Resolves: rhbz#1152541
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
They were intended to be class methods and that's why there
were defined with the 'cls' parameter, but they actually
weren't class methods.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
At first try to compare current and new values as integers. If it fails
try to compare them as hexadecimal values. If it fails compare them
as strings.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>