Bug 1825882
| Summary: | Applying a profile with multiple inheritance where parents include a common ancestor fails | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Yanir Quinn <yquinn> | ||||||
| Component: | tuned | Assignee: | Jaroslav Škarvada <jskarvad> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Robin Hack <rhack> | ||||||
| Severity: | high | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | 8.2 | CC: | jeder, jmencak, jorton, jskarvad, lmiksik, mapfelba, psklenar, yjoseph, yquinn | ||||||
| Target Milestone: | rc | Keywords: | AutoVerified, NeedsTestCase, Patch, Triaged, Upstream | ||||||
| Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | tuned-2.16.0-0.1.rc1.el8 | Doc Type: | If docs needed, set a value | ||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2021-11-09 19:58:24 UTC | Type: | Bug | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Bug Depends On: | |||||||||
| Bug Blocks: | 1961869 | ||||||||
| Attachments: |
|
||||||||
|
Description
Yanir Quinn
2020-04-20 12:44:47 UTC
Looking at loader.py :
def _load_profile(self, profile_names, profiles, processed_files):
for name in profile_names:
filename = self._profile_locator.get_config(name, processed_files)
if filename is None:
raise InvalidProfileException("Cannot find profile '%s' in '%s'." % (name, list(reversed(self._profile_locator._load_directories))))
processed_files.append(filename)
config = self._load_config_data(filename)
profile = self._profile_factory.create(name, config)
if "include" in profile.options:
include_names = re.split(r"\b\s*[,;]\s*", self._variables.expand(profile.options.pop("include")))
self._load_profile(include_names, profiles, processed_files)
profiles.append(profile)
It seems that self._profile_locator.get_config(name, processed_files) is probably invoked twice with an ancestor profile.
If an ancestor profile was already processed and added processed_files.append(filename) it won't be obtained again and be skipped:
locator.py :
def get_config(self, profile_name, skip_files=None):
for dir_name in reversed(self._load_directories):
# basename is protection not to get out of the path
config_file = self._get_config_filename(dir_name, os.path.basename(profile_name))
if skip_files is not None and config_file in skip_files:
continue
if os.path.isfile(config_file):
return config_file
return None
In the bug description we use realtime and cpu-partitioning profiles that have a common ancestor : network-latency that fails to be obtained according to the log.
There is also a need to consider the case where there is a transitive inheritance , for example:
realtime-> network-latency -> latency-performance
cpu-partitioning -> network-latency -> latency-performance
latency-performance should not be also a reason for a failure in case we overcome the first ancestor.
Reproduced. Thanks for the report! Created attachment 1788804 [details]
Proposed patch to address this issue.
Proposing a patch to address this issue. Might break some unit tests, but seems to address the problem.
Created attachment 1789468 [details]
Proposed fix
I address the following:
- unit test fixes
- fix the problem (regression) when customized profile PROFILE (in /etc/tuned) uses include=PROFILE (for customizing the stock profiles from the /usr/share/tuned)
I will give you credit in the upstream git.
I am going to give it a bit more thinking whether this simplified profile loading could introduce some unexpected situations (e.g. with 'replace=true').
Upstream PR: https://github.com/redhat-performance/tuned/pull/357 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (tuned bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:4476 The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days |