diff --git a/etc/leapp/files/repomap.json b/etc/leapp/files/repomap.json index 1c97b7de12..74ced0c774 100644 --- a/etc/leapp/files/repomap.json +++ b/etc/leapp/files/repomap.json @@ -233,7 +233,25 @@ ] } ] - } + }, + { + "source_major_version": "9", + "target_major_version": "10", + "entries": [ + { + "source": "rhel9-BaseOS", + "target": [ + "rhel10-BaseOS" + ] + }, + { + "source": "rhel9-AppStream", + "target": [ + "rhel10-AppStream" + ] + } + ] + } ], "repositories": [ { @@ -3887,6 +3905,30 @@ "rhui": "alibaba" } ] + }, + { + "pesid": "rhel10-AppStream", + "entries": [ + { + "major_version": "10", + "repoid": "rhel-10-appstream-rpms", + "arch": "x86_64", + "channel": "ga", + "repo_type": "rpm" + } + ] + }, + { + "pesid": "rhel10-BaseOS", + "entries": [ + { + "major_version": "10", + "repoid": "rhel-10-baseos-rpms", + "arch": "x86_64", + "channel": "ga", + "repo_type": "rpm" + } + ] } ], "provided_data_streams": [ diff --git a/repos/system_upgrade/common/actors/checkdetecteddevicesanddrivers/actor.py b/repos/system_upgrade/common/actors/checkdetecteddevicesanddrivers/actor.py deleted file mode 100644 index 1dc923d843..0000000000 --- a/repos/system_upgrade/common/actors/checkdetecteddevicesanddrivers/actor.py +++ /dev/null @@ -1,21 +0,0 @@ -from leapp.actors import Actor -from leapp.libraries.actor import checkdddd -from leapp.models import DetectedDeviceOrDriver, Report -from leapp.tags import ChecksPhaseTag, IPUWorkflowTag - - -class CheckDetectedDevicesAndDrivers(Actor): - """ - Checks whether or not detected devices and drivers are usable on the target system. - - In case a driver is no longer present in the target system, an inhibitor will be raised. - If the device or driver is not maintained anymore, a warning report will be generated. - """ - - name = 'check_detected_devices_and_drivers' - consumes = (DetectedDeviceOrDriver,) - produces = (Report,) - tags = (IPUWorkflowTag, ChecksPhaseTag) - - def process(self): - checkdddd.process() diff --git a/repos/system_upgrade/common/actors/checkdetecteddevicesanddrivers/libraries/checkdddd.py b/repos/system_upgrade/common/actors/checkdetecteddevicesanddrivers/libraries/checkdddd.py deleted file mode 100644 index df431c0e63..0000000000 --- a/repos/system_upgrade/common/actors/checkdetecteddevicesanddrivers/libraries/checkdddd.py +++ /dev/null @@ -1,180 +0,0 @@ -from collections import defaultdict -from enum import IntEnum - -from leapp import reporting -from leapp.libraries.common.config.version import get_source_major_version, get_target_major_version -from leapp.libraries.stdlib import api -from leapp.models import DetectedDeviceOrDriver - - -class MessagingClass(IntEnum): - UNKNOWN = 0 - DRIVERS = 1 - DEVICES = 2 - CPUS = 3 - - -def create_inhibitors(inhibiting_entries): - if not inhibiting_entries: - return - - drivers = inhibiting_entries.get(MessagingClass.DRIVERS) - if drivers: - reporting.create_report([ - reporting.Title( - 'Leapp detected loaded kernel drivers which have been removed ' - 'in RHEL {}. Upgrade cannot proceed.'.format(get_target_major_version()) - ), - reporting.Summary( - ( - 'Support for the following RHEL {source} device drivers has been removed in RHEL {target}:\n' - ' - {drivers}\n' - ).format( - drivers='\n - '.join([entry.driver_name for entry in drivers]), - target=get_target_major_version(), - source=get_source_major_version(), - ) - ), - reporting.Audience('sysadmin'), - reporting.Groups([reporting.Groups.KERNEL, reporting.Groups.DRIVERS]), - reporting.Severity(reporting.Severity.HIGH), - reporting.Groups([reporting.Groups.INHIBITOR]) - ]) - - devices = inhibiting_entries.get(MessagingClass.DEVICES) - if devices: - reporting.create_report([ - reporting.Title( - 'Leapp detected devices which are no longer supported in RHEL {}. Upgrade cannot proceed.'.format( - get_target_major_version()) - ), - reporting.Summary( - ( - 'Support for the following devices has been removed in RHEL {target}:\n' - ' - {devices}\n' - ).format( - devices='\n - '.join(['{name} ({pci})'.format(name=entry.device_name, - pci=entry.device_id) for entry in devices]), - target=get_target_major_version(), - ) - ), - reporting.Audience('sysadmin'), - reporting.Groups([reporting.Groups.KERNEL]), - reporting.Severity(reporting.Severity.HIGH), - reporting.Groups([reporting.Groups.INHIBITOR]) - ]) - - cpus = inhibiting_entries.get(MessagingClass.CPUS) - if cpus: - reporting.create_report([ - reporting.Title( - 'Leapp detected a processor which is no longer supported in RHEL {}. Upgrade cannot proceed.'.format( - get_target_major_version()) - ), - reporting.Summary( - ( - 'Support for the following processors has been removed in RHEL {target}:\n' - ' - {processors}\n' - ).format( - processors='\n - '.join([entry.device_name for entry in cpus]), - target=get_target_major_version(), - ) - ), - reporting.Audience('sysadmin'), - reporting.Groups([reporting.Groups.KERNEL, reporting.Groups.BOOT]), - reporting.Severity(reporting.Severity.HIGH), - reporting.Groups([reporting.Groups.INHIBITOR]) - ]) - - -def create_warnings(unmaintained_entries): - if not unmaintained_entries: - return - - drivers = unmaintained_entries.get(MessagingClass.DRIVERS) - if drivers: - reporting.create_report([ - reporting.Title( - 'Leapp detected loaded kernel drivers which are no longer maintained in RHEL {}.'.format( - get_target_major_version()) - ), - reporting.Summary( - ( - 'The following RHEL {source} device drivers are no longer maintained RHEL {target}:\n' - ' - {drivers}\n' - ).format( - drivers='\n - '.join([entry.driver_name for entry in drivers]), - target=get_target_major_version(), - source=get_source_major_version(), - ) - ), - reporting.Audience('sysadmin'), - reporting.Groups([reporting.Groups.KERNEL, reporting.Groups.DRIVERS]), - reporting.Severity(reporting.Severity.HIGH), - ]) - - devices = unmaintained_entries.get(MessagingClass.DEVICES) - if devices: - reporting.create_report([ - reporting.Title( - 'Leapp detected devices which are no longer maintained in RHEL {}'.format( - get_target_major_version()) - ), - reporting.Summary( - ( - 'The support for the following devices has been removed in RHEL {target} and ' - 'are no longer maintained:\n - {devices}\n' - ).format( - devices='\n - '.join(['{name} ({pci})'.format(name=entry.device_name, - pci=entry.device_id) for entry in devices]), - target=get_target_major_version(), - ) - ), - reporting.Audience('sysadmin'), - reporting.Groups([reporting.Groups.KERNEL]), - reporting.Severity(reporting.Severity.HIGH), - ]) - - cpus = unmaintained_entries.get(MessagingClass.CPUS) - if cpus: - reporting.create_report([ - reporting.Title( - 'Leapp detected a processor which is no longer maintained in RHEL {}.'.format( - get_target_major_version()) - ), - reporting.Summary( - ( - 'The following processors are no longer maintained in RHEL {target}:\n' - ' - {processors}\n' - ).format( - processors='\n - '.join([entry.device_name for entry in cpus]), - target=get_target_major_version(), - ) - ), - reporting.Audience('sysadmin'), - reporting.Groups([reporting.Groups.KERNEL, reporting.Groups.BOOT]), - reporting.Severity(reporting.Severity.HIGH), - ]) - - -def classify(entry): - if entry.device_type == 'pci': - if entry.device_id: - return MessagingClass.DEVICES - return MessagingClass.DRIVERS - if entry.device_type == 'cpu': - return MessagingClass.CPUS - return MessagingClass.UNKNOWN - - -def process(): - target_version = int(get_target_major_version()) - inhibiting = defaultdict(list) - unmaintained = defaultdict(list) - for entry in api.consume(DetectedDeviceOrDriver): - if target_version not in entry.available_in_rhel: - inhibiting[classify(entry)].append(entry) - elif target_version not in entry.maintained_in_rhel: - unmaintained[classify(entry)].append(entry) - create_inhibitors(inhibiting) - create_warnings(unmaintained) diff --git a/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner_repomap.py b/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner_repomap.py index 64e1346bfb..0dbd2948a8 100644 --- a/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner_repomap.py +++ b/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner_repomap.py @@ -5,7 +5,8 @@ DEFAULT_PESID = { '7': 'rhel7-base', '8': 'rhel8-BaseOS', - '9': 'rhel9-BaseOS' + '9': 'rhel9-BaseOS', + '10': 'rhel9-BaseOS' } diff --git a/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py b/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py index 1cc5d64f81..88dc908100 100644 --- a/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py +++ b/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py @@ -12,6 +12,7 @@ "gpg-pubkey-db42a60e-37ea5438", ], 9: ["gpg-pubkey-d4082792-5b32db75"], + 10: ["gpg-pubkey-d4082792-5b32db75"] } diff --git a/repos/system_upgrade/common/actors/repositoriesblacklist/libraries/repositoriesblacklist.py b/repos/system_upgrade/common/actors/repositoriesblacklist/libraries/repositoriesblacklist.py index b52756107e..e22fbee0a6 100644 --- a/repos/system_upgrade/common/actors/repositoriesblacklist/libraries/repositoriesblacklist.py +++ b/repos/system_upgrade/common/actors/repositoriesblacklist/libraries/repositoriesblacklist.py @@ -8,7 +8,8 @@ UNSUPPORTED_PESIDS = { "7": "rhel7-optional", "8": "rhel8-CRB", - "9": "rhel9-CRB" + "9": "rhel9-CRB", + "10": "rhel10-CRB" } diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py index 8d8044072a..95f9ff4432 100644 --- a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +++ b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py @@ -531,7 +531,7 @@ def _copy_certificates(context, target_userspace): backup_pki = os.path.join(target_userspace, 'etc', 'pki.backup') with mounting.NspawnActions(base_dir=target_userspace) as target_context: - files_owned_by_rpms = _get_files_owned_by_rpms(target_context, '/etc/pki', recursive=True) + files_owned_by_rpms = _get_files_owned_by_rpms(target_context, '/etc/pki', recursive=False) api.current_logger().debug('Files owned by rpms: {}'.format(' '.join(files_owned_by_rpms))) # Backup container /etc/pki @@ -602,7 +602,7 @@ def _prep_repository_access(context, target_userspace): # NOTE(dkubek): context.call(['update-ca-trust']) seems to not be working. # I am not really sure why. The changes to files are not # being written to disk. - run(["chroot", target_userspace, "/bin/bash", "-c", "su - -c update-ca-trust"]) + #run(["chroot", target_userspace, "/bin/bash", "-c", "su - -c update-ca-trust"]) if not rhsm.skip_rhsm(): run(['rm', '-rf', os.path.join(target_etc, 'rhsm')]) diff --git a/repos/system_upgrade/common/files/prod-certs/10.0/479.pem b/repos/system_upgrade/common/files/prod-certs/10.0/479.pem new file mode 100644 index 0000000000..1ea1cd3deb --- /dev/null +++ b/repos/system_upgrade/common/files/prod-certs/10.0/479.pem @@ -0,0 +1,35 @@ +-----BEGIN CERTIFICATE----- +MIIGFTCCA/2gAwIBAgIJALDxRLt/tVDQMA0GCSqGSIb3DQEBCwUAMIGuMQswCQYD +VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExFjAUBgNVBAoMDVJlZCBI +YXQsIEluYy4xGDAWBgNVBAsMD1JlZCBIYXQgTmV0d29yazEuMCwGA1UEAwwlUmVk +IEhhdCBFbnRpdGxlbWVudCBQcm9kdWN0IEF1dGhvcml0eTEkMCIGCSqGSIb3DQEJ +ARYVY2Etc3VwcG9ydEByZWRoYXQuY29tMB4XDTIzMDcxOTE2MzQwOFoXDTQzMDcx +OTE2MzQwOFowRDFCMEAGA1UEAww5UmVkIEhhdCBQcm9kdWN0IElEIFsxZDg0ZDQ5 +Ny1jZmNmLTQxNjEtOTM0YS0zNzk2MDU4M2ZmZGZdMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEAxj9J04z+Ezdyx1U33kFftLv0ntNS1BSeuhoZLDhs18yk +sepG7hXXtHh2CMFfLZmTjAyL9i1XsxykQpVQdXTGpUF33C2qBQHB5glYs9+d781x +8p8m8zFxbPcW82TIJXbgW3ErVh8vk5qCbG1cCAAHb+DWMq0EAyy1bl/JgAghYNGB +RvKJObTdCrdpYh02KUqBLkSPZHvo6DUJFN37MXDpVeQq9VtqRjpKLLwuEfXb0Y7I +5xEOrR3kYbOaBAWVt3mYZ1t0L/KfY2jVOdU5WFyyB9PhbMdLi1xE801j+GJrwcLa +xmqvj4UaICRzcPATP86zVM1BBQa+lilkRQes5HyjZzZDiGYudnXhbqmLo/n0cuXo +QBVVjhzRTMx71Eiiahmiw+U1vGqkHhQNxb13HtN1lcAhUCDrxxeMvrAjYdWpYlpI +yW3NssPWt1YUHidMBSAJ4KctIf91dyE93aStlxwC/Qny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wps28DLm41DXf5DnXK+BXFHrtR/3YAZtga+R7OL/RvcF0kc2kudlxqd/8Y33uL +nqnoATy31FTW4J4rEfanJTQgTpatZmbaLQ== +-----END CERTIFICATE----- diff --git a/repos/system_upgrade/common/files/rpm-gpg/10/RPM-GPG-KEY-redhat-release b/repos/system_upgrade/common/files/rpm-gpg/10/RPM-GPG-KEY-redhat-release new file mode 100644 index 0000000000..7f43da03f4 --- /dev/null +++ b/repos/system_upgrade/common/files/rpm-gpg/10/RPM-GPG-KEY-redhat-release @@ -0,0 +1,67 @@ +The following public key can be used to verify RPM packages built and +signed by Red Hat, Inc. This key is used for packages in Red Hat +products shipped after November 2009, and for all updates to those +products. + +Questions about this key should be sent to security@redhat.com. + +pub 4096R/FD431D51 2009-10-22 Red Hat, Inc. (release key 2) + +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBErgSTsBEACh2A4b0O9t+vzC9VrVtL1AKvUWi9OPCjkvR7Xd8DtJxeeMZ5eF +0HtzIG58qDRybwUe89FZprB1ffuUKzdE+HcL3FbNWSSOXVjZIersdXyH3NvnLLLF +0DNRB2ix3bXG9Rh/RXpFsNxDp2CEMdUvbYCzE79K1EnUTVh1L0Of023FtPSZXX0c +u7Pb5DI5lX5YeoXO6RoodrIGYJsVBQWnrWw4xNTconUfNPk0EGZtEnzvH2zyPoJh +XGF+Ncu9XwbalnYde10OCvSWAZ5zTCpoLMTvQjWpbCdWXJzCm6G+/hx9upke546H +5IjtYm4dTIVTnc3wvDiODgBKRzOl9rEOCIgOuGtDxRxcQkjrC+xvg5Vkqn7vBUyW +9pHedOU+PoF3DGOM+dqv+eNKBvh9YF9ugFAQBkcG7viZgvGEMGGUpzNgN7XnS1gj +/DPo9mZESOYnKceve2tIC87p2hqjrxOHuI7fkZYeNIcAoa83rBltFXaBDYhWAKS1 +PcXS1/7JzP0ky7d0L6Xbu/If5kqWQpKwUInXtySRkuraVfuK3Bpa+X1XecWi24JY +HVtlNX025xx1ewVzGNCTlWn1skQN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+FCNmk/wkaQfH4Pv+jVsOgHqkV3aLqJeN +kNUnpyEKYkNqo7mNfNVWOcl+Z1KKKwSkIi3vg8maC7rODsy6IX+Y96M93sqYDQom +aaWue2gvw6thEoH4SaCrCL78mj2YFpeg1Oew4QwVcBnt68KOPfL9YyoOicNs4Vuu +fb/vjU2ONPZAeepIKA8QxCETiryCcP43daqThvIgdbUIiWne3gae6eSj0EuUPoYe +H5g2Lw0qdwbHIOxqp2kvN96Ii7s1DK3VyhMt/GSPCxRnDRJ8oQKJ2W/I1IT5VtiU +zMjjq5JcYzRPzHDxfVzT9CLeU/0XQ+2OOUAiZKZ0dzSyyVn8xbpviT7iadvjlQX3 +CINaPB+d2Kxa6uFWh+ZYOLLAgZ9B8NKutUHpXN66YSfe79xFBSFWKkJ8cSIMk13/ +Ifs7ApKlKCCRDpwoDqx/sjIaj1cpOfLHYjnefg== +=UZd/ +-----END PGP PUBLIC KEY BLOCK----- + diff --git a/repos/system_upgrade/common/files/rpm-gpg/10beta/RPM-GPG-KEY-redhat-release b/repos/system_upgrade/common/files/rpm-gpg/10beta/RPM-GPG-KEY-redhat-release new file mode 100644 index 0000000000..1f46baa1df --- /dev/null +++ b/repos/system_upgrade/common/files/rpm-gpg/10beta/RPM-GPG-KEY-redhat-release @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.2.6 (GNU/Linux) + +mQINBEmkAzABEAC2/c7bP1lHQ3XScxbIk0LQWe1YOiibQBRLwf8Si5PktgtuPibT +kKpZjw8p4D+fM7jD1WUzUE0X7tXg2l/eUlMM4dw6XJAQ1AmEOtlwSg7rrMtTvM0A +BEtI7Km6fC6sU6RtBMdcqD1cH/6dbsfh8muznVA7UlX+PRBHVzdWzj6y8h84dBjo +gzcbYu9Hezqgj/lLzicqsSZPz9UdXiRTRAIhp8V30BD8uRaaa0KDDnD6IzJv3D9P +xQWbFM4Z12GN9LyeZqmD7bpKzZmXG/3drvfXVisXaXp3M07t3Nl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0 +B6x+DV7mJQH7MGmRXQsE7TLBJKjq28Cn4tVp04PmybQyTxZdGA/8zY6pPl6xyVMH +V68hSBKEVT/rlouOHuxfdmZva1DhVvUC6Xj7+iTMTVJUAq/4Uyn31P1OJmA2a0PT +CAqWkbJSgKFccsjPoTbLyxhuMSNkEZFHvlZrSK9vnPzmfiRH0Orx3wYpMQ== +=21pb +-----END PGP PUBLIC KEY BLOCK----- + diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py index 285f1e027a..9b6fbba44e 100644 --- a/repos/system_upgrade/common/libraries/config/version.py +++ b/repos/system_upgrade/common/libraries/config/version.py @@ -17,7 +17,7 @@ # Note: 'rhel-alt' is detected when on 'rhel' with kernel 4.x '7': {'rhel': ['7.9'], 'rhel-alt': [], 'rhel-saphana': ['7.9']}, '8': {'rhel': ['8.6', '8.8', '8.9', '8.10'], 'rhel-saphana': ['8.6', '8.8', '8.10']}, - '9': {'rhel': ['9.6'], 'rhel-saphana': ['9.6']}, + '9': {'rhel': ['9.4', '9.5'], 'rhel-saphana': ['9.4', '9.5']}, } diff --git a/repos/system_upgrade/common/libraries/dnfplugin.py b/repos/system_upgrade/common/libraries/dnfplugin.py index fbd58246f8..c956a2629b 100644 --- a/repos/system_upgrade/common/libraries/dnfplugin.py +++ b/repos/system_upgrade/common/libraries/dnfplugin.py @@ -21,6 +21,7 @@ class _DnfPluginPathStr(str): _PATHS = { "8": os.path.join('/lib/python3.6/site-packages/dnf-plugins', DNF_PLUGIN_NAME), "9": os.path.join('/lib/python3.9/site-packages/dnf-plugins', DNF_PLUGIN_NAME), + "10": os.path.join('/lib/python3.12/site-packages/dnf-plugins', DNF_PLUGIN_NAME), } def __init__(self): # noqa: W0231; pylint: disable=super-init-not-called diff --git a/repos/system_upgrade/el8toel9/actors/kernel/checkkpatch/actor.py b/repos/system_upgrade/el8toel9/actors/kernel/checkkpatch/actor.py deleted file mode 100644 index e7f6179cb5..0000000000 --- a/repos/system_upgrade/el8toel9/actors/kernel/checkkpatch/actor.py +++ /dev/null @@ -1,29 +0,0 @@ -from leapp.actors import Actor -from leapp.libraries.common.rpms import has_package -from leapp.libraries.stdlib import api -from leapp.models import CopyFile, DistributionSignedRPM, TargetUserSpacePreupgradeTasks -from leapp.tags import ChecksPhaseTag, IPUWorkflowTag - -PLUGIN_PKGNAME = "kpatch-dnf" -CONFIG_PATH = "/etc/dnf/plugins/kpatch.conf" - - -class CheckKpatch(Actor): - """ - Carry over kpatch-dnf and it's config into the container - - Check is kpatch-dnf plugin is installed and if it is, install it and copy - over the config file so that the plugin can make a decision on whether any - kpatch-patch packages need to be installed during in-place upgrade. - """ - - name = 'check_kpatch' - consumes = (DistributionSignedRPM,) - produces = (TargetUserSpacePreupgradeTasks,) - tags = (IPUWorkflowTag, ChecksPhaseTag) - - def process(self): - if has_package(DistributionSignedRPM, PLUGIN_PKGNAME): - api.produce(TargetUserSpacePreupgradeTasks( - install_rpms=[PLUGIN_PKGNAME], - copy_files=[CopyFile(src=CONFIG_PATH)])) diff --git a/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/actor.py b/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/actor.py deleted file mode 100644 index db2a6ebcaa..0000000000 --- a/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/actor.py +++ /dev/null @@ -1,68 +0,0 @@ -from leapp.actors import Actor -from leapp.libraries.actor import vdoconversionscanner -from leapp.models import DistributionSignedRPM, StorageInfo, VdoConversionInfo -from leapp.tags import FactsPhaseTag, IPUWorkflowTag - - -class VdoConversionScanner(Actor): - """ - Provides conversion info about VDO devices. - - A VdoConversionInfo message containing the data will be produced. - - In RHEL 9.0 the independent VDO management software, `vdo manager`, is - superseded by LVM management. Existing VDOs must be converted to LVM-based - management *before* upgrading to RHEL 9.0. - - The `VdoConversionScanner` actor provides a pre-upgrade check for VDO - devices. Consuming the StorageInfo model `VdoConversionScanner` iterates - over the contained lsblk information and checks each disk or partition for - being a VDO device. There are four categories of devices in the eyes of - `VdoConversionScanner`: - - - not a VDO device - - a pre-conversion VDO device - - a post-conversion VDO device - - a device not falling into any of the above - - Attempts to definitively identify a device as belonging to one of the first - three listed categories above may fail. These devices may or may not be an - issue for upgrade. - - If a device could not be identified as either a VDO device or not results - in that device's information being recorded in a - VdoConversionUndeterminedDevice model. This includes both the situation - where LVM is installed on the system but the VDO management software is - not as well as the situation where both are installed but the check of - the device encountered an unexpected error. - - Devices identified as not a VDO device are skipped. - - Devices identified as pre-conversion VDOs have their identifying data - stored in a VdoConversionPreDevice model; their simple existence is - sufficient reason to prevent upgrade. - - A post-conversion (at VDO level) VDO device may not have completed its - conversion to LVM-based management (e.g., via a poorly timed system crash - during the conversion). For those VDO device's identified as - post-conversion `VdoConversionScanner` performs an additional check to - determine if the device is identified by blkid as an LVM2_member. As the - invocation of blkid may fail for reasons outside this scanner's control if - such happens the device's completion status will be set to indicate it did - not complete conversion. - - The generated VdoConversionPostDevice, VdoConversionPreDevice and - VdoConversionUndeterminedDevice models are used together to produce the - VdoConversionInfo model. This latter model is consumed by the CheckVdo - actor (executed during ChecksPhase) which, based on the contents of the - model, may produce upgrade inhibitory reports. - """ - - name = 'vdo_conversion_scanner' - consumes = (DistributionSignedRPM, StorageInfo) - produces = (VdoConversionInfo,) - tags = (IPUWorkflowTag, FactsPhaseTag) - - def process(self): - for storage_info in self.consume(StorageInfo): - self.produce(vdoconversionscanner.get_info(storage_info)) diff --git a/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/libraries/vdoconversionscanner.py b/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/libraries/vdoconversionscanner.py deleted file mode 100644 index fc325e2770..0000000000 --- a/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/libraries/vdoconversionscanner.py +++ /dev/null @@ -1,125 +0,0 @@ -import os - -from leapp import models -from leapp.libraries.common import rpms -from leapp.libraries.stdlib import api, run - -MIN_DISK_SIZE = 2 ** 22 # 4 MiB - - -def _check_vdo_lvm_managed(device): - """ - Determines if the specified device (which has already been identified - as a post-conversion vdo device (at the level of vdo) is managed by lvm. - """ - command = ['blkid', '--match-token', 'TYPE=LVM2_member', device] - result = run(command, checked=False) - exit_code = result['exit_code'] - # 0: Is LVM managed - # 2: Is not LVM manaaged - # other: Unexpected - return exit_code - - -def _check_vdo_pre_conversion(device): - """ - Identify if the specified device is either not a vdo device, a - pre-conversion vdo device or a post-conversion vdo device. - """ - command = ['/usr/libexec/vdoprepareforlvm', '--check', device] - result = run(command, checked=False) - exit_code = result['exit_code'] - # 255: Not a vdo device - # 0: A post-conversion vdo device - # 1: A pre-conversion vdo device - # other: Unexpected - return exit_code - - -def _lvm_package_installed(): - return rpms.has_package(models.DistributionSignedRPM, 'lvm2') - - -def _vdo_package_installed(): - return rpms.has_package(models.DistributionSignedRPM, 'vdo') - - -def get_info(storage_info): - pre_conversion_devices = [] - post_conversion_devices = [] - undetermined_conversion_devices = [] - - # Only if lvm is installed can there be VDO instances. - if _lvm_package_installed(): - vdo_package_installed = _vdo_package_installed() - - for lsblk in storage_info.lsblk: - # NOTE: partitions < MIN_DISK_SIZE cannot be handled by vdo and - # the check results in unexpected outputs - if lsblk.tp not in ('disk', 'part') or lsblk.bsize < MIN_DISK_SIZE: - continue - - if not vdo_package_installed: - undetermined_conversion_devices.append( - models.VdoConversionUndeterminedDevice(name=lsblk.name)) - continue - - # refer to kernel name - device = '/dev/{0}'.format(lsblk.kname) - if not os.path.exists(device): - # NOTE: Corner case. It's hypothetical situation which could possibly - # happen but we do not know under what circumstances and we do not - # have time now for investigation. Let's see if someone report it - # to us so we will have a data :) - # For now, stay on the safe side and inhibit the upgrade if this - # happens. - failure = ( - 'cannot check device {0} (kernel name: {1}): file {2} does not exist' - .format(lsblk.name, lsblk.kname, device) - ) - api.current_logger().warning(failure) - undetermined_conversion_devices.append( - models.VdoConversionUndeterminedDevice( - name=lsblk.name, - check_failed=True, - failure=failure - ) - ) - continue - result = _check_vdo_pre_conversion(device) - if result not in (255, 0, 1): - failure = ( - 'unexpected error from \'vdoprepareforlvm\' for {0}; result = {1}' - .format(lsblk.name, result) - ) - undetermined_conversion_devices.append( - models.VdoConversionUndeterminedDevice( - name=lsblk.name, - check_failed=True, - failure=failure - ) - ) - continue - - if result == 255: - # Not a vdo. - continue - - if result: - pre_conversion_devices.append( - models.VdoConversionPreDevice(name=lsblk.name)) - else: - result = _check_vdo_lvm_managed(device) - failure = (None if result in (0, 2) else - 'unexpected error from \'blkid\' for {0}; ' - 'result = {1}'.format(lsblk.name, result)) - - post_conversion_devices.append( - models.VdoConversionPostDevice(name=lsblk.name, - complete=(not result), - check_failed=(failure is not None), - failure=failure)) - - return models.VdoConversionInfo(pre_conversion=pre_conversion_devices, - post_conversion=post_conversion_devices, - undetermined_conversion=undetermined_conversion_devices) diff --git a/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/tests/unit_test_vdoconversionscanner.py b/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/tests/unit_test_vdoconversionscanner.py deleted file mode 100644 index 0745c91da6..0000000000 --- a/repos/system_upgrade/el8toel9/actors/vdoconversionscanner/tests/unit_test_vdoconversionscanner.py +++ /dev/null @@ -1,281 +0,0 @@ -import functools -import os -import random - -from leapp import models, reporting -from leapp.libraries.actor import vdoconversionscanner -from leapp.libraries.common.testutils import create_report_mocked - - -def aslist(f): - """ Decorator used to convert generator to list """ - @functools.wraps(f) - def inner(*args, **kwargs): - return list(f(*args, **kwargs)) - return inner - - -def _lsblk_entry(prefix, number, types, size='128G', bsize=2 ** 37): - lsblk_entry_name = '{0}{1}'.format(prefix, number) - return models.LsblkEntry( - name=lsblk_entry_name, - kname=lsblk_entry_name, - maj_min='253:{0}'.format(number), - rm='0', - size=size, - bsize=bsize, - ro='0', - tp=types[random.randint(0, len(types) - 1)], - mountpoint='') - - -@aslist -def _lsblk_entries(pre=0, post=0, complete=0, undetermined=0, small=0, missing=0): - - begin = pre - for x in range(begin): - yield _lsblk_entry('vdo_pre_', x, ['disk', 'part']) - begin += pre - - for x in range(begin, begin + complete): - yield _lsblk_entry('vdo_post_complete_', x, ['disk', 'part']) - begin += complete - - for x in range(begin, begin + (post - complete)): - yield _lsblk_entry('vdo_post_', x, ['disk', 'part']) - begin += post - complete - - for x in range(begin, begin + undetermined): - yield _lsblk_entry('vdo_undetermined_', x, ['disk', 'part']) - begin += undetermined - - for x in range(begin, begin + small): - # this one will not be undetermined. We want to test this one is actually really - # skipped, so we do not find it in the list - yield _lsblk_entry('vdo_undetermined_small_skipped', x, ['disk', 'part'], size='2K', bsize=2 ** 11) - begin += small - - for x in range(begin, begin + missing): - yield _lsblk_entry('vdo_undetermined_missing_', x, ['disk', 'part']) - - -def _storage_info(pre=0, post=0, complete=0, undetermined=0, small=0, missing=0): - return models.StorageInfo(lsblk=_lsblk_entries(pre, post, complete, undetermined, small, missing)) - - -def _check_vdo_lvm_managed(device): - device = os.path.split(device)[-1] - code = 2 - if device.startswith('vdo_') and ("_post_" in device) and ("_complete_" in device): - code = 0 - return code - - -def _check_vdo_pre_conversion(device): - device = os.path.split(device)[-1] - code = 255 - if device.startswith('vdo_'): - code = -1 if '_undetermined_' in device else 1 if "_pre_" in device else 0 - return code - - -def test_check_vdo_pre_conversion(monkeypatch): - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_lvm_managed', _check_vdo_lvm_managed) - monkeypatch.setattr(os.path, 'exists', lambda dummy_file: True) - - monkeypatch.setattr(vdoconversionscanner, 'run', lambda _, checked: {'exit_code': 0}) - info = vdoconversionscanner.get_info(_storage_info(pre=1)) - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (len(info.post_conversion) == 1) - assert not info.post_conversion[0].complete - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - monkeypatch.setattr(vdoconversionscanner, 'run', lambda _, checked: {'exit_code': 1}) - info = vdoconversionscanner.get_info(_storage_info(pre=1)) - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (len(info.pre_conversion) == 1) - assert isinstance(info.post_conversion, list) and (not info.post_conversion) - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - monkeypatch.setattr(vdoconversionscanner, 'run', lambda _, checked: {'exit_code': 255}) - info = vdoconversionscanner.get_info(_storage_info(pre=1)) - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (not info.post_conversion) - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - monkeypatch.setattr(vdoconversionscanner, 'run', lambda _, checked: {'exit_code': -1}) - info = vdoconversionscanner.get_info(_storage_info(pre=1)) - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (not info.post_conversion) - assert isinstance(info.undetermined_conversion, list) and (len(info.undetermined_conversion) == 1) - - -def test_check_vdo_lvm_managed(monkeypatch): - monkeypatch.setattr(os.path, 'exists', lambda dummy_file: True) - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_pre_conversion', _check_vdo_pre_conversion) - - monkeypatch.setattr(vdoconversionscanner, 'run', lambda _, checked: {'exit_code': 0}) - info = vdoconversionscanner.get_info(_storage_info(post=1)) - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (len(info.post_conversion) == 1) - assert info.post_conversion[0].complete - assert not info.post_conversion[0].failure - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - monkeypatch.setattr(vdoconversionscanner, 'run', lambda _, checked: {'exit_code': 2}) - info = vdoconversionscanner.get_info(_storage_info(post=1)) - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (len(info.post_conversion) == 1) - assert not info.post_conversion[0].complete - assert not info.post_conversion[0].failure - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - monkeypatch.setattr(vdoconversionscanner, 'run', lambda _, checked: {'exit_code': -1}) - info = vdoconversionscanner.get_info(_storage_info(post=1)) - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (len(info.post_conversion) == 1) - assert not info.post_conversion[0].complete - assert info.post_conversion[0].failure - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - -def test_lvm_package_not_installed(monkeypatch): - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: False) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: False) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_pre_conversion', _check_vdo_pre_conversion) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_lvm_managed', _check_vdo_lvm_managed) - - pre = 0 - post = 0 - complete = 0 - undetermined = 5 - - info = vdoconversionscanner.get_info(_storage_info(pre, post, complete, undetermined)) - - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (not info.post_conversion) - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - -def test_no_vdo_devices(monkeypatch): - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_pre_conversion', _check_vdo_pre_conversion) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_lvm_managed', _check_vdo_lvm_managed) - - info = vdoconversionscanner.get_info(_storage_info()) - - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (not info.post_conversion) - assert isinstance(info.undetermined_conversion, list) and (not info.undetermined_conversion) - - -def test_vdo_devices(monkeypatch): - monkeypatch.setattr(os.path, 'exists', lambda dummy_file: True) - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_pre_conversion', _check_vdo_pre_conversion) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_lvm_managed', _check_vdo_lvm_managed) - - pre = 5 - post = 7 - complete = 3 - undetermined = 2 - - info = vdoconversionscanner.get_info(_storage_info(pre, post, complete, undetermined)) - - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (len(info.pre_conversion) == pre) - assert isinstance(info.post_conversion, list) and (len(info.post_conversion) == post) - assert len([x for x in info.post_conversion if x.complete]) == complete - assert (isinstance(info.undetermined_conversion, list) and - (len(info.undetermined_conversion) == undetermined)) - - -def test_vdo_package_not_installed(monkeypatch): - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: False) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_pre_conversion', _check_vdo_pre_conversion) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_lvm_managed', _check_vdo_lvm_managed) - - pre = 5 - post = 7 - complete = 3 - undetermined = 2 - - info = vdoconversionscanner.get_info(_storage_info(pre, post, complete, undetermined)) - - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (not info.post_conversion) - assert isinstance(info.undetermined_conversion, list) - assert len(info.undetermined_conversion) == (pre + post + undetermined) - - -def test_missing_devices(monkeypatch): - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_pre_conversion', _check_vdo_pre_conversion) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_lvm_managed', _check_vdo_lvm_managed) - monkeypatch.setattr(os.path, 'exists', lambda fname: '_missing_' not in fname) - - complete = 1 - undetermined = 2 - missing = 1 - - info = vdoconversionscanner.get_info(_storage_info( - complete=complete, undetermined=undetermined, missing=missing - )) - - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (len(info.post_conversion) == complete) - assert isinstance(info.undetermined_conversion, list) - assert len([x for x in info.post_conversion if x.complete]) == complete - assert len(info.undetermined_conversion) == (undetermined + missing) - missing_detected = False - for item in info.undetermined_conversion: - if 'does not exist' in item.failure and '_missing_' in item.name: - missing_detected = True - assert missing_detected - - -def test_small_partition_skip(monkeypatch): - monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) - monkeypatch.setattr(vdoconversionscanner, '_lvm_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_vdo_package_installed', lambda: True) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_pre_conversion', _check_vdo_pre_conversion) - monkeypatch.setattr(vdoconversionscanner, '_check_vdo_lvm_managed', _check_vdo_lvm_managed) - monkeypatch.setattr(os.path, 'exists', lambda fname: '_missing_' not in fname) - - undetermined = 2 - small = 2 - - info = vdoconversionscanner.get_info(_storage_info(undetermined=undetermined, small=small)) - - assert isinstance(info, models.VdoConversionInfo) - assert isinstance(info.pre_conversion, list) and (not info.pre_conversion) - assert isinstance(info.post_conversion, list) and (not info.post_conversion) - assert isinstance(info.undetermined_conversion, list) - assert len(info.undetermined_conversion) == undetermined - for item in info.undetermined_conversion: - assert 'small' not in item.name