-
Notifications
You must be signed in to change notification settings - Fork 149
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
check_microarch: require x86_64-v3 for RHEL10 #1196
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...s/system_upgrade/common/actors/checkmicroarchitecture/libraries/checkmicroarchitecture.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from collections import namedtuple | ||
|
||
from leapp import reporting | ||
from leapp.libraries.common.config.architecture import ARCH_X86_64, matches_architecture | ||
from leapp.libraries.common.config.version import get_target_major_version | ||
from leapp.libraries.stdlib import api | ||
from leapp.models import CPUInfo | ||
|
||
X86_64_BASELINE_FLAGS = ['cmov', 'cx8', 'fpu', 'fxsr', 'mmx', 'syscall', 'sse', 'sse2'] | ||
X86_64_V2_FLAGS = ['cx16', 'lahf_lm', 'popcnt', 'pni', 'sse4_1', 'sse4_2', 'ssse3'] | ||
X86_64_V3_FLAGS = ['avx2', 'bmi1', 'bmi2', 'f16c', 'fma', 'abm', 'movbe', 'xsave'] | ||
|
||
MicroarchInfo = namedtuple('MicroarchInfo', ('required_flags', 'extra_report_fields', 'microarch_ver')) | ||
|
||
|
||
def _inhibit_upgrade(missing_flags, target_rhel, microarch_ver, extra_report_fields=None): | ||
title = 'Current x86-64 microarchitecture is unsupported in {0}'.format(target_rhel) | ||
summary = ('{0} has a higher CPU requirement than older versions, it now requires a CPU ' | ||
'compatible with {1} instruction set or higher.\n\n' | ||
'Missings flags detected are: {2}\n').format(target_rhel, microarch_ver, ', '.join(missing_flags)) | ||
|
||
report_fields = [ | ||
reporting.Title(title), | ||
reporting.Summary(summary), | ||
reporting.Severity(reporting.Severity.HIGH), | ||
reporting.Groups([reporting.Groups.INHIBITOR]), | ||
reporting.Groups([reporting.Groups.SANITY]), | ||
reporting.Remediation(hint=('If a case of using virtualization, virtualization platforms often allow ' | ||
'configuring a minimum denominator CPU model for compatibility when migrating ' | ||
'between different CPU models. Ensure that minimum requirements are not below ' | ||
'that of {0}\n').format(target_rhel)), | ||
] | ||
|
||
if extra_report_fields: | ||
report_fields += extra_report_fields | ||
|
||
reporting.create_report(report_fields) | ||
|
||
|
||
def process(): | ||
""" | ||
Check whether the processor matches the required microarchitecture. | ||
""" | ||
|
||
if not matches_architecture(ARCH_X86_64): | ||
api.current_logger().info('Architecture not x86-64. Skipping microarchitecture test.') | ||
return | ||
|
||
cpuinfo = next(api.consume(CPUInfo)) | ||
|
||
rhel9_microarch_article = reporting.ExternalLink( | ||
title='Building Red Hat Enterprise Linux 9 for the x86-64-v2 microarchitecture level', | ||
url='https://red.ht/rhel-9-intel-microarchitectures' | ||
) | ||
|
||
rhel_major_to_microarch_reqs = { | ||
'9': MicroarchInfo(microarch_ver='x86-64-v2', | ||
required_flags=(X86_64_BASELINE_FLAGS + X86_64_V2_FLAGS), | ||
extra_report_fields=[rhel9_microarch_article]), | ||
'10': MicroarchInfo(microarch_ver='x86-64-v3', | ||
required_flags=(X86_64_BASELINE_FLAGS + X86_64_V2_FLAGS + X86_64_V3_FLAGS), | ||
extra_report_fields=[]), | ||
} | ||
|
||
microarch_info = rhel_major_to_microarch_reqs.get(get_target_major_version()) | ||
if not microarch_info: | ||
api.current_logger().info('No known microarchitecture requirements are known for target RHEL%s.', | ||
get_target_major_version()) | ||
return | ||
|
||
missing_flags = [flag for flag in microarch_info.required_flags if flag not in cpuinfo.flags] | ||
api.current_logger().debug('Required flags missing: %s', missing_flags) | ||
if missing_flags: | ||
_inhibit_upgrade(missing_flags, | ||
'RHEL{0}'.format(get_target_major_version()), | ||
pirat89 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
microarch_info.microarch_ver, | ||
extra_report_fields=microarch_info.extra_report_fields) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
...system_upgrade/el8toel9/actors/checkmicroarchitecture/libraries/checkmicroarchitecture.py
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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've added a note to the OAMG-11275 ticket to not forget to implement the shortened URL when a documentation is created.