-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
el8toel9: Warn about deprecated Xorg drivers
Some Xorg drivers have been deprecated in favor of the "modesetting" driver. If Xorg is configured to use those drivers, it may not be able to work properly after the upgrade. Add a new actor to check in the journal whether such Xorg drivers are in use and in that case, also warn if there are custom Xorg config options. Known limitation: This actor checks the journal logs since the last boot, meaning that if Xorg was started manually from a console or if the system has been rebooted after a graphical Xorg session was used, the actor will not be able to detect the use of deprecated drivers. Signed-off-by: Olivier Fourdan <[email protected]>
- Loading branch information
Showing
4 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
repos/system_upgrade/el8toel9/actors/checkxorgdeprecateddrivers/actor.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,42 @@ | ||
from leapp import reporting | ||
from leapp.actors import Actor | ||
from leapp.libraries.actor.xorgdriverlib import was_xorg_driver_used, has_xorg_driver_config | ||
from leapp.reporting import create_report, Report | ||
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag | ||
|
||
|
||
class CheckXorgDeprecatedDrivers(Actor): | ||
""" | ||
Warn if Xorg deprecated drivers are in use. | ||
""" | ||
|
||
name = 'check_xorg_deprecated_drivers' | ||
consumes = () | ||
produces = (Report,) | ||
tags = (ChecksPhaseTag, IPUWorkflowTag) | ||
|
||
def process(self): | ||
for driver in [ 'RADEON', 'ATI', 'AMDGPU', 'MACH64', 'intel', 'spiceqxl', 'qxl', 'NOUVEAU', 'NV', 'VESA' ]: | ||
if was_xorg_driver_used(driver): | ||
report_summary = ('Leapp has detected that the deprecated Xorg driver {} is used.' | ||
'\n\n' | ||
'Please uninstall the Xorg driver before upgrading to make sure you have a ' | ||
'graphical session after upgrading.') | ||
create_report([ | ||
reporting.Title('Deprecated Xorg driver detected'), | ||
reporting.Summary(report_summary.format(driver)), | ||
reporting.Severity(reporting.Severity.MEDIUM), | ||
reporting.Groups([reporting.Groups.DRIVERS]), | ||
]) | ||
|
||
if has_xorg_driver_config(driver): | ||
report_summary = ('Leapp has detected a custom configuration for the deprecated Xorg driver {}.' | ||
'\n\n' | ||
'Driver specific options will be ignored and have no effect without the driver.') | ||
create_report([ | ||
reporting.Title('Deprecated Xorg driver detected'), | ||
reporting.Summary(report_summary.format(driver)), | ||
reporting.Severity(reporting.Severity.MEDIUM), | ||
reporting.Groups([reporting.Groups.DRIVERS]), | ||
]) |
39 changes: 39 additions & 0 deletions
39
repos/system_upgrade/el8toel9/actors/checkxorgdeprecateddrivers/libraries/xorgdriverlib.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,39 @@ | ||
# | ||
# Helper functions | ||
# | ||
|
||
from leapp.libraries.stdlib import api, CalledProcessError, run | ||
|
||
def was_xorg_driver_used(_driver=""): | ||
""" | ||
Determines whether a given Xorg driver has been used in the path month, | ||
by checking the journalctl. | ||
:param _driver: name of the driver to check | ||
:return: True if the driver usage has been found. | ||
:rtype: bool | ||
""" | ||
try: | ||
run(['check_syslog_for_driver.sh', _driver]) | ||
except CalledProcessError: | ||
api.current_logger().debug('Nothing about Xorg driver {} was found in journal.'.format(_driver)) | ||
return False | ||
api.current_logger().debug('Found logs from driver {} in journal.'.format(_driver)) | ||
return True | ||
|
||
def has_xorg_driver_config(_driver=""): | ||
""" | ||
Determines whether custom options for the the given Xorg driver has been | ||
used in the path month, by checking the journalctl. | ||
:param _driver: name of the driver to check | ||
:return: True if custom options for the driver were found. | ||
:rtype: bool | ||
""" | ||
try: | ||
run(['check_syslog_for_driver_config.sh', _driver]) | ||
except CalledProcessError: | ||
api.current_logger().debug('No custom options for Xorg driver {} were found in journal.'.format(_driver)) | ||
return False | ||
api.current_logger().debug('Custom options for driver {} found in journal.'.format(_driver)) | ||
return True |
10 changes: 10 additions & 0 deletions
10
...ystem_upgrade/el8toel9/actors/checkxorgdeprecateddrivers/tools/check_syslog_for_driver.sh
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,10 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -ne 1 ]; then | ||
echo Usage: $0 DRIVER | ||
exit -1 | ||
fi | ||
|
||
/usr/bin/journalctl /usr/libexec/Xorg -b 0 | \ | ||
/usr/bin/grep "DPI set to" | \ | ||
/usr/bin/grep -q -F $1 |
9 changes: 9 additions & 0 deletions
9
...pgrade/el8toel9/actors/checkxorgdeprecateddrivers/tools/check_syslog_for_driver_config.sh
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,9 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -ne 1 ]; then | ||
echo Usage: $0 DRIVER | ||
exit -1 | ||
fi | ||
|
||
/usr/bin/journalctl /usr/libexec/Xorg -b 0 | \ | ||
/usr/bin/grep -q -F "(**) $1" |