-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Use tuned files instead of using it as a module #220
Conversation
try: | ||
import configobj | ||
|
||
HAS_CONFIGOBJ = True |
Check notice
Code scanning / CodeQL
Unused global variable Note
|
||
HAS_CONFIGOBJ = True | ||
except ImportError: | ||
HAS_CONFIGOBJ = False |
Check notice
Code scanning / CodeQL
Unused global variable Note
The previous version of the kernel_settings role used `tuned` as a python library, and had a `kernel_settings` module which was a wrapper around this code. However, `tuned` version 2.23 has changed its internal API and it is no longer possible to use it as a python library. Instead, the kernel_settings role has been refactored to read/write `tuned` config files, and let the `tuned` daemon manage the settings. In addition, `tuned` 2.23 changed the location of the profile directory, so the kernel_settings role will now determine the location of the profile directory depending on the `tuned` version. The old `kernel_settings` module is removed, along with all of the python unit testing code. A new `kernel_settings_get_config` module has been created which will simply parse and return the given config file as a `dict`. Signed-off-by: Rich Megginson <[email protected]>
27817d0
to
7abfaf2
Compare
[citest] |
|
||
- name: Set profile_mode to manual | ||
copy: | ||
content: > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
content: > | |
content: manual |
is it the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to ensure the file ends with a newline - not sure if content: manual
will ensure that
- name: Set profile_mode to manual | ||
copy: | ||
content: > | ||
manual |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manual |
- name: sysctl | ||
new: "{{ kernel_settings_sysctl | difference([__kernel_settings_previous_replaced]) | list | ||
if kernel_settings_sysctl != __kernel_settings_state_empty | ||
else [] }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why __sysctl_old is set to dict {}
and new is set to list []
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new
is a list
of dict
- basically the same format as passed in by kernel_settings_sysctl
et. al. - see https://github.com/linux-system-roles/kernel_settings/pull/220/files#diff-d5995b3130f3bd6a8890b9832f7250dbaf05507afd6e49f7e371152a459c50abR8
old
is a dict
as returned by kernel_settings_get_config
and processed here - https://github.com/linux-system-roles/kernel_settings/pull/220/files#diff-d5995b3130f3bd6a8890b9832f7250dbaf05507afd6e49f7e371152a459c50abR15
tuned-adm profile {{ __kernel_settings_active_profile | quote }} | ||
when: | ||
- not __kernel_settings_register_profile is changed | ||
- not __kernel_settings_register_mode is changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the above task, there is or
between these two checks, here they both should be changed
to restart apply tuned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restarting tuned
will also apply the changes made by the template
task
tuned
must be restarted in order to apply the profile_mode or active_profile changes
If tuned
has been restarted due to the above, we can skip doing the tuned-adm profile
[citest] |
The previous version of the kernel_settings role used
tuned
asa python library, and had a
kernel_settings
module which was awrapper around this code. However,
tuned
version 2.23 has changedits internal API and it is no longer possible to use it as a python
library. Instead, the kernel_settings role has been refactored to
read/write
tuned
config files, and let thetuned
daemon managethe settings.
In addition,
tuned
2.23 changed the location of the profile directory,so the kernel_settings role will now determine the location of the
profile directory depending on the
tuned
version.The old
kernel_settings
module is removed, along with all of thepython unit testing code.
A new
kernel_settings_get_config
module has been created which willsimply parse and return the given config file as a
dict
.Signed-off-by: Rich Megginson [email protected]