From f5adf078b700d60e5863e03cb71401e546789f2f Mon Sep 17 00:00:00 2001 From: Petr Stodulka Date: Wed, 18 May 2022 10:34:36 +0200 Subject: [PATCH 26/39] Drop the checkcpu actor from the el8toel9 repo The actor has been supposed to be removed a time ago already as this functionality is handled in generic way by common/actors/checkdetecteddevicesanddrivers As this actor still exists it breaks the expectation the CPU check is driven by the `device_driver_deprecation_data.json` file. Regarding that, we cannot dynamically react to changes around supported CPUs on s390x (IBM Z) architecture for IPU 8 -> 9. This relates to BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2087664 The bz is reported for IPU 7 -> 8, however the problem is on IPU 8 -> 9 as well and we cannot handle via data files due to this actor. So dropping it. --- .../el8toel9/actors/checkcpu/actor.py | 23 -------- .../el8toel9/actors/checkcpu/libraries/cpu.py | 41 ------------- .../actors/checkcpu/tests/test_checkcpu.py | 57 ------------------- 3 files changed, 121 deletions(-) delete mode 100644 repos/system_upgrade/el8toel9/actors/checkcpu/actor.py delete mode 100644 repos/system_upgrade/el8toel9/actors/checkcpu/libraries/cpu.py delete mode 100644 repos/system_upgrade/el8toel9/actors/checkcpu/tests/test_checkcpu.py diff --git a/repos/system_upgrade/el8toel9/actors/checkcpu/actor.py b/repos/system_upgrade/el8toel9/actors/checkcpu/actor.py deleted file mode 100644 index 7b61bd34..00000000 --- a/repos/system_upgrade/el8toel9/actors/checkcpu/actor.py +++ /dev/null @@ -1,23 +0,0 @@ -from leapp.actors import Actor -from leapp.libraries.actor import cpu -from leapp.models import CPUInfo, Report -from leapp.tags import ChecksPhaseTag, IPUWorkflowTag - - -class CheckCPU(Actor): - """ - Check whether the CPU is supported by the target system. Inhibit upgrade if not. - - Currently we know just about cases with s390x where the set of CPUs supported - by RHEL 9 is subset of CPUs supported on RHEL 8. We can detect such cases based - on the machine field inside the /proc/cpuinfo file. expected values of the - field on supported machines are: 3906, 3907, 8561, 8562. - """ - - name = "checkcpu" - consumes = (CPUInfo,) - produces = (Report,) - tags = (ChecksPhaseTag, IPUWorkflowTag,) - - def process(self): - cpu.process() diff --git a/repos/system_upgrade/el8toel9/actors/checkcpu/libraries/cpu.py b/repos/system_upgrade/el8toel9/actors/checkcpu/libraries/cpu.py deleted file mode 100644 index 79682247..00000000 --- a/repos/system_upgrade/el8toel9/actors/checkcpu/libraries/cpu.py +++ /dev/null @@ -1,41 +0,0 @@ - -from leapp import reporting -from leapp.exceptions import StopActorExecutionError -from leapp.libraries.common.config import architecture -from leapp.libraries.stdlib import api -from leapp.models import CPUInfo - -SUPPORTED_MACHINE_TYPES = [3906, 3907, 8561, 8562] - - -def process(): - if not architecture.matches_architecture(architecture.ARCH_S390X): - return - cpuinfo = next(api.consume(CPUInfo), None) - if cpuinfo is None: - raise StopActorExecutionError(message=("Missing information about CPU.")) - - if not cpuinfo.machine_type: - # this is not expected to happen, but in case... - api.current_logger().warning("The machine (CPU) type is empty.") - - if cpuinfo.machine_type not in SUPPORTED_MACHINE_TYPES: - summary = ("The system is not possible to upgrade because of unsupported" - " type of the processor. Based on the official documentation," - " z14 and z15 processors are supported on the Red Hat Enterprise" - " Linux 9 system for the IBM Z architecture. The supported processors" - " have machine types {}. The detected machine type of the CPU is '{}'." - .format(", ".join([str(i) for i in SUPPORTED_MACHINE_TYPES]), cpuinfo.machine_type)) - report = [ - reporting.Title("The processor is not supported by the target system."), - reporting.Summary(summary), - reporting.Severity(reporting.Severity.HIGH), - reporting.Tags([reporting.Tags.SANITY]), - reporting.Flags([reporting.Flags.INHIBITOR]), - reporting.ExternalLink( - title="Considerations in adopting RHEL 8", - url=("https://access.redhat.com/ecosystem/hardware/#/search?p=1&" - "c_version=Red%20Hat%20Enterprise%20Linux%208&ch_architecture=s390x")) - ] - # FIXME(dhorak): update the URL to the document once it exists - reporting.create_report(report) diff --git a/repos/system_upgrade/el8toel9/actors/checkcpu/tests/test_checkcpu.py b/repos/system_upgrade/el8toel9/actors/checkcpu/tests/test_checkcpu.py deleted file mode 100644 index 9cb11986..00000000 --- a/repos/system_upgrade/el8toel9/actors/checkcpu/tests/test_checkcpu.py +++ /dev/null @@ -1,57 +0,0 @@ -import logging - -import pytest - -from leapp import reporting -from leapp.exceptions import StopActorExecutionError -from leapp.libraries.actor import cpu -from leapp.libraries.common import testutils -from leapp.libraries.common.config import architecture -from leapp.libraries.common.testutils import CurrentActorMocked -from leapp.libraries.stdlib import api -from leapp.models import CPUInfo - - -def test_non_ibmz_arch(monkeypatch): - monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(architecture.ARCH_X86_64)) - monkeypatch.setattr(reporting, "create_report", testutils.create_report_mocked()) - cpu.process() - assert not reporting.create_report.called - - -def test_ibmz_arch_missing_cpuinfo(monkeypatch): - monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(architecture.ARCH_S390X)) - monkeypatch.setattr(reporting, "create_report", testutils.create_report_mocked()) - monkeypatch.setattr(api, 'consume', lambda x: iter([])) - with pytest.raises(StopActorExecutionError): - cpu.process() - assert not reporting.create_report.called - - -def test_ibmz_cpu_supported(monkeypatch): - monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(architecture.ARCH_S390X)) - monkeypatch.setattr(reporting, "create_report", testutils.create_report_mocked()) - for sup_arch in cpu.SUPPORTED_MACHINE_TYPES: - monkeypatch.setattr(api, 'consume', lambda x: iter([CPUInfo(machine_type=sup_arch)])) - cpu.process() - assert not reporting.create_report.called - - -def test_ibmz_cpu_unsupported(monkeypatch): - title_msg = 'The processor is not supported by the target system.' - monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(architecture.ARCH_S390X)) - monkeypatch.setattr(api, 'consume', lambda x: iter([CPUInfo(machine_type=666)])) - monkeypatch.setattr(reporting, "create_report", testutils.create_report_mocked()) - cpu.process() - assert reporting.create_report.called - assert title_msg == reporting.create_report.report_fields['title'] - assert reporting.Flags.INHIBITOR in reporting.create_report.report_fields['flags'] - - -def test_ibmz_cpu_is_empty(monkeypatch, caplog): - monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(architecture.ARCH_S390X)) - monkeypatch.setattr(reporting, "create_report", testutils.create_report_mocked()) - monkeypatch.setattr(api, 'consume', lambda x: iter([CPUInfo(machine_type=None)])) - with caplog.at_level(logging.DEBUG): - cpu.process() - assert 'The machine (CPU) type is empty.' in caplog.text -- 2.35.3