-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathcpu_arch.py
More file actions
59 lines (50 loc) · 2.14 KB
/
cpu_arch.py
File metadata and controls
59 lines (50 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright (c) 2025
#
# SUSE Linux LLC. All rights reserved.
#
# This file is part of suse-migration-services.
#
# suse-migration-services is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# suse-migration-services is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with suse-migration-services. If not, see <http://www.gnu.org/licenses/>
"""Module for checking for CPU architecture support"""
import logging
import os
from suse_migration_services.defaults import Defaults
from suse_migration_services.command import Command
from suse_migration_services.migration_target import MigrationTarget
def x86_64_version():
"""Function to check whether current CPU architecture is new enough to support SLE16"""
target = MigrationTarget.get_migration_target()
if target.get('version') != '16.0':
# This check is only necessary for migration to SLE16
return
log = logging.getLogger(Defaults.get_migration_log_name())
os.environ['ZYPP_READONLY_HACK'] = '1'
zypper_call = Command.run(['zypper', 'system-architecture'])
arch = zypper_call.output
if arch.strip().lower() == "x86_64":
log.error(
'SLE16 requires x86_64_v2 at minimum. The architecture version '
'of this system is too old.'
)
def cpu_arch(migration_system=False):
"""Function for CPU architecture related checks"""
if migration_system:
# This check must not be called inside of the
# migration system live iso or container image.
# It will only be useful on the system to migrate
# at install time of the Migration package or on
# manual user invocation of suse-migration-pre-checks
# prior the actual migration.
return
x86_64_version()