This is a minimal viable implementation of a post-loaded profile feature. It was implemented to satisfy the needs of the kernel_settings Ansible role. https://github.com/linux-system-roles/kernel_settings This feature allows us to apply a profile in a way that is somewhat separate from the way profiles from the active_profile file are applied. Namely, the post-loaded profile is always applied after all the profiles from the active_profile (or more precisely, the post-loaded profile is always put to the tail of the profile chain when merging). Also, the post-loaded profile setting is not affected by running 'tuned-adm profile <some profile>' - the post-loaded profile remains applied. The name of the post-loaded profile is stored in /etc/tuned/post_loaded_profile. The lack of support for multiple post-loaded profiles was more or less an arbitrary decision. There are no problems with it, as far as I can see. However, there is currently no use case for multiple post-loaded profiles, so I decided to make things easier for our future selves - it's one less thing to worry about if we need to make changes to the profile loading logic. We can add support for multiple post-loaded profiles anytime. A number of other design decisions went into the implementation. They are listed here: https://github.com/redhat-performance/tuned/pull/272 Resolves: rhbz#1798183 Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
13 lines
359 B
Python
13 lines
359 B
Python
from dbus.mainloop.glib import DBusGMainLoop
|
|
import dbus
|
|
from gi.repository import GLib
|
|
|
|
def handler(profiles, res, err):
|
|
print(profiles)
|
|
loop.quit()
|
|
|
|
DBusGMainLoop(set_as_default=True)
|
|
loop = GLib.MainLoop()
|
|
bus=dbus.SystemBus()
|
|
bus.add_signal_receiver(handler, "profile_changed", "com.redhat.tuned.control", "com.redhat.tuned", "/Tuned")
|
|
loop.run()
|