migrate in mutiple steps

This commit is contained in:
xuezhixin 2024-11-06 10:34:38 +08:00
parent c355e004ec
commit abe319a4c6
2 changed files with 80 additions and 2 deletions

View File

@ -0,0 +1,75 @@
From ba4c9021051b1844ebf09435ae60ead631e468c4 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Fri, 10 Nov 2023 14:40:46 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E6=AD=A5=E9=AA=A4?=
=?UTF-8?q?=E8=BF=81=E7=A7=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/migration.py | 51 +++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py
index fec143a..a3265e9 100644
--- a/sysmig_agent/migration.py
+++ b/sysmig_agent/migration.py
@@ -235,3 +235,54 @@ def get_old_osversion():
return oldosversion
+
+def mig_system_migration(kernel_version):
+ res = '0'
+ #state = str(get_mig_state())
+ state = 0
+ print('-GET MIG STATE-'+state)
+ if '0' == state:
+ sql_mig_statue('1')
+ ifnot_mig_kernel(kernel_version)
+ # t = Process(target=Sysmig, args=(kernel_version,))
+ # t.start()
+ Sysmig(kernel_version)
+ elif '2' == state:
+ sql_mig_statue('6')
+ mig_kernel(kernel_version)
+ with open(PRE_MIG, 'r') as fp:
+ stros = fp.readlines()
+ oldos = stros[0]
+ fp.close()
+ oldos = oldos.split(':',1)
+ main_conf(oldos[1])
+ if os.path.exists('/var/tmp/uos-migration/data/exp-rst/systeminfo.txt'):
+ run_cmd2file('sh func/Abitranrept.sh')
+ # abi_txt2xls_trans()
+ sql_mig_statue('4')
+ elif '4' == state:
+ sql_mig_statue('5')
+ if os.path.exists('/var/tmp/uos-migration/UOS_migration_log/rpms-verified-after.txt'):
+ res = '0'
+ else:
+ res = '-1'
+ elif '3' == state:
+ sql_mig_statue('5')
+ if os.path.exists('/var/tmp/uos-migration/data/exp-rst/systeminfo.txt'):
+ run_cmd2file('func/Abitranrept.sh')
+ # abi_txt2xls_trans()
+ if os.path.exists('/var/tmp/uos-migration/UOS_migration_log/rpms-list-after.txt'):
+ res = '0'
+ else:
+ res = '-1'
+ elif '5' == state:
+ if '-1' == res :
+ data =' 迁移失败。'
+ keylist = ['ip','res','error']
+ return 3
+ else:
+ data = '迁移成功。'
+ return 2
+ return 1
+
+
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 43
Release: 44
License: MulanPSL-2.0
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
Source0: %{name}-%{version}.tar.gz
@ -50,7 +50,7 @@ Patch40: 0040-intial-logfile-and-tmpfile.patch
Patch41: 0041-get-migration-status-from-database.patch
Patch42: 0042-get-initial-os-version-from-agent_info-interface.patch
Patch43: 0043-process-os-version-and-os-name.patch
Patch44: 0044-migrate-in-myutiple-steps.patch
BuildArch: noarch
BuildRequires: systemd
@ -149,6 +149,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-44
- 0044-migrate-in-myutiple-steps.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-43
- 0043-process-os-version-and-os-name.patch