-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrhel10_compatibility_check.py
More file actions
243 lines (190 loc) · 8.1 KB
/
rhel10_compatibility_check.py
File metadata and controls
243 lines (190 loc) · 8.1 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#!/usr/bin/env python3
"""
RHEL 10/CentOS Stream 10 Compatibility Checker
Validates system compatibility with RHEL 10/CentOS Stream 10 requirements
as identified in ADR-0026 and the PRD analysis.
"""
import subprocess
import sys
import platform
from typing import Dict, Any
class RHEL10CompatibilityChecker:
"""Check system compatibility with RHEL 10/CentOS Stream 10"""
def __init__(self):
self.results = {}
def check_all(self) -> Dict[str, Any]:
"""Run all compatibility checks"""
print("🔍 RHEL 10/CentOS Stream 10 Compatibility Check")
print("=" * 60)
self.check_os_version()
self.check_microarchitecture()
self.check_python_version()
self.check_kernel_version()
self.check_removed_packages()
self.print_summary()
return self.results
def check_os_version(self):
"""Check current OS version"""
print("\n📋 Operating System Check")
print("-" * 30)
try:
with open("/etc/redhat-release", "r") as f:
os_release = f.read().strip()
print(f"Current OS: {os_release}")
# Check if it's CentOS Stream 10 or RHEL 10
is_compatible = False
if "CentOS Stream release 10" in os_release:
is_compatible = True
print("✅ CentOS Stream 10 detected - Compatible!")
elif "Red Hat Enterprise Linux release 10" in os_release:
is_compatible = True
print("✅ RHEL 10 detected - Compatible!")
else:
print("⚠️ Not RHEL 10 or CentOS Stream 10")
self.results["os_compatible"] = is_compatible
self.results["os_version"] = os_release
except FileNotFoundError:
print("❌ Could not determine OS version")
self.results["os_compatible"] = False
def check_microarchitecture(self):
"""Check x86_64-v3 microarchitecture compatibility"""
print("\n🏗️ Microarchitecture Check (x86_64-v3)")
print("-" * 40)
required_flags = [
"avx",
"avx2",
"bmi1",
"bmi2",
"f16c",
"fma",
"lzcnt",
"movbe",
"xsave",
]
try:
with open("/proc/cpuinfo", "r") as f:
cpuinfo = f.read()
# Find CPU flags
flags_line = None
for line in cpuinfo.split("\n"):
if line.startswith("flags"):
flags_line = line
break
if not flags_line:
print("❌ Could not read CPU flags")
self.results["microarch_compatible"] = False
return
cpu_flags = flags_line.lower().split()
missing_flags = [flag for flag in required_flags if flag not in cpu_flags]
print(f"Required x86_64-v3 flags: {', '.join(required_flags)}")
if not missing_flags:
print("✅ All x86_64-v3 CPU flags present - Compatible!")
self.results["microarch_compatible"] = True
else:
print(f"❌ Missing CPU flags: {', '.join(missing_flags)}")
print("⚠️ This system does NOT meet x86_64-v3 requirements")
print(" RHEL 10/CentOS 10 will NOT run on this hardware")
self.results["microarch_compatible"] = False
self.results["missing_cpu_flags"] = missing_flags
except Exception as e:
print(f"❌ Error checking microarchitecture: {e}")
self.results["microarch_compatible"] = False
def check_python_version(self):
"""Check Python version (should be 3.12+ for RHEL 10)"""
print("\n🐍 Python Version Check")
print("-" * 25)
try:
result = subprocess.run(["python3", "--version"], capture_output=True, text=True, check=True)
version_str = result.stdout.strip()
print(f"Current Python: {version_str}")
# Parse version
version_parts = version_str.split()[1].split(".")
major, minor = int(version_parts[0]), int(version_parts[1])
if (major, minor) >= (3, 12):
print("✅ Python 3.12+ detected - Compatible!")
self.results["python_compatible"] = True
else:
print("⚠️ Python 3.12+ recommended for RHEL 10")
self.results["python_compatible"] = False
self.results["python_version"] = (major, minor)
except Exception as e:
print(f"❌ Error checking Python version: {e}")
self.results["python_compatible"] = False
def check_kernel_version(self):
"""Check kernel version (should be 6.x+ for RHEL 10)"""
print("\n🔧 Kernel Version Check")
print("-" * 25)
try:
kernel_version = platform.release()
print(f"Current Kernel: {kernel_version}")
# Parse version
version_parts = kernel_version.split(".")
major = int(version_parts[0])
if major >= 6:
print("✅ Kernel 6.x+ detected - Compatible!")
self.results["kernel_compatible"] = True
else:
print("⚠️ Kernel 6.x+ expected for RHEL 10")
self.results["kernel_compatible"] = False
self.results["kernel_version"] = kernel_version
except Exception as e:
print(f"❌ Error checking kernel version: {e}")
self.results["kernel_compatible"] = False
def check_removed_packages(self):
"""Check for packages removed in RHEL 10"""
print("\n📦 Removed Packages Check")
print("-" * 28)
removed_packages = [
"xorg-x11-server-Xorg", # Xorg server
"libreoffice-core", # LibreOffice
"gimp", # GIMP
"redis", # Redis
"oscap-anaconda-addon", # OpenSCAP Anaconda addon
]
print("Packages removed in RHEL 10/CentOS Stream 10:")
for package in removed_packages:
print(f" ❌ {package}")
print("\n💡 Note: These packages are no longer available in RHEL 10")
print(" Update your deployment scripts to use alternatives")
self.results["removed_packages"] = removed_packages
def print_summary(self):
"""Print compatibility summary"""
print("\n" + "=" * 60)
print("🎯 COMPATIBILITY SUMMARY")
print("=" * 60)
checks = [
("OS Version", self.results.get("os_compatible", False)),
("x86_64-v3 Architecture", self.results.get("microarch_compatible", False)),
("Python 3.12+", self.results.get("python_compatible", False)),
("Kernel 6.x+", self.results.get("kernel_compatible", False)),
]
all_compatible = True
for check_name, compatible in checks:
status = "✅ PASS" if compatible else "❌ FAIL"
print(f"{check_name:.<25} {status}")
if not compatible:
all_compatible = False
print("-" * 60)
if all_compatible:
print("🎉 SYSTEM IS COMPATIBLE with RHEL 10/CentOS Stream 10!")
print(" You can proceed with Qubinode Navigator deployment.")
else:
print("⚠️ SYSTEM HAS COMPATIBILITY ISSUES")
print(" Some features may not work correctly.")
# Specific recommendations
if not self.results.get("microarch_compatible", False):
print("\n🚨 CRITICAL: x86_64-v3 microarchitecture required!")
print(" This system cannot run RHEL 10/CentOS Stream 10.")
print(" Consider upgrading hardware or using RHEL 9 instead.")
self.results["overall_compatible"] = all_compatible
def main():
"""Main entry point"""
checker = RHEL10CompatibilityChecker()
results = checker.check_all()
# Exit with appropriate code
if results.get("overall_compatible", False):
sys.exit(0)
else:
sys.exit(1)
if __name__ == "__main__":
main()