migration-tools/0075-detection-basic-information-and-format-abi-compatibility-information-to-report.patch

88 lines
3.3 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From ce89ad8b486b2151243c4ba03f6a5778f353ac1f Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 14:02:56 +0800
Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E5=90=88=E5=9F=BA=E7=A1=80=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E5=92=8CABI=E5=85=BC=E5=AE=B9=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E5=88=B0=E6=8A=A5=E5=91=8A=E5=B9=B6=E8=B0=83=E6=95=B4=E6=A0=BC?=
=?UTF-8?q?=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/Abisystmcompchk.py | 61 +++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
index 43a4594..d14581b 100644
--- a/sysmig_agent/Abisystmcompchk.py
+++ b/sysmig_agent/Abisystmcompchk.py
@@ -567,3 +567,64 @@ def get_migration_sys_info():
return behind_list_info
+
+#Create data list for write to .xls of sheet[0]
+#ge['1|1|CentOS Linux 8 (Core)', '2|1|4.18.0-147.el8.x86_64', '4|1|26.4GB', '5|1|x86_64', '8|1|1278', '11|1|1', '12|1|2', '13|1|2']
+def get_cur_sys_info_list():
+ list_info = []
+ before_sys_info = exp_rst_dir + 'before-system-info.txt'
+ sys_version_tmp = exp_rst_dir + 'sys-version-tmp'
+
+ #Used after system migration
+ with open(sys_version_tmp, 'w') as file_object:
+ file_object.write(get_cur_sys_version())
+
+ #current system version, write sheet[0]:1-row,1-column
+ cur_sys_info = '1|1|' + get_cur_sys_version()
+ list_info.append(cur_sys_info)
+
+ #current kernel version, write sheet[0]:2-row,1-column
+ #20220107 modify lihp: get kernel version of migrate before
+ #cur_kernel_verison = '2|1|' + platform.release()
+ cur_kernel_verison = '2|1|' + platform_release('0')
+ list_info.append(cur_kernel_verison)
+
+ #/var/cache available space,write sheet[0]:4-row,1-column
+ cur_var_cache = '4|1|' + os_storage() + 'GB'
+ list_info.append(cur_var_cache)
+
+ #system architecture, write sheet[0]:5-row,1-line
+ cur_arch = '5|1|' + platform.processor()
+ list_info.append(cur_arch)
+
+ #Be replaced rpm packages number,write sheet[0]:8-row,1-column
+ with open(migration_system_total, 'r') as fr:
+ replace_pkgs_num = str(len(fr.readlines()))
+ list_info.append('8|1|' + replace_pkgs_num)
+
+ #Compatible with the number, write sheet[0]:11-row,1-column
+ with open(abi_comp_chk, 'r') as fc:
+ comp_num_int = len(fc.readlines())
+ comp_num = '11|1|' + str(comp_num_int)
+ list_info.append(comp_num)
+
+ #Icompatible with the number,write sheet[0]:12-row,1-column
+ incomp_num = '12|1|' + str(incomp_pkg_num())
+ list_info.append(incomp_num)
+
+ #The total number of packageswrite sheet[0]:13-row,1-column
+ sum_num = comp_num_int + incomp_pkg_num()
+ list_info.append('13|1|' + str(sum_num))
+
+ #write to file,report generation after migration
+ with open(before_sys_info, 'w') as fpbsi:
+ fpbsi.write(cur_sys_info + '\n')
+ fpbsi.write(cur_kernel_verison + '\n')
+ fpbsi.write(cur_var_cache + '\n')
+ fpbsi.write(cur_arch + '\n')
+ fpbsi.write('8|1|' + replace_pkgs_num + '\n')
+ fpbsi.write(comp_num + '\n')
+ fpbsi.write(incomp_num + '\n')
+ fpbsi.write('13|1|' + str(sum_num) + '\n')
+
+ return list_info
--
2.20.1