A profile can now be set in two modes: automatic and manual.
When the automatic mode is active, Tuned always activates the
recommended profile upon startup. This mode can be set using
the following command:
tuned-adm auto_profile
When the manual mode is active, the previously applied profile
is activated upon startup. This mode can be set by switching
to the desired profile, e.g.
tuned-adm profile throughput-performance
The mode is saved on the second line of /etc/tuned/active_profile.
When the file /etc/tuned/active_profile does not exist, or is
empty, automatic mode is enabled. When the file has only one line,
i.e. it was generated by a previous Tuned version, manual mode
is enabled so that the upgrade doesn't cause unexpected active profile
changes.
Related: rhbz#1459146
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
List available profiles when 'tuned-adm profile' is run
without a profile name.
Resolves: rhbz#988433
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
In no_daemon mode it doesn't try to query DBus, so it doesn't
output DBus error.
Resolves: rhbz#1351536
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
The glib/dbus doesn't like multithreading which is not handled
by them, thus the code may segfault. According to
https://bugzilla.redhat.com/show_bug.cgi?id=1330127#c2
it is not supportd and dbus-glib/dbus-python are not thread safe.
This commit moves multithreading under glib and handles all
in the glib mainloop, thus it may no longer segfaults.
It also adds --timeout, -t command line parameter which may
specify timeout for the sync operations, e.g.:
# tuned-adm --timeout 200 profile balanced
wil use 200 seconds timeout when waiting for the profile to
load.
The default timeout was increased to 90 seconds to match
systemd default timeouts.
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
The verify command can now be run in ignore-missing mode. In this mode
missing/non-supported settings (i.e. those which current value is None)
are ignored and not treated as errors.
The tuned-adm got new verify options -i and --ignore-missing which
enables the ignore-missing mode, usage:
tuned-adm verify -i
or:
tuned-adm verify --ignore-missing
The DBus interface got new method 'verify_profile_ignore_missing' which
does the verification in ignore-missing mode.
Resolves: rhbz#1243807
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
By default tuned-adm now synchronously switch profiles, i.e it waits untill
the profile is applied and then returns to the shell. It returns with
exitcode 0 if profile is correctly applied. If there is an error it uses
exitcode > 0 (currently only 1 is used) and displays error. For reverting
to old behaviour (i.e. asynchronous profile switching) when the tuned-adm
returns immediately there is an tuned-adm command line option -a (or --async).
D-Bus API was extended to allow synchronous profile switching. Now the
"profile_changed" D-Bus signal is sent when the profile is applied. The
signal contains the following data:
profile_name:string - the name of the profile which was applied
result:boolean - status of the operation, true if OK, false on error
errstr:string - string containing description of the error (if result is
false)
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Added new tuned-adm functionality 'profile_info'. It has optional parameter
'profile_name'. If called without parameter, active profile is used.
It outputs name of the profile it is querying, profile summary, and profile
description. If there is no profile summary or description available it
outputs empty string(s).
Extended tuned-adm 'list' functionality. It now displays profile summary
in the list (if available).
Added summary to profiles.
Extended D-Bus API to support the new feature and for better Cockpit support:
- Added 'profile_info' method. It gets profile_name argument and it queries
the requested profile for information. If profile_name is empty string it
queries the active/selected profile. It returns tuple of the following
format (status, profile_name, summary, description), where status is
boolean. If it is False, the query mechanism failed and the other fields
don't contain valid data
- Added 'profiles2' method. It's extension of 'profiles' method. It returns
list of tuples. Tuples have following format:
(profile_name, profile_summary)
Related: rhbz#1228356
Fixes: #46
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Most of the functionality don' work in this mode, it just
applies the settings, no rollback possible.
Disable daemon by setting 'daemon = 0' in /etc/tuned/tuned-main.conf
This settings can be overridden if running tuned with '-d' command line
option. In such case daemon mode will be used.
Resolves: rhbz#1068663
Also fixed interpretation of booleans in main config.
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>
The verify command verifies whether the current system settings matches
activated profile. It also writes all settings from the active profile
with the current / expected values to the log. It is good for checking
what is exactly set and what changed during the run.
Currently custom commands and plugin_scheduler are not supported.
Resolves: rhbz#1150047
Fixes: #34
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
Made tuned error messages less verbose, but more descriptive if running without
debug option. Also made class from the tuned.utils.commands helper functions.
Its logging can be enabled / disabled.
Resolves: rhbz#1068699
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
GPL license does not require all files to have the copyright notice
and header. To save some space, I removed the headers from all files
except the executables and the main Python module.