Add a check which raises an error if the caller of ReleaseProfile
is not identical to the caller of HoldProfile.
Do not number cookies from 0, use pseudo-random integers.
Do not allow null cookies, which may cause issues in clients.
E.g., in gnome-settings-daemon, a null cookie means that it
currently has no active hold.
Rename HoldProfile/ReleaseProfile polkit actions to
hold-profile/release-profile.
Add the switch-profile action and check against it when
switching the profile using the ActiveProfile DBus property.
The changes require some refactoring of the DBusExporter class,
mainly because we need to be able to supply a custom polkit action
name instead of deriving it from the DBus method name.
Set an Obsoletes: tag to remove power-profiles-daemon package.
Resolves: #2293628
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
And for dirty_background_(bytes|ratio).
These parameters interact with each other; it is therefore
not sufficient to configure them via the sysctl plugin.
For more details, see
https://docs.kernel.org/admin-guide/sysctl/vm.html#dirty-bytes.
Resolves: RHEL-58820
Since version 0.20, power-profiles-daemon exposes
its DBus interface under "org.freedesktop.UPower.PowerProfiles"
alongside the previous name. To be compatible with PPD, this commit
implements the same change into tuned-ppd.
Resolves: #683
On some Thinkpad laptops, it is possible to change the ACPI
platform profile using function keys (e.g., Fn+L). This can
now trigger a complete profile change if the functionality
is enabled.
Resolves#710.
To be consistent and make sure tuned-ppd works well with
its users no matter the configuration, the balanced profile
must be required in the configuration file, similarly to
the power-saver and performance profiles.
If no default profile is specified in the configuration,
this also sets the default profile to balanced, not raising
any exceptions like before.
This makes tuned-ppd fully API-compatible with
the latest power-profiles-daemon. The property
will signify the level of API compatibility with
power-profiles-daemon.
Instead of querying TuneD each time we want to determine the active
TuneD profile, remember its value. Also watch for signals from TuneD,
updating the value when the TuneD profile changes (resolves#689).
The daemon now also keeps track of the "base" PPD profile, which is
restored when all profile holds are released or when tuned-ppd is
restarted. For the latter purpose, this profile is also saved in a file.
Direct access via two dictionaries (one for AC, one for DC)
was clumsy, this commit replaces it with a new class - ProfileMap.
Make sure that we only initialize the UPower signal
handler only if such a handler is not already running.
This also reorders the order of operations in the initialization
procedure, skipping redundant initial TuneD profile changes.
The bootloader plugin needs patched BLS entries with the TuneD variables.
It seems variables in the BLS entries is grub extension which is not
described in the BLS specification. It can cause boot problems with e.g.
systemd-boot, thus add variables to BLS entries only if the BLS entries
were generated by grub.
Resolves: rhbz#2323514
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
- improved conditionals for better readability
- fixed tuned-ppd not to run install twice
- used macro for profiles path
- consolidated names of related variables
- updated Makefile to update the current profile paths during
installation
- fixed tests to use correct profile directory on RHEL/CentOS
- consolidated whitespaces and variable names in fixed tests
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
The perf.evlist.read_on_cpu function may return instances of
classes that do not have the type attribute, e.g. perf.lost_event.
Make sure we do not read the type attribute if we are not sure
that it exists.
Resolves: RHEL-60898
1. In the raise statement of the check_positive() function, the error message conflicts with the if condition.
2. If the value of val is 0, it passes the if condition but raises an error message stating [0 has to be >= 0].
3. This PR removes the = from the raise statement, so when val is 0,
it will correctly prompt that the value of val [has to be > 0].
Signed-off-by: dufuhang <dufuhang@kylinos.cn>
Need to expand variables before calling the @command function. This is
actually done for _execute_all[_non]_device_commands and
_verify_all_non_device_commands, but not in _verify_all_device_commands.
This adds the missing expansion.
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
Systemd reads all conf files from a service drop-in directory and merges
them.
This change enables the following use case:
Tuning unrelated but local changes can be put into - say:
/etc/systemd/system/sfptpd.service.d/local.conf
while a simple tuning such as the process affinity mask is rolled out
via a tuned profile, like this:
`tuned.conf` snippet:
```
[service]
service.sfptpd=,file:${i:PROFILE_DIR}/tuned-sfptpd.conf
```
`tuned-sfptpd.conf`:
```
[Service]
CPUAffinity=32
```
---
Arguably, this is a natural change, i.e. it establishes symmetry in
`cfg_install()` to `cfg_uninstall()`, because `cfg_uninstall()` already
allows for the service drop-in directory not being empty.
The no_turbo knob only recognizes 0 or 1, so we have to
convert the option value defined in the profile to an
integer if necessary.
Related: #630
Resolves: RHEL-51760
Since 6ef5b58e , switch_profile expects self._on_battery to be
set, but when it's called in Controller.initialize, it is
called before we do self._on_battery = False , and will crash
with
AttributeError: 'Controller' object has no attribute '_on_battery'
if the requested profile is not the currently active one.
This fixes that by moving the call to switch_profile after
self._on_battery is set.
Signed-off-by: Adam Williamson <awilliam@redhat.com>