!87 add centos7 and centos8 migration interface
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
fc4e003847
77
0034-add-centos7-and-centos8-migration-interface.patch
Normal file
77
0034-add-centos7-and-centos8-migration-interface.patch
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
From 3d4c5f1d8dbc9595c38ff5313743245017851114 Mon Sep 17 00:00:00 2001
|
||||||
|
From: xuezhixin <xuezhixin@uniontech.com>
|
||||||
|
Date: Fri, 10 Nov 2023 13:55:42 +0800
|
||||||
|
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0centos7=E5=92=8Ccentos8?=
|
||||||
|
=?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=85=A5=E5=8F=A3?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
sysmig_agent/centos82uos.py | 2 +-
|
||||||
|
sysmig_agent/migration.py | 39 +++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 40 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/sysmig_agent/centos82uos.py b/sysmig_agent/centos82uos.py
|
||||||
|
index 0a715b0..cc54eba 100755
|
||||||
|
--- a/sysmig_agent/centos82uos.py
|
||||||
|
+++ b/sysmig_agent/centos82uos.py
|
||||||
|
@@ -10,7 +10,7 @@ import shutil
|
||||||
|
import argparse
|
||||||
|
import platform
|
||||||
|
import logging
|
||||||
|
-
|
||||||
|
+from sysmig_agent.share import *
|
||||||
|
from utils import *
|
||||||
|
|
||||||
|
reposdir=''
|
||||||
|
diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py
|
||||||
|
index c635041..76b3b8e 100644
|
||||||
|
--- a/sysmig_agent/migration.py
|
||||||
|
+++ b/sysmig_agent/migration.py
|
||||||
|
@@ -64,3 +64,42 @@ def mig_check_migration_progress():
|
||||||
|
data = percent * (lines / rpms)
|
||||||
|
data = format(data, '.1f')
|
||||||
|
return data
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def up_to_date_sql_migrate():
|
||||||
|
+ data = mig_check_migration_progress()
|
||||||
|
+ sql_show_tables()
|
||||||
|
+ sql = "UPDATE agent_task SET task_progress = {} ,task_Updatetime = NOW() WHERE agent_ip = '{}';".format(data, get_local_ip())
|
||||||
|
+ try:
|
||||||
|
+ ret = DBHelper().execute(sql)
|
||||||
|
+ except:
|
||||||
|
+ pass
|
||||||
|
+ return 0
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def Sysmig(kernel_version):
|
||||||
|
+ os_version_ret = platform.dist()
|
||||||
|
+ version = os_version_ret[1].split('.',-1)
|
||||||
|
+ AGENT_OS = os_version_ret[0]+version[0]
|
||||||
|
+ data = state =0
|
||||||
|
+ if re.fullmatch('8',version[0]):
|
||||||
|
+ cmd = 'python3 func/centos82uos.py'
|
||||||
|
+ run_cmd2file(cmd)
|
||||||
|
+ # t = Process(target=run_cmd2file, args=(cmd,))
|
||||||
|
+ # t.start()
|
||||||
|
+ elif re.search('centos7',AGENT_OS):
|
||||||
|
+ ex_kernel = 'sh func/centos72uos.sh -e "kernel-devel* kernel-headers* kernel-tools* kernel* bpftool perf python-perf kernel-abi* kernel-modules kernel-core kmod-kvdo"'
|
||||||
|
+ if kernel_version == '0':
|
||||||
|
+ run_cmd2file(ex_kernel)
|
||||||
|
+ sql_mig_statue('3')
|
||||||
|
+ elif kernel_version == '3.10.0':
|
||||||
|
+ run_cmd2file(ex_kernel)
|
||||||
|
+ cmd_k = 'sh func/kernel.sh -k 3.10.0'
|
||||||
|
+ run_cmd2file(cmd_k)
|
||||||
|
+ sql_mig_statue('3')
|
||||||
|
+ else:
|
||||||
|
+ cmd = 'sh func/centos72uos.sh'
|
||||||
|
+ run_cmd2file(cmd)
|
||||||
|
+ sql_mig_statue('3')
|
||||||
|
+
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: migration-tools
|
Name: migration-tools
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 33
|
Release: 34
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
@ -40,6 +40,7 @@ Patch30: 0030-system-information-import-info-the-database-after-migration.pat
|
|||||||
Patch31: 0031-migration-check-and-extract-macros.patch
|
Patch31: 0031-migration-check-and-extract-macros.patch
|
||||||
Patch32: 0032-add-migration.py-to-migration-function.patch
|
Patch32: 0032-add-migration.py-to-migration-function.patch
|
||||||
Patch33: 0033-check-system-kernrel.patch
|
Patch33: 0033-check-system-kernrel.patch
|
||||||
|
Patch34: 0034-add-centos7-and-centos8-migration-interface.patch
|
||||||
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -139,6 +140,9 @@ rm -rf /usr/bin/migration-tools
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-34
|
||||||
|
- 0034-add-centos7-and-centos8-migration-interface.patch
|
||||||
|
|
||||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-33
|
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-33
|
||||||
- 0033-check-system-kernrel.patch
|
- 0033-check-system-kernrel.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user