diff --git a/0001-download-the-rpm-package-in-the-system.patch b/0001-download-the-rpm-package-in-the-system.patch new file mode 100644 index 0000000000000000000000000000000000000000..68aa7f4b36ac4905fcf5ffee7b163dce91d6b277 --- /dev/null +++ b/0001-download-the-rpm-package-in-the-system.patch @@ -0,0 +1,37 @@ +From d0e28ae440b4129eebff1b53d18f42d48ef0156c Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 14:59:04 +0800 +Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=BD=AF=E4=BB=B6=E5=8C=85?= + =?UTF-8?q?=E5=92=8C=E4=B8=8B=E8=BD=BD=E7=9A=84=E8=BD=AF=E4=BB=B6=E5=8C=85?= + =?UTF-8?q?=E5=AF=B9=E5=BA=94?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/Abisystmcompchk.py | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py +index 0b5c519..eab8322 100644 +--- a/sysmig_agent/Abisystmcompchk.py ++++ b/sysmig_agent/Abisystmcompchk.py +@@ -818,3 +818,15 @@ def switch_write_migrate_report(report_name, num, flag): + with open(abi_incomp_chk, 'r') as fr_incomp: + column_incomp_list = fr_incomp.readlines() + write_row_by_row(report_name, column_incomp_list, 2, 0, num) ++ ++ ++def get_system_unique_pkg(current_pkg_list, download_pkg_list): ++ # clean history data ++ if os.path.exists(current_system_unique): ++ os.remove(current_system_unique) ++ ++ fcw = open(current_system_unique, 'w') ++ for data in set(current_pkg_list).difference(set(download_pkg_list)): ++ fcw.write(data + '\n') ++ fcw.close() ++ +-- +2.20.1 + diff --git a/0001-use-kill-not-kill-INT-when-stop-service.patch b/0001-use-kill-not-kill-INT-when-stop-service.patch deleted file mode 100644 index d5136536511ebc42462e69dc79d1e2e00c738e79..0000000000000000000000000000000000000000 --- a/0001-use-kill-not-kill-INT-when-stop-service.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 192fd69de19a78afe81a5a2c5a8270057f12ee3d Mon Sep 17 00:00:00 2001 -From: lixin -Date: Mon, 18 Mar 2024 10:32:17 +0800 -Subject: [PATCH] use kill instead of kill-INT - ---- - server/migration-tools-server.service | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/server/migration-tools-server.service b/server/migration-tools-server.service -index 8cd53a3..dd16c95 100644 ---- a/server/migration-tools-server.service -+++ b/server/migration-tools-server.service -@@ -5,7 +5,7 @@ After=network-online.target - [Service] - Type=simple - ExecStart=/usr/bin/python3 /usr/lib/migration-tools-server/index.py --ExecStop=/bin/kill-INT $MAINPID -+ExecStop=/bin/kill -HUP $MAINPID - - [Install] - WantedBy=multi-user.target --- -2.41.0 - diff --git a/0002-get-information-before-migration.patch b/0002-get-information-before-migration.patch new file mode 100644 index 0000000000000000000000000000000000000000..aa8a386cd27bd6dadce49933e04a5c6e3488c95c --- /dev/null +++ b/0002-get-information-before-migration.patch @@ -0,0 +1,93 @@ +From acb29d91b7b13f56085bc9e9b511aef367de9a0b Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 15:04:12 +0800 +Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=89=8D=E8=BD=AF=E4=BB=B6?= + =?UTF-8?q?=E5=8C=85=E5=92=8C=E7=B3=BB=E7=BB=9F=E4=BF=A1=E6=81=AF=E5=87=86?= + =?UTF-8?q?=E5=A4=87?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/Abisystmcompchk.py | 68 +++++++++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) + +diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py +index eab8322..d717cdf 100644 +--- a/sysmig_agent/Abisystmcompchk.py ++++ b/sysmig_agent/Abisystmcompchk.py +@@ -830,3 +830,71 @@ def get_system_unique_pkg(current_pkg_list, download_pkg_list): + fcw.write(data + '\n') + fcw.close() + ++ ++#Check the environment before migration and generate a detection report ++def migrate_before_abi_chk(q_query, task_status): ++ i=0 ++ Flag='0' ++ Oth='2' ++ global percentage ++ global total_rpm_nums ++ task_status_error = '2' ++ migration_download_list = [] ++ ++ log = logger_init() ++ log.info('============== START TIME :'+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+' ==============') ++ ++ download_path = local_dir + 'uos/rpms' ++ current_packages_string = get_system_pkg_name(Flag, log) ++ if not current_packages_string: ++ msg_tup = ('0', task_status_error) ++ q_query.put(msg_tup) ++ log.info('The current progress exit:' + str(msg_tup)) ++ #return False ++ ++ os.system('yumdownloader --destdir=%s%s --skip-broken' %(download_path, current_packages_string)) ++ ++ download_list = get_system_pkg_list(migration_download_list) ++ if not download_list: ++ log.info('yumdownloader rpm pakcages failed ...') ++ msg_tup = ('0', task_status_error) ++ q_query.put(msg_tup) ++ log.info('The current progress exit:' + str(msg_tup)) ++ #return False ++ total_rpm_nums = len(download_list) ++ ++ current_list = get_system_pkg_name(Oth, log) ++ if not current_list: ++ msg_tup = ('0', task_status) ++ q_query.put(msg_tup) ++ log.info('The current progress exit:' + str(msg_tup_error)) ++ #return False ++ ++ get_system_unique_pkg(list(current_list), migration_download_list) ++ ++ cur_dir = os.getcwd() ++ os.chdir(download_path) ++ rst = MutilThread(download_list, q_query, log) ++ os.chdir(cur_dir) ++ ++ agent_ABI_check_result() ++ ++ migrate_before_report_name = create_migrate_report_name(Flag, log) ++ if not migrate_before_report_name: ++ msg_tup = ('0', task_status) ++ q_query.put(msg_tup) ++ log.info('The current progress exit:' + str(msg_tup)) ++ #return False ++ ++ while i < 4: ++ write_migrate_report_rst =switch_write_migrate_report(migrate_before_report_name, i, Flag) ++ i = i + 1 ++ ++ task_status = '0' ++ msg_tup = (percentage, task_status) ++ q_query.put(msg_tup) ++ log.info('The current progress has been completed:' + str(msg_tup)) ++ log.info('============== END TIME :'+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+' ==============') ++ ++ return '0' ++ +-- +2.20.1 + diff --git a/0002-modify-description.patch b/0002-modify-description.patch deleted file mode 100644 index 3a0f836fb4f87a5d8db8a5945dd1b03c8a69b9c9..0000000000000000000000000000000000000000 --- a/0002-modify-description.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 52c434875d1cda64d0abd96e115001ffef0d2cc5 Mon Sep 17 00:00:00 2001 -From: lixin -Date: Mon, 1 Apr 2024 11:04:00 +0800 -Subject: [PATCH] modify-description - ---- - templates/MT_agreement.html | 2 +- - templates/MT_migration_results.html | 2 +- - templates/MT_note.html | 12 +++++++----- - 3 files changed, 9 insertions(+), 7 deletions(-) - -diff --git a/templates/MT_agreement.html b/templates/MT_agreement.html -index be70ca8..d15a399 100755 ---- a/templates/MT_agreement.html -+++ b/templates/MT_agreement.html -@@ -26,7 +26,7 @@ -
- 欢迎使用统信服务器系统迁移软件。 -
-- 此迁移工具用于将【当前操作系统】替换为【统信服务器操作系统 V20】,并将 RPM 软件包替换为统信的 RPM 软件包。 -+ 此迁移工具用于将【当前操作系统】替换为【openEuler-20.03-LTS-SP1或统信服务器操作系统】,并将 RPM 软件包替换为统信的 RPM 软件包。 - - 协议许可: -
-diff --git a/templates/MT_migration_results.html b/templates/MT_migration_results.html -index 3ff802b..fef5292 100755 ---- a/templates/MT_migration_results.html -+++ b/templates/MT_migration_results.html -@@ -35,6 +35,7 @@ -
-
- -+

注意:(openEuler系统迁移暂不支持导出日志/报告功能)

-
-
-
-@@ -88,7 +89,6 @@ -
-
-
-- -
- - -diff --git a/templates/MT_note.html b/templates/MT_note.html -index 099523b..1a79009 100755 ---- a/templates/MT_note.html -+++ b/templates/MT_note.html -@@ -33,11 +33,13 @@ -
-

1. 迁移一旦开始,过程不可逆。请确保您已将系统的数据与设置进行【完整备份】。

-

2. 迁移前请获得管理员许可,再进行迁移工作。

--

3. 请提前获取【统信服务器操作系统 V20 】的软件仓库地址。

--

4. 迁移过程中请保证稳定的网络连接。

--

5. 迁移过程中请不要进行任何操作。

--

6. 该迁移工具目前仅支持 CentOS 7 / CentOS 8 操作系统。

--

7. 请确保在 '/var/cache' 中至少有 10GB 的可用空间。

-+

3. openEuler系统迁移目前仅支持centos7.4-7.6 cui迁移至openEuler-20.03-LTS-SP1

-+

3. openEuler系统迁移无需填写软件源

-+

4. 如需迁移UOS系统,请提前准备【统信服务器操作系统 V20 】的软件仓库地址。

-+

5. 迁移过程中请保证稳定的网络连接。

-+

6. 迁移过程中请不要进行任何操作。

-+

7. 该迁移工具目前仅支持 CentOS 7 / CentOS 8 操作系统。

-+

8. 请确保在 '/var/cache' 中至少有 10GB 的可用空间。

-
-
-
--- -2.43.0 - diff --git a/0003-adjust-the-display-sequence.patch b/0003-adjust-the-display-sequence.patch deleted file mode 100644 index 17b127012d179f904f64c6c9c20aec5e8560f834..0000000000000000000000000000000000000000 --- a/0003-adjust-the-display-sequence.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ae5f25582a87a84cbc33914c27ab66e358ca271f Mon Sep 17 00:00:00 2001 -From: lixin -Date: Tue, 2 Apr 2024 17:13:01 +0800 -Subject: [PATCH] adjust the display sequence - ---- - templates/MT_check_root.html | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/templates/MT_check_root.html b/templates/MT_check_root.html -index eb4dc3f..cb5d346 100755 ---- a/templates/MT_check_root.html -+++ b/templates/MT_check_root.html -@@ -55,8 +55,8 @@ - -
- -
- --- -2.43.0 - diff --git a/0003-export-migration-check-report.patch b/0003-export-migration-check-report.patch new file mode 100644 index 0000000000000000000000000000000000000000..b860fd7508261ed4c8d5f64c5f8d44884efc43a2 --- /dev/null +++ b/0003-export-migration-check-report.patch @@ -0,0 +1,102 @@ +From 75714106374a4e62630c0e6b131f74a0717518bc Mon Sep 17 00:00:00 2001 +From: lixin +Date: Mon, 13 Nov 2023 15:17:47 +0800 +Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=A3=80=E6=B5=8B=E6=8A=A5?= + =?UTF-8?q?=E5=91=8A=E5=AF=BC=E5=87=BA?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + views/reports.py | 25 +++++++++++++++++++++++++ + views/server.py | 33 ++++++++++++++++++++++++++++++++- + 2 files changed, 57 insertions(+), 1 deletion(-) + create mode 100644 views/reports.py + +diff --git a/views/reports.py b/views/reports.py +new file mode 100644 +index 0000000..6295283 +--- /dev/null ++++ b/views/reports.py +@@ -0,0 +1,25 @@ ++import os ++from logger import * ++from connect_sql import DBHelper ++ ++ ++os.chdir('/usr/lib/uos-sysmig-server') ++migration_log = Logger('/var/tmp/uos-migration/migration.log', logging.DEBUG, logging.DEBUG) ++ ++ ++def migration_detection(data): ++ """ ++ 迁移检测报告 ++ :return: ++ """ ++ agent_ip = data.get('agent_ip') ++ info_sql = "select AES_DECRYPT(agent_passwd, 'coco'),agent_username from agent_info where agent_ip='%s'" % agent_ip ++ info = DBHelper().execute(info_sql).fetchall() ++ scp_log = "sshpass -p %s scp -r %s@%s:/var/tmp/uos-migration/UOS_analysis_report*.tar.gz /var/uos-migration/" % \ ++ (str(info[0][0], encoding="utf-8"), info[0][1], agent_ip) ++ try: ++ os.system(scp_log) ++ migration_log.info(scp_log) ++ except: ++ migration_log.error('export report scp error:%s' % scp_log) ++ return 'success' +\ No newline at end of file +diff --git a/views/server.py b/views/server.py +index 369a750..4cfab8f 100644 +--- a/views/server.py ++++ b/views/server.py +@@ -1,8 +1,13 @@ + import json ++import os + from datetime import datetime + + from connect_sql import DBHelper + from sysmig_agent.share import getSysMigConf ++from views import reports ++from logger import * ++ ++migration_log = Logger('/var/tmp/uos-migration/migration.log', logging.DEBUG, logging.DEBUG) + + def import_host_info(data): + """ +@@ -343,4 +348,30 @@ def get_storage_num(data): + faild = len(get_faild_num) + data = {'success': success, 'faild': faild} + json_data = json.dumps(data) +- return json_data +\ No newline at end of file ++ return json_data ++ ++ ++reports_type = { ++ "migration_detection": reports.migration_detection, ++} ++ ++def export_reports(data): ++ """ ++ 导出各种报告 ++ :param data: ++ :return: ++ """ ++ data = json.loads(data) ++ report_type = reports_type.get(data.get('reports_type')) ++ if report_type: ++ mkdir_log_pwd = "/var/uos-migration/" ++ isExists = os.path.exists(mkdir_log_pwd) ++ if not isExists: ++ try: ++ os.makedirs(mkdir_log_pwd) ++ migration_log.info(mkdir_log_pwd) ++ except: ++ migration_log.war("export report mkdir war:%s" % mkdir_log_pwd) ++ ++ report_type(data) ++ return 'success' +\ No newline at end of file +-- +2.20.1 + diff --git a/0004-complete-information-report-after-abi-detection.patch b/0004-complete-information-report-after-abi-detection.patch new file mode 100644 index 0000000000000000000000000000000000000000..630f613cd56ad968b305f2bb8f6c37222f451c6b --- /dev/null +++ b/0004-complete-information-report-after-abi-detection.patch @@ -0,0 +1,45 @@ +From 5787327a9f14de7b3f40945d328a2753b08a0f04 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 15:19:25 +0800 +Subject: [PATCH] =?UTF-8?q?ABI=E6=A3=80=E6=B5=8B=E5=90=8E=E5=AE=8C?= + =?UTF-8?q?=E6=88=90=E6=95=B4=E5=90=88=E6=8A=A5=E5=91=8A=E4=BF=A1=E6=81=AF?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/Abisystmcompchk.py | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py +index d717cdf..493c09b 100644 +--- a/sysmig_agent/Abisystmcompchk.py ++++ b/sysmig_agent/Abisystmcompchk.py +@@ -898,3 +898,24 @@ def migrate_before_abi_chk(q_query, task_status): + + return '0' + ++ ++#Check the environment after the migration and generate a detection report ++def migrate_behind_abi_chk(): ++ i=0 ++ Flag='1' ++ ++ log = logger_init() ++ ++ current_install_uos_list = get_system_pkg_name(Flag, log) ++ if not current_install_uos_list: ++ return False ++ ++ migrate_behind_report_name = create_migrate_report_name(Flag, log) ++ if not migrate_behind_report_name: ++ return False ++ ++ while i < 4: ++ write_migrate_report_rst =switch_write_migrate_report(migrate_behind_report_name, i, Flag) ++ i = i + 1 ++ ++ return '0' +-- +2.20.1 + diff --git a/0004-fix-cancel-button-function-in-tool.patch b/0004-fix-cancel-button-function-in-tool.patch deleted file mode 100644 index ab7b5e1d3622a529400f5d66c436bd80d8d1a249..0000000000000000000000000000000000000000 --- a/0004-fix-cancel-button-function-in-tool.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 0878a6820be950685d5c79abe8a655b2734b4534 Mon Sep 17 00:00:00 2001 -From: lihaipeng -Date: Tue, 27 Aug 2024 15:27:38 +0800 -Subject: [PATCH 2/2] fix-cancel-button-function-in-tool - ---- - templates/MT_agreement.html | 6 +++--- - templates/MT_check_evn.html | 8 ++++---- - templates/MT_check_root.html | 4 ++-- - templates/MT_kernel.html | 4 ++-- - templates/MT_note.html | 4 ++-- - templates/MT_repo.html | 4 ++-- - 6 files changed, 15 insertions(+), 15 deletions(-) - -diff --git a/templates/MT_agreement.html b/templates/MT_agreement.html -index d15a399..40150bf 100755 ---- a/templates/MT_agreement.html -+++ b/templates/MT_agreement.html -@@ -86,7 +86,7 @@ -
-
- -- -+ - 下一步 -
- -@@ -119,8 +119,8 @@ - }); - - function close_tool() { -- alert("确定关闭迁移软件吗?") -- } -+ alert("确定关闭迁移软件吗?") -+ } - - - -diff --git a/templates/MT_check_evn.html b/templates/MT_check_evn.html -index fe9c8d8..47b2029 100755 ---- a/templates/MT_check_evn.html -+++ b/templates/MT_check_evn.html -@@ -52,7 +52,7 @@ -
-
-
-- -+ - - - -@@ -131,9 +131,9 @@ - window.location.href="MT_check_user" - } - -- function close_tool() { -- alert("确定关闭迁移软件吗?"); -- } -+ function close_tool() { -+ window.location.href="MT_note" -+ } - - - -diff --git a/templates/MT_check_root.html b/templates/MT_check_root.html -index cb5d346..5e4ce52 100755 ---- a/templates/MT_check_root.html -+++ b/templates/MT_check_root.html -@@ -72,7 +72,7 @@ -
-
-
-- -+ - - - -@@ -122,7 +122,7 @@ - } - - function close_tool() { -- alert("确定关闭迁移软件吗?"); -+ window.location.href="MT_check_env" - } - - $("#uname_id").bind("input propertychange",function(event){ -diff --git a/templates/MT_kernel.html b/templates/MT_kernel.html -index e8b93c8..9553bc6 100755 ---- a/templates/MT_kernel.html -+++ b/templates/MT_kernel.html -@@ -53,7 +53,7 @@ -
-
-
-- -+ - - - -@@ -115,7 +115,7 @@ - - - function close_tool() { -- alert("确定关闭迁移软件吗?"); -+ window.location.href="MT_repo" - } - - -diff --git a/templates/MT_note.html b/templates/MT_note.html -index 1a79009..2da1294 100755 ---- a/templates/MT_note.html -+++ b/templates/MT_note.html -@@ -48,7 +48,7 @@ -
-
-
-- -+ - - - -@@ -75,7 +75,7 @@ - } - - function close_tool() { -- alert("确定关闭迁移软件吗?"); -+ window.location = '/MT_agreement'; - } - - -diff --git a/templates/MT_repo.html b/templates/MT_repo.html -index 2c145af..c5fa384 100755 ---- a/templates/MT_repo.html -+++ b/templates/MT_repo.html -@@ -54,7 +54,7 @@ -
-
-
-- -+ - -
- -@@ -102,7 +102,7 @@ - } - - function close_tool() { -- alert("确定关闭迁移软件吗"); -+ window.location.href="MT_check_user" - } - - $("#repo_pwd").bind("input propertychange",function(event){ --- -2.43.0 - diff --git a/0005-abi-detection-through-multi-threads.patch b/0005-abi-detection-through-multi-threads.patch new file mode 100644 index 0000000000000000000000000000000000000000..1f36d07101ebc15fe2aa32472b19c58ec2773290 --- /dev/null +++ b/0005-abi-detection-through-multi-threads.patch @@ -0,0 +1,70 @@ +From ef8d18b5e61506b7450f1fb96ca895e704f9de7a Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 15:23:16 +0800 +Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E5=AE=8C=E6=88=90AB?= + =?UTF-8?q?I=E6=A3=80=E6=9F=A5?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/Abisystmcompchk.py | 46 +++++++++++++++++++++++++++++++++ + 1 file changed, 46 insertions(+) + +diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py +index 493c09b..79e6581 100644 +--- a/sysmig_agent/Abisystmcompchk.py ++++ b/sysmig_agent/Abisystmcompchk.py +@@ -919,3 +919,49 @@ def migrate_behind_abi_chk(): + i = i + 1 + + return '0' ++ ++ ++def MutilThread(nameList, Query, muth_logger): ++ global exitFlag ++ ++ # Default number of cpus ++ thread_num = int(cpu_count() * 1.5) ++ ++ threadList = ["Thread-%d" % (num) for num in range(0, thread_num)] ++ ++ threads = [] ++ threadID = 10 ++ # threadID = 1 ++ ++ fw = open(abi_incomp_chk, 'w') ++ fr = open(abi_comp_chk, 'w') ++ ++ # Creating new thread ++ for tName in threadList: ++ thread = myThread(threadID, tName, workQueue, queueLock, fw, fr, Query, muth_logger) ++ thread.start() ++ threads.append(thread) ++ threadID += 1 ++ ++ # Fill in the queue ++ queueLock.acquire() ++ for word in nameList: ++ workQueue.put(word) ++ queueLock.release() ++ ++ # Waiting queue clear ++ while not workQueue.empty(): ++ pass ++ ++ # Notifies the thread that it is time to exit ++ exitFlag = 1 ++ ++ # Wait for all threads to complete ++ for t in threads: ++ t.join() ++ muth_logger.info('========== Exit main thread...... ==========') ++ ++ fw.close() ++ fr.close() ++ ++ return True +-- +2.20.1 + diff --git a/0005-system-check-page-before-migration-displayed.patch b/0005-system-check-page-before-migration-displayed.patch deleted file mode 100644 index 553d3f5760e8c24e694cd32628a55b80e819d0d0..0000000000000000000000000000000000000000 --- a/0005-system-check-page-before-migration-displayed.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 26b6311228a3166ace4e83bd69e030227b95343f Mon Sep 17 00:00:00 2001 -From: lihaipeng -Date: Fri, 30 Aug 2024 10:28:54 +0800 -Subject: [PATCH] system check page before migration displayed - ---- - templates/MT_check_environment.html | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/templates/MT_check_environment.html b/templates/MT_check_environment.html -index 1e6da94..be254c0 100644 ---- a/templates/MT_check_environment.html -+++ b/templates/MT_check_environment.html -@@ -57,7 +57,7 @@ -
-
-
-- -+ - - - -@@ -175,7 +175,7 @@ - } - - function close_tool() { -- alert("确定关闭迁移软件吗?") -+ window.location.href="MT_check_user" - } - - --- -2.43.0 - diff --git a/0006-add-message-query-to-update-abi-process.patch b/0006-add-message-query-to-update-abi-process.patch new file mode 100644 index 0000000000000000000000000000000000000000..b8ecdb2c8633f1426047bff000a3e0a3897332e4 --- /dev/null +++ b/0006-add-message-query-to-update-abi-process.patch @@ -0,0 +1,64 @@ +From 8d24d1c2a6462c4516127024c933ec9e793c518d Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 15:48:30 +0800 +Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B6=88=E6=81=AF=E9=98=9F?= + =?UTF-8?q?=E5=88=97=E6=9B=B4=E6=96=B0abi=E6=A3=80=E6=B5=8B=E8=BF=9B?= + =?UTF-8?q?=E5=BA=A6?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 40 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + create mode 100644 sysmig_agent/fork.py + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +new file mode 100644 +index 0000000..a128722 +--- /dev/null ++++ b/sysmig_agent/fork.py +@@ -0,0 +1,40 @@ ++# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. ++# SPDX-License-Identifier: MulanPubL-2.0-or-later ++ ++import platform ++import threading ++from multiprocessing import Process, Queue ++from apscheduler.schedulers.background import BackgroundScheduler ++import time ++import os ++import sys ++from sysmig_agent.abi_weight import * ++from sysmig_agent.Abisystmcompchk import migrate_before_abi_chk, migrate_behind_abi_chk ++import socket ++#from share import * ++from sysmig_agent.short_task import * ++ ++from sysmig_agent.migration import * ++#sys.path.append("..") ++#from connect_sql import DBHelper ++from sysmig_agent.agent_request import post_server ++ ++# create message query ++q = Queue(maxsize=0) ++ ++ ++# 定时任务 ++def up_to_date_sql_abi(): ++ # 获得sql的任务ID ++ # ret_task = get_sql_message() ++ # print('Get message query : ' + str(ret_task[0])) ++ # 获得ABI消息队列信息tuple ++ ret_abi_info = get_abi_info() ++ if ret_abi_info: ++ abi_process = ret_abi_info[0] ++ abi_task = ret_abi_info[1] ++ else: ++ return 1 ++ # 获取abi progress 更新数据库内 ++ sql_abi_progress(abi_process) ++ return 0 +-- +2.20.1 + diff --git a/0006-return-button-after-successful-migration.patch b/0006-return-button-after-successful-migration.patch deleted file mode 100644 index 6f3ca9423515eb375a92af1c0b479a8ef0d1df7b..0000000000000000000000000000000000000000 --- a/0006-return-button-after-successful-migration.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c0a6b3177b4e736eb4d9531567d7cb2b92180c3f Mon Sep 17 00:00:00 2001 -From: lihaipeng -Date: Wed, 4 Sep 2024 10:30:21 +0800 -Subject: [PATCH] Return button after successful migration - ---- - templates/MT_migration_results.html | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/templates/MT_migration_results.html b/templates/MT_migration_results.html -index fef5292..c6f5f33 100755 ---- a/templates/MT_migration_results.html -+++ b/templates/MT_migration_results.html -@@ -89,6 +89,8 @@ -
-
-
-+ -+ - - - -@@ -158,7 +160,7 @@ - } - - function close_tool() { -- alert("确定关闭迁移软件吗?"); -+ window.location.href="/MT_agreement" - } - - --- -2.43.0 - diff --git a/0007-start-task-to-check-migration.patch b/0007-start-task-to-check-migration.patch new file mode 100644 index 0000000000000000000000000000000000000000..c4756d14f0575a9f80ce0ebe3871f374ef53ca18 --- /dev/null +++ b/0007-start-task-to-check-migration.patch @@ -0,0 +1,47 @@ +From c10a2b4ab02efa9f3172aae2741f084a1c477adc Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 15:56:28 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E8=BF=81=E7=A7=BB=E6=A3=80=E6=B5=8B?= + =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index a128722..daea65f 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -38,3 +38,26 @@ def up_to_date_sql_abi(): + # 获取abi progress 更新数据库内 + sql_abi_progress(abi_process) + return 0 ++ ++ ++# ABI系统检测 ++def timed_task_abi(task_id): ++ time_task = BackgroundScheduler(timezone='Asia/Shanghai') ++ task_id=str(task_id) ++ p = time_task.add_job(up_to_date_sql_abi, 'interval', seconds=3) ++ time_task.start() ++ try: ++ task_statue='1' ++ p_abi = Process(target=migrate_before_abi_chk, args=(q,task_statue,)) ++ p_abi.start() ++ p_abi.join() ++ # Determine whether the message queue is dead or empty to end the timer ++ while not q.empty(): ++ continue ++ time_task.shutdown() ++ except (KeyboardInterrupt, SystemExit): ++ # Not strictly necessary if daemonic mode is enabled but should be done if possible ++ time_task.shutdown() ++ print('Exit The Job!') ++ ++ +-- +2.20.1 + diff --git a/0007-user-name-input-diversity.patch b/0007-user-name-input-diversity.patch deleted file mode 100644 index 2ad2d0841599bb46f6ddb55eb58699572b9614c8..0000000000000000000000000000000000000000 --- a/0007-user-name-input-diversity.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f97cab793cc5b18c836a8ca4bdf82390c4fc3110 Mon Sep 17 00:00:00 2001 -From: lihaipeng -Date: Wed, 4 Sep 2024 13:12:51 +0800 -Subject: [PATCH] user name input diversity - ---- - templates/MT_check_root.html | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/templates/MT_check_root.html b/templates/MT_check_root.html -index 5e4ce52..b2a3955 100755 ---- a/templates/MT_check_root.html -+++ b/templates/MT_check_root.html -@@ -149,6 +149,18 @@ - }); - }); - -+ let uname_id=document.querySelector('#uname_id') -+ uname_id.onfocus=function(){ -+ if(uname_id.value=="请输入具有root权限的用户"){ -+ uname_id.value="" -+ } -+ } -+ uname_id.onblur=function(){ -+ if(uname_id.value==''){ -+ uname_id.value="请输入具有root权限的用户" -+ } -+ } -+ - - - --- -2.43.0 - diff --git a/0008-add-system-migration-task.patch b/0008-add-system-migration-task.patch new file mode 100644 index 0000000000000000000000000000000000000000..3901e5028dd0aac55c5061329bdd7ae9e1d13df1 --- /dev/null +++ b/0008-add-system-migration-task.patch @@ -0,0 +1,97 @@ +From 5429befc45c4aff1517ee2346c16da3c2aafd8a4 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:00:22 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E7=9A=84=E7=B3=BB=E7=BB=9F=E8=BF=81?= + =?UTF-8?q?=E7=A7=BB=E4=BB=BB=E5=8A=A1?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 73 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 73 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index daea65f..615b3d5 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -61,3 +61,76 @@ def timed_task_abi(task_id): + print('Exit The Job!') + + ++# 系统迁移 定时任务更新进度 ++def timed_task_migrate(task_id, kernel_version): ++ time_task_m = BackgroundScheduler(timezone='Asia/Shanghai') ++ p = time_task_m.add_job(up_to_date_sql_migrate, 'interval', seconds=3) ++ migInit_porgress() ++ time_task_m.start() ++ try: ++ while 8 > int(str(get_mig_state(task_id))[1]): ++ state = str(get_mig_state(task_id))[1] ++ if str(get_mig_state(task_id))[0] == '1': ++ ## ++ ## error , too many request systen migration ++ time_task_m.shutdown() ++ return 'error' ++ old_os_name = get_old_osname() ++ if '0' == state: ++ sql_mig_statue('10') ++ if ifnot_mig_kernel(kernel_version): ++ sql_mig_statue('18') ++ t = Process(target=centos8_main, args=(old_os_name, task_id,)) ++ t.start() ++ t.join() ++ elif '2' == state: ++ sql_mig_statue('12') ++ ## skip broken ++ skip = 0 ++ t = Process(target=mig_distro_sync, args=(skip, task_id,)) ++ t.start() ++ t.join() ++ elif '3' == state: ++ # Breakpoint ++ sql_mig_statue('05') ++ elif '4' == state: ++ sql_mig_statue('14') ++ mig_kernel(kernel_version) ++ main_conf(old_os_name) ++ # Migration report ++ try: ++ migrate_behind_abi_chk() ++ except: ++ # Generate analysis report error ++ pass ++ sql_mig_statue('05') ++ elif '5' == state: ++ sql_mig_statue('15') ++ # Migration state weight : 90 ++ res = mig_whether_success() ++ ++ # new system regen sql ++ get_new_osversion() ++ # tar.gz type ++ targz_mig_dir_log() ++ targz_mig_dir_report() ++ sql_abi_progress(100) ++ if 80 > int(res): ++ sql_task_statue('3', task_id) ++ sql_mig_statue('08') ++ return 1 ++ # data = ' 迁移失败。' ++ else: ++ sql_task_statue('2', task_id) ++ sql_mig_statue('09') ++ time_task_m.shutdown() ++ return 0 ++ # data = '迁移成功。' ++ time.sleep(3) # 其他任务是独立的线程执行 ++ time_task_m.shutdown() ++ return 0 ++ except (KeyboardInterrupt, SystemExit): ++ # Not strictly necessary if daemonic mode is enabled but should be done if possible ++ time_task_m.shutdown() ++ sql_task_statue('3', task_id) ++ +-- +2.20.1 + diff --git a/0008-software-source-input-box-diversity.patch b/0008-software-source-input-box-diversity.patch deleted file mode 100644 index 7fb338e86e43a4be7a0c4cce7afdb6211452025b..0000000000000000000000000000000000000000 --- a/0008-software-source-input-box-diversity.patch +++ /dev/null @@ -1,35 +0,0 @@ -From a907626a9f13fcc59ae2545cad51d5876aa126e1 Mon Sep 17 00:00:00 2001 -From: lihaipeng -Date: Wed, 4 Sep 2024 13:26:20 +0800 -Subject: [PATCH] software source input box diversity - ---- - templates/MT_repo.html | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/templates/MT_repo.html b/templates/MT_repo.html -index c5fa384..6f1f605 100755 ---- a/templates/MT_repo.html -+++ b/templates/MT_repo.html -@@ -112,6 +112,18 @@ - } - }); - -+ let repo_pwd=document.querySelector('#repo_pwd') -+ repo_pwd.onfocus=function(){ -+ if(repo_pwd.value=="请输入软件仓库路径"){ -+ repo_pwd.value="" -+ } -+ } -+ repo_pwd.onblur=function(){ -+ if(repo_pwd.value==''){ -+ repo_pwd.value="请输入软件仓库路径" -+ } -+ } -+ - - - --- -2.43.0 - diff --git a/0009-disable-button-for-system-type-and-space.patch b/0009-disable-button-for-system-type-and-space.patch deleted file mode 100644 index 64e4042eeae7d12a6c17d651cbc01ce45f23252d..0000000000000000000000000000000000000000 --- a/0009-disable-button-for-system-type-and-space.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 27b96502632535b0fcf70bc0bf80d3f876dc2b2f Mon Sep 17 00:00:00 2001 -From: lihaipeng -Date: Wed, 4 Sep 2024 15:25:41 +0800 -Subject: [PATCH] disable button for system type and space - ---- - templates/MT_check_evn.html | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/templates/MT_check_evn.html b/templates/MT_check_evn.html -index 47b2029..fc18af1 100755 ---- a/templates/MT_check_evn.html -+++ b/templates/MT_check_evn.html -@@ -52,8 +52,8 @@ -
-
-
-- -- -+ -+ - - - -@@ -122,6 +122,8 @@ - if (os_res == '1' && storage_res == '1') { - document.getElementById('check_id').style.opacity = "1" - document.getElementById('check_id').removeAttribute("disabled"); -+ document.getElementById('last_step').style.opacity = "1" -+ document.getElementById('last_step').removeAttribute("disabled"); - os_res.name = '0'; - storage_res.name = '0'; - } --- -2.43.0 - diff --git a/0009-get-abi-detection-process.patch b/0009-get-abi-detection-process.patch new file mode 100644 index 0000000000000000000000000000000000000000..1c54c13acf74a99f23e03bfcbc771874c44fdfda --- /dev/null +++ b/0009-get-abi-detection-process.patch @@ -0,0 +1,40 @@ +From 620114229af58823e27a370ad2839365b0f4535e Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:05:28 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E8=8E=B7=E5=8F=96abi=E7=9A=84=E6=B6=88?= + =?UTF-8?q?=E6=81=AF=E9=98=9F=E5=88=97=E8=BF=9B=E5=BA=A6=E4=BF=A1=E6=81=AF?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index 615b3d5..8c2f4b6 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -134,3 +134,19 @@ def timed_task_migrate(task_id, kernel_version): + time_task_m.shutdown() + sql_task_statue('3', task_id) + ++ ++def get_abi_info(): ++ if q.empty(): ++ return None ++# print("Full :", q.full()) ++# print("Empty :", q.empty()) ++# print("QSize:", q.qsize()) ++ size = int(q.qsize()) ++ i=0 ++ msg = '' ++ while i < size: ++ i += 1 ++ msg = q.get() ++ return msg ++# if not q.empty(): ++ +-- +2.20.1 + diff --git a/0010-update-abi-result-to-database.patch b/0010-update-abi-result-to-database.patch new file mode 100644 index 0000000000000000000000000000000000000000..323e863235afe1915652b54bbdb39e0a7db3eb0a --- /dev/null +++ b/0010-update-abi-result-to-database.patch @@ -0,0 +1,72 @@ +From 1b94627aaa5a88b12e8d9d9ebf42be2dc08d7503 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:08:31 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E7=9A=84abi=E6=A3=80=E6=B5=8B=E7=BB=93?= + =?UTF-8?q?=E6=9E=9C=E6=9B=B4=E6=96=B0=E5=88=B0sql?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 48 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 48 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index 8c2f4b6..3447678 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -150,3 +150,51 @@ def get_abi_info(): + return msg + # if not q.empty(): + ++ ++def process_time_task_abi(task_id): ++ # 定时任务启动并更新进度 ++ timed_task_abi(task_id) ++ # abi结果接入数据库内 ++ abi_file_sql(abi_file) ++ # p_timed_task = Process(target=timed_task_abi, args=(task_id,)) ++ # p_timed_task.start() ++ # p_timed_task.join() ++ ++ ++def structure_task(): ++ # 先获得mysql的任务 ++ ret_task = get_sql_task() ++ if not ret_task: ++ print('agent_task is None..') ++ pass ++ # 判断任务类型 ++ print(ret_task) ++ if 1 == ret_task: ++ # 调用ABI权重比函数 ++ ret_data = abi_check_priority() ++ # 更新mysql的任务状态 ++ put_sql_task(ret_data) ++ ++ ++ ++# ABI对比结果文件,存放数据库内 ++def abi_file_sql(path): ++ with open(path, 'r') as p: ++ ret = p.readlines() ++ p.close() ++ for i in range(len(ret)): ++ info = ret[i].split(',', 5) ++ info_str = '' ++ for n in range(len(info)): ++ if n < 9: ++ sinfo = '' ++ if info[n].strip().strip('\n'): ++ sinfo = info[n].strip().strip('\n') ++ info_str = info_str+"'{}'".format(sinfo) ++ else: ++ sinfo='NULL' ++ info_str = info_str+"{}".format(sinfo) ++ if n != (len(info)-1): ++ info_str = info_str+',' ++ abi_file_connect(info_str) ++ +-- +2.20.1 + diff --git a/0010-verify-user-password-disabled-by-button.patch b/0010-verify-user-password-disabled-by-button.patch deleted file mode 100644 index c439fe2af3ae2b1dd660abef1d290d876cd80b8c..0000000000000000000000000000000000000000 --- a/0010-verify-user-password-disabled-by-button.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f8047aa03c724ac36d9e042f9f64608fd4ca4750 Mon Sep 17 00:00:00 2001 -From: lihaipeng -Date: Wed, 4 Sep 2024 16:26:02 +0800 -Subject: [PATCH] verify user password is disabled by button - ---- - templates/MT_check_root.html | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/templates/MT_check_root.html b/templates/MT_check_root.html -index b2a3955..9b70749 100755 ---- a/templates/MT_check_root.html -+++ b/templates/MT_check_root.html -@@ -72,7 +72,7 @@ -
-
-
-- -+ - - - -@@ -97,6 +97,9 @@ - check_user_data_json.ip = "tasks" - document.getElementById('check_id').style.opacity = 0.2 - document.getElementById('check_id').setAttribute("disabled", true); -+ -+ document.getElementById('last_step').style.opacity = 0.2 -+ document.getElementById('last_step').setAttribute("disabled", true); - info = document.getElementById("uname_id").value + "|" + document.getElementById("machine_password").value - $.ajax({ - async:true, -@@ -122,6 +125,7 @@ - } - - function close_tool() { -+ document.getElementById('last_step').setAttribute("disabled", true); - window.location.href="MT_check_env" - } - --- -2.43.0 - diff --git a/0011-initializate-the-migration-status.patch b/0011-initializate-the-migration-status.patch new file mode 100644 index 0000000000000000000000000000000000000000..a226119e591c38071b00bbc147abd9c6af8527d8 --- /dev/null +++ b/0011-initializate-the-migration-status.patch @@ -0,0 +1,53 @@ +From 127580df37b9b0264af9b54e4618a9b0e1939dda Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:11:45 +0800 +Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E8=BF=81=E7=A7=BB?= + =?UTF-8?q?=E7=8A=B6=E6=80=81?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index 3447678..3f81aea 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -198,3 +198,31 @@ def abi_file_sql(path): + info_str = info_str+',' + abi_file_connect(info_str) + ++ ++def check_environment(data): ++ task_id = json.loads(data).get('task_id') ++ # 更新SQL任务状态 ++ sql_task_statue('1', task_id) ++ # 发送消息给Server更新任务流状态 ++ post_server('task_start', task_id) ++ process_time_task_abi(task_id) ++ # tar.gz types abi report ++ targz_mig_dir_abi() ++ sql_task_statue('2', task_id) ++ post_server('task_close', task_id) ++ ++ ++# 初始化进度阶段 ++def mig_modify_statue(task_id): ++ if not get_mig_state(task_id): ++ sql_mig_statue('00') ++ ''' ++ else: ++ # Too many migration requests ++ # If you need to continue the migration, please change the task_data of the Mysql ++ return 1 ++ ret = get_mig_state(task_id) ++ ret = re.sub('[0-9]', '0', ret[0]) + ret[1] ++ sql_mig_statue(ret) ++ # loggea ++ ''' +\ No newline at end of file +-- +2.20.1 + diff --git a/0012-get-agent-kernel-version.patch b/0012-get-agent-kernel-version.patch new file mode 100644 index 0000000000000000000000000000000000000000..c943c070b90f47ac3dafd487ded0d7c0d0779809 --- /dev/null +++ b/0012-get-agent-kernel-version.patch @@ -0,0 +1,40 @@ +From 939ef6edc6fb62922acafceb76139a0b0993fc3c Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:14:28 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E8=AF=B7=E6=B1=82=E5=8F=82=E6=95=B0?= + =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=86=85=E6=A0=B8=E7=89=88=E6=9C=AC?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index 3f81aea..cbc4165 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -225,4 +225,17 @@ def mig_modify_statue(task_id): + ret = re.sub('[0-9]', '0', ret[0]) + ret[1] + sql_mig_statue(ret) + # loggea +- ''' +\ No newline at end of file ++ ''' ++ ++ ++ ++def get_info_version(data): ++ info = json.loads(data).get('info') ++ for i in range(len(info)): ++ agent_info = json.dumps(info[i]) ++ ip = json.loads(agent_info).get('agent_ip') ++ agent_ip = get_local_ip() ++ if ip == agent_ip: ++ version = json.loads(agent_info).get('kernel_version') ++ return version ++ +-- +2.20.1 + diff --git a/0013-set-agent-migration-task.patch b/0013-set-agent-migration-task.patch new file mode 100644 index 0000000000000000000000000000000000000000..5f868675ae9b374b6ca83249bbc9129c5a2f1ff7 --- /dev/null +++ b/0013-set-agent-migration-task.patch @@ -0,0 +1,41 @@ +From d5d7e0bed3bcfa893cf1907f2afbf8a3f05c679f Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:16:55 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E7=B3=BB=E7=BB=9F=E8=BF=81=E7=A7=BB?= + =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index cbc4165..23c10e2 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -239,3 +239,20 @@ def get_info_version(data): + version = json.loads(agent_info).get('kernel_version') + return version + ++ ++def system_migration(data): ++ kernel_version = get_info_version(data) ++ if not kernel_version: ++ kernel_version = '0' ++ task_id = json.loads(data).get('task_id') ++ # 更新SQL任务状态 ++ sql_task_statue('1', task_id) ++ # 发送消息给Server更新任务流状态 ++ post_server('task_start', task_id) ++ # The migration status is modified, and the breakpoint continues ++ mig_modify_statue(task_id) ++ #sql_mig_statue('00') ++ # MIGRATION MAIN ++ timed_task_migrate(task_id, kernel_version) ++ post_server('task_close', task_id) ++ +-- +2.20.1 + diff --git a/0014-compare-with-request-agent-ip.patch b/0014-compare-with-request-agent-ip.patch new file mode 100644 index 0000000000000000000000000000000000000000..918c4f3a5f70ea06193ebf282d6bd8a18cf5f103 --- /dev/null +++ b/0014-compare-with-request-agent-ip.patch @@ -0,0 +1,34 @@ +From 3b4ff69c1c59e004fe8c8b60220cf98e0461d847 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:24:00 +0800 +Subject: [PATCH] =?UTF-8?q?IP=E6=98=AF=E5=90=A6=E5=92=8C=E8=AF=B7=E6=B1=82?= + =?UTF-8?q?=E7=9A=84agent=E7=9A=84IP=E5=8C=B9=E9=85=8D?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index 23c10e2..8ad6d59 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -256,3 +256,13 @@ def system_migration(data): + timed_task_migrate(task_id, kernel_version) + post_server('task_close', task_id) + ++ ++def if_env_check(data): ++ agent_ips = list(json.loads(data).get('agent_ip')) ++ for n in range(len(agent_ips)): ++ ip = str(agent_ips[n]) ++ if ip == get_local_ip(): ++ return True ++ return False ++ ++ +-- +2.20.1 + diff --git a/0015-agent-sends-the-task-after-receving-the-request.patch b/0015-agent-sends-the-task-after-receving-the-request.patch new file mode 100644 index 0000000000000000000000000000000000000000..f6ae871418ecca172b4b5b29f2e90b104b5e6161 --- /dev/null +++ b/0015-agent-sends-the-task-after-receving-the-request.patch @@ -0,0 +1,41 @@ +From f9a676fb7297beb5e40af2fc39e1c872c33ffded Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:30:34 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E6=94=B6=E5=88=B0=E8=AF=B7=E6=B1=82?= + =?UTF-8?q?=E5=90=8E=E5=88=86=E5=8F=91=E4=BB=BB=E5=8A=A1?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/fork.py | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py +index 8ad6d59..679fb21 100644 +--- a/sysmig_agent/fork.py ++++ b/sysmig_agent/fork.py +@@ -266,3 +266,20 @@ def if_env_check(data): + return False + + ++def post_task(data): ++ task_mod = json.loads(data).get('mod') ++ if 'check_info' == task_mod: ++ t = threading.Thread(target=check_info, args=[data]) ++ elif 'check_repo' == task_mod: ++ t = threading.Thread(target=check_repo, args=[data]) ++ elif 'check_kernel' == task_mod: ++ t = threading.Thread(target=check_kernel, args=[data]) ++ elif 'check_environment' == task_mod: ++ if if_env_check(data): ++ t = threading.Thread(target=check_environment, args=[data]) ++ elif 'system_migration' == task_mod: ++ t = threading.Thread(target=system_migration, args=[data]) ++ t.start() ++ return 'y' ++ ++ +-- +2.20.1 + diff --git a/0016-export-migration-log.patch b/0016-export-migration-log.patch new file mode 100644 index 0000000000000000000000000000000000000000..14f6a96860bab4e2fb5a229d04cefcf17bbf66aa --- /dev/null +++ b/0016-export-migration-log.patch @@ -0,0 +1,70 @@ +From fa9113d9f5c7ba0d80835d9e5dfb683aca9834a7 Mon Sep 17 00:00:00 2001 +From: lixin +Date: Mon, 13 Nov 2023 16:33:44 +0800 +Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=81=E7=A7=BB=E6=97=A5?= + =?UTF-8?q?=E5=BF=97=E5=AF=BC=E5=87=BA?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + index.py | 1 + + views/reports.py | 18 ++++++++++++++++++ + views/server.py | 1 + + 3 files changed, 20 insertions(+) + +diff --git a/index.py b/index.py +index 505e91f..a392531 100644 +--- a/index.py ++++ b/index.py +@@ -36,6 +36,7 @@ mods = { + 'get_environment_data': server.get_environment_data, + 'get_repo_arch_info': server.get_repo_arch_info, + 'get_storage_num': server.get_storage_num, ++ 'export_reports': server.export_reports, + } + + +diff --git a/views/reports.py b/views/reports.py +index 6295283..c616dfd 100644 +--- a/views/reports.py ++++ b/views/reports.py +@@ -22,4 +22,22 @@ def migration_detection(data): + migration_log.info(scp_log) + except: + migration_log.error('export report scp error:%s' % scp_log) ++ return 'success' ++ ++ ++def migration_logs(data): ++ """ ++ 迁移日志 ++ :return: ++ """ ++ agent_ip = data.get('agent_ip') ++ info_sql = "select AES_DECRYPT(agent_passwd, 'coco'),agent_username from agent_info where agent_ip='%s'" % agent_ip ++ info = DBHelper().execute(info_sql).fetchall() ++ scp_log = "sshpass -p %s scp -r %s@%s:/var/tmp/uos-migration/UOS_migration_log*.tar.gz /var/uos-migration/" % \ ++ (str(info[0][0], encoding="utf-8"), info[0][1], agent_ip) ++ try: ++ os.system(scp_log) ++ migration_log.info(scp_log) ++ except: ++ migration_log.error('export report scp error:%s' % scp_log) + return 'success' +\ No newline at end of file +diff --git a/views/server.py b/views/server.py +index 4cfab8f..7c17a2f 100644 +--- a/views/server.py ++++ b/views/server.py +@@ -353,6 +353,7 @@ def get_storage_num(data): + + reports_type = { + "migration_detection": reports.migration_detection, ++ "migration_logs": reports.migration_logs, + } + + def export_reports(data): +-- +2.20.1 + diff --git a/0017-add-task-to-check-repo.patch b/0017-add-task-to-check-repo.patch new file mode 100644 index 0000000000000000000000000000000000000000..5b9a27cad88000fcc62aee63982850841435db27 --- /dev/null +++ b/0017-add-task-to-check-repo.patch @@ -0,0 +1,272 @@ +From 0e6f8d8f1bb7dba15a206b7a02c9dc70ad9b1aba Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 16:39:51 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E6=A3=80=E6=B5=8Brepo=E4=BB=BB=E5=8A=A1?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/check.py | 93 ------------------------ + sysmig_agent/short_task.py | 144 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 144 insertions(+), 93 deletions(-) + +diff --git a/sysmig_agent/check.py b/sysmig_agent/check.py +index 141a734..1a21c52 100644 +--- a/sysmig_agent/check.py ++++ b/sysmig_agent/check.py +@@ -178,99 +178,6 @@ def check_user(data): + return re_data + + +-def init_remove_oldrepo(): +- backup_comment = '#This is a yum repository file that was disabled . \ +- \n' +- path = '/etc/yum.repos.d/' +- repos = os.listdir(path) +- for repo in repos: +- path_file = path+'/'+repo +- if not os.path.isfile(path_file): +- continue +- if not re.search('repo$',repo): +- continue +- with open(path_file, 'r') as fsrc: +- content = fsrc.read() +- with open(path_file+'.disabled','w') as fdst: +- fdst.write(repo+'\n'+backup_comment+content) +- fdst.close() +- fsrc.close() +- os.remove(path_file) +- +- +-#初始化repo文件 +-def initRepoFile(baseurl): +- os_version_ret = platform.dist() +- version = os_version_ret[1].split('.',-1) +- reposdir = '/etc/yum.repos.d/' +- h = 0 +- if re.match('file:',baseurl): +- str0, path = baseurl.split('://',1) +- path = '/' + path.strip('/') + '/' +- else: +- h = 1 +- if re.fullmatch('8',version[0]): +- path_appstream = baseurl+'/AppStream' +- path_baseos = baseurl+'/BaseOS' +- path_310 = baseurl+'/kernel-3.10' +- path_419 = baseurl+'/kernel419' +- path_510 = baseurl+'/kernel510' +- +- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+path_appstream.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = '''+path_baseos.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = '''+path_419.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = '''+path_510.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n +-''' +- else: +- path_310 = baseurl+'/kernel-3.10' +- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+baseurl.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = '''+path_310.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n +- ''' +- repofile = os.path.join(reposdir, 'switch-to-uos.repo') +- with open(repofile,'w') as f_repo: +- f_repo.write(repostr_uos) +- f_repo.close() +- +- +-#检测repo文件创建缓存 +-def checkRepoMakeCache(): +- os.system('yum clean all') +- os.system('yum makecache') +- os_version_ret = platform.dist() +- os_arch = platform.machine() +- version = os_version_ret[1].split('.',-1) +- ret = os.path.exists('/var/cache/dnf/UniontechOS-AppStream.solv') +- if ret: +- ret = os.path.exists('/var/cache/dnf/UniontechOS-BaseOS.solv') +- if ret or re.fullmatch('7',version[0]): +- return 0 +- else: +- return 1 +- else: +- if re.fullmatch('7',version[0]): +- ret = os.path.exists('/var/cache/yum/%s/7/UniontechOS-AppStream/repomd.xml' % os_arch) +- if ret: +- return 0 +- return 1 +- +- +-#检测repo +-def check_repo(data_j): +- uos_sysmig_conf = json.loads(getSysMigConf()) +- AGENT_IP = json.loads(uos_sysmig_conf).get('agentip').strip()[1:-1] +- baseurl = json.loads(data_j).get('repo_pwd') +- keylist = None +- valuelist = None +- data = None +- init_remove_oldrepo() +- initRepoFile(baseurl) +- state = checkRepoMakeCache() +- +- if state == 0: +- keylist = ['ip','res','data'] +- valuelist = [AGENT_IP,state,'连接成功'] +- else: +- data = '下载失败,请检查您的软件源' +- keylist = ['ip','res','error'] +- valuelist = [AGENT_IP,state,data] +- return list_to_json(keylist,valuelist) +- + + def check_os_kernel(data): + uos_sysmig_conf = json.loads(getSysMigConf()) +diff --git a/sysmig_agent/short_task.py b/sysmig_agent/short_task.py +index 11dd9ef..4e4dae3 100644 +--- a/sysmig_agent/short_task.py ++++ b/sysmig_agent/short_task.py +@@ -138,3 +138,147 @@ def get_agent_os(): + AGENT_OS = os_version_ret[0] + version[0] + return AGENT_OS + ++ ++ ++def init_remove_oldrepo(): ++ backup_comment = '#This is a yum repository file that was disabled . \ ++ \n' ++ path = '/etc/yum.repos.d/' ++ repos = os.listdir(path) ++ for repo in repos: ++ path_file = path+'/'+repo ++ if not os.path.isfile(path_file): ++ continue ++ if not re.search('repo$',repo): ++ continue ++ with open(path_file, 'r') as fsrc: ++ content = fsrc.read() ++ with open(path_file+'.disabled','w') as fdst: ++ fdst.write(repo+'\n'+backup_comment+content) ++ fdst.close() ++ fsrc.close() ++ os.remove(path_file) ++ ++ ++#初始化repo文件 ++def initRepoFile(baseurl): ++ os_version_ret = platform.dist() ++ version = os_version_ret[1].split('.',-1) ++ reposdir = '/etc/yum.repos.d/' ++ h = 0 ++ if re.match('file:',baseurl): ++ str0, path = baseurl.split('://',1) ++ path = '/' + path.strip('/') + '/' ++ else: ++ h = 1 ++ if re.fullmatch('8',version[0]): ++ path_appstream = baseurl+'/AppStream' ++ path_baseos = baseurl+'/BaseOS' ++ path_310 = baseurl+'/kernel-3.10' ++ path_419 = baseurl+'/kernel419' ++ path_510 = baseurl+'/kernel510' ++ ++ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+path_appstream.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = '''+path_baseos.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = '''+path_419.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = '''+path_510.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n ++''' ++ else: ++ path_310 = baseurl+'/kernel-3.10' ++ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+baseurl.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = '''+path_310.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n ++ ''' ++ repofile = os.path.join(reposdir, 'switch-to-uos.repo') ++ with open(repofile,'w') as f_repo: ++ f_repo.write(repostr_uos) ++ f_repo.close() ++ ++ ++#检测repo文件创建缓存 ++def checkRepoMakeCache(): ++ os.system('yum clean all') ++ os.system('yum makecache') ++ os_version_ret = platform.dist() ++ os_arch = platform.machine() ++ version = os_version_ret[1].split('.',-1) ++ ret = os.path.exists('/var/cache/dnf/UniontechOS-AppStream.solv') ++ if ret: ++ ret = os.path.exists('/var/cache/dnf/UniontechOS-BaseOS.solv') ++ if ret or re.fullmatch('7',version[0]): ++ return 0 ++ else: ++ return 1 ++ else: ++ if re.fullmatch('7',version[0]): ++ ret = os.path.exists('/var/cache/yum/%s/7/UniontechOS-AppStream/repomd.xml' % os_arch) ++ if ret: ++ return 0 ++ return 1 ++ ++ ++# 检测centos 8 系统上的 repo文件联通 ++def checkRepoFileHttp(baseurl): ++ try: ++ with request.urlopen(baseurl) as file: ++ # print(file.status) ++ # print(file.reason) ++ if re.match('OK', file.reason): ++ return 0 ++ except Exception as e: ++ if re.match('HTTP Error 404|[Errno 2]', str(e)): ++ return 1 ++ elif re.match('[Errno 21]', str(e)): ++ return 0 ++ else: ++ return 1 ++ ++ ++def repoFileCheck(baseurl): ++ if re.match('file\:\/\/', baseurl): ++ path = re.sub('file://', '', baseurl) ++ if os.path.exists(path): ++ return 0 ++ else: ++ return 1 ++ try: ++ dst_status = urllib.request.urlopen(baseurl, timeout=5).code ++ return 0 ++ except Exception as err: ++ return 1 ++ pass ++ ++def check_repo(data): ++ agent_os = get_agent_os() ++ if '7' in agent_os: ++ agent_os = 'centos7' ++ elif '8' in agent_os: ++ agent_os = 'centos8' ++ os_type = agent_os + '_' + platform.machine().strip('') ++ baseurl = json.loads(data).get(os_type) ++ if not baseurl: ++ baseurl = '1' ++ task_id = json.loads(data).get('task_id') ++ # 更新SQL任务状态 ++ statue = 1 ++ sql_task_statue(statue, task_id) ++ # 发送消息给Server更新任务流状态 ++ post_server('task_start', task_id) ++ # 初始化去除旧的repo文件 ++ init_remove_oldrepo() ++ # 传递baseurl,配置repo文件 ++ initRepoFile(baseurl) ++ # 建立软件源缓存,判断软件源是否可用 ++ state = checkRepoMakeCache() ++ sql = '' ++ repo_state = -1 ++ if state == 0: ++ repo_state = repoFileCheck(baseurl) ++ else: ++ repo_state = 1 ++ ++ sql = "UPDATE agent_info SET repo_status = {} WHERE agent_ip = '{}';".format(repo_state, get_local_ip()) ++ try: ++ ret = DBHelper().execute(sql) ++ statue = 2 ++ except: ++ statue = 2 ++ sql_task_statue(statue, task_id) ++ sql_task_statue(statue, task_id) ++ post_server('task_close', task_id) ++ return 'success' +-- +2.20.1 + diff --git a/0018-add-interface-in-agent.patch b/0018-add-interface-in-agent.patch new file mode 100644 index 0000000000000000000000000000000000000000..db6f0c093d6f71b81c76e7749ad50c6832b81c91 --- /dev/null +++ b/0018-add-interface-in-agent.patch @@ -0,0 +1,37 @@ +From 26c0cd76dff728aee9bb24aa23a62258eb76a1d8 Mon Sep 17 00:00:00 2001 +From: lixin +Date: Mon, 13 Nov 2023 17:15:51 +0800 +Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + index.py | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/index.py b/index.py +index a392531..06a44c3 100644 +--- a/index.py ++++ b/index.py +@@ -204,6 +204,17 @@ def export_reports(): + return Response(mod, content_type='application/json') + + ++@app.route('/get_page_data', methods=['GET', 'POST']) ++def get_page_data(): ++ """ ++ 定时获取可用空间页面数据 ++ :return: ++ """ ++ mod = check_methods() ++ if mod: ++ return Response(mod, content_type='application/json') ++ ++ + @app.route('/', methods=['GET', 'POST']) + def MT_index(): + """ +-- +2.20.1 + diff --git a/0019-update-the-initilization-repo-file.patch b/0019-update-the-initilization-repo-file.patch new file mode 100644 index 0000000000000000000000000000000000000000..c814fa7ecdee0389cce75d19b3657b2f7b714962 --- /dev/null +++ b/0019-update-the-initilization-repo-file.patch @@ -0,0 +1,86 @@ +From 0e49cc38358147a06f2ddcb0888553eb57e47274 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Tue, 14 Nov 2023 09:37:02 +0800 +Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=9D=E5=A7=8B=E5=8C=96re?= + =?UTF-8?q?pos=E6=96=87=E4=BB=B6?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/short_task.py | 46 ++++++++++++++++++++++++-------------- + 1 file changed, 29 insertions(+), 17 deletions(-) + +diff --git a/sysmig_agent/short_task.py b/sysmig_agent/short_task.py +index 4e4dae3..2ef4ac6 100644 +--- a/sysmig_agent/short_task.py ++++ b/sysmig_agent/short_task.py +@@ -160,36 +160,48 @@ def init_remove_oldrepo(): + os.remove(path_file) + + +-#初始化repo文件 ++# 初始化repo文件 + def initRepoFile(baseurl): + os_version_ret = platform.dist() +- version = os_version_ret[1].split('.',-1) +- reposdir = '/etc/yum.repos.d/' ++ version = os_version_ret[1].split('.', -1) ++ AGENT_OS = os_version_ret[0] + version[0] ++ if re.search('7', AGENT_OS): ++ reposdir = '/etc/yum.repos.d/' ++ else: ++ reposdir = '/etc/yum.repos.d/' ++ # reposdir = dnf.Base().conf.get_reposdir + h = 0 +- if re.match('file:',baseurl): +- str0, path = baseurl.split('://',1) ++ if re.search('file', baseurl): ++ str0, path = baseurl.split('://', 1) + path = '/' + path.strip('/') + '/' + else: +- h = 1 +- if re.fullmatch('8',version[0]): +- path_appstream = baseurl+'/AppStream' +- path_baseos = baseurl+'/BaseOS' +- path_310 = baseurl+'/kernel-3.10' +- path_419 = baseurl+'/kernel419' +- path_510 = baseurl+'/kernel510' ++ h = 1 ++ if re.fullmatch('8', version[0]): ++ path_appstream = baseurl + '/AppStream' ++ path_baseos = baseurl + '/BaseOS' ++ path_310 = baseurl + '/kernel-3.10' ++ path_418 = baseurl + '/kernel-4.18' ++ path_419 = baseurl + '/kernel419' ++ path_510 = baseurl + '/kernel510' + +- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+path_appstream.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = '''+path_baseos.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = '''+path_419.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = '''+path_510.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n ++ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = ''' + path_appstream.strip( ++ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = ''' + path_baseos.strip( ++ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.18.0]\nname = UniontechOS Kernel-4.18.0\nbaseurl = ''' + path_418.strip( ++ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = ''' + path_419.strip( ++ '\n') + '''\nenabled = 1\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = ''' + path_510.strip( ++ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n + ''' + else: +- path_310 = baseurl+'/kernel-3.10' +- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+baseurl.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = '''+path_310.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n ++ path_310 = baseurl + '/kernel-3.10' ++ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = ''' + baseurl.strip( ++ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = ''' + path_310.strip( ++ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n + ''' + repofile = os.path.join(reposdir, 'switch-to-uos.repo') +- with open(repofile,'w') as f_repo: ++ with open(repofile, 'w') as f_repo: + f_repo.write(repostr_uos) + f_repo.close() + +- + #检测repo文件创建缓存 + def checkRepoMakeCache(): + os.system('yum clean all') +-- +2.20.1 + diff --git a/0020-rebrand-for-openeuler.patch b/0020-rebrand-for-openeuler.patch new file mode 100644 index 0000000000000000000000000000000000000000..21b44e3668cf371221099324ce8d6bb37f86443a --- /dev/null +++ b/0020-rebrand-for-openeuler.patch @@ -0,0 +1,1375 @@ +From bdf551f40a674c6760aff21731c2a0a008d1db4b Mon Sep 17 00:00:00 2001 +From: lixin +Date: Mon, 24 Feb 2025 10:14:52 +0800 +Subject: [PATCH] rebrand for openeuler + +--- + README_zh.md | 2 +- + connect_sql.py | 2 +- + index.py | 12 +- + rpm/migration-tools.spec | 470 ++++++++++++++++-- + .../{uos-sysmig.conf => migration-tools.conf} | 4 + + settings.py | 21 +- + sysmig_agent/Abisystmcompchk.py | 8 +- + sysmig_agent/centos72uos.sh | 16 +- + sysmig_agent/centos82uos.py | 20 +- + sysmig_agent/check.py | 38 +- + sysmig_agent/kernel.sh | 2 +- + sysmig_agent/migration.py | 20 +- + sysmig_agent/share.py | 52 +- + sysmig_agent/utils.py | 4 +- + templates/MT_check_environment.html | 14 +- + views/migration.py | 3 +- + views/reports.py | 9 +- + views/server.py | 10 +- + 18 files changed, 553 insertions(+), 154 deletions(-) + rename server/{uos-sysmig.conf => migration-tools.conf} (64%) + +diff --git a/README_zh.md b/README_zh.md +index 7a18b8d..97cee5a 100644 +--- a/README_zh.md ++++ b/README_zh.md +@@ -195,7 +195,7 @@ repo源配置页面 + ![迁移中](./figures/迁移中.png) + + - 迁移完成后,页面会跳转至迁移完成页面,可在该页面导出迁移后检测报告及迁移日志。 +-- 导出后,可在server端/var/tmp/uos-migration/目录下找到报告和日志的压缩包,解压后即可查看 ++- 导出后,可在server端/var/tmp/migration-tools/目录下找到报告和日志的压缩包,解压后即可查看 + ![迁移完成](./figures/迁移完成.png) + + - 迁移完成后,需手动重启agent机器,并验证是否迁移完成 +diff --git a/connect_sql.py b/connect_sql.py +index b5d0570..f0485af 100644 +--- a/connect_sql.py ++++ b/connect_sql.py +@@ -2,7 +2,7 @@ import pymysql + + class DBHelper: + # 构造函数 +- def __init__(self, host=db_host, user=db_user, pwd=db_password, db=db_name): ++ def __init__(self, host, user, pwd, db): + self.host = host + self.user = user + self.pwd = pwd +diff --git a/index.py b/index.py +index 06a44c3..0d1b542 100644 +--- a/index.py ++++ b/index.py +@@ -8,7 +8,7 @@ import json + from sysmig_agent import share + from views import migration, server + +-from flask import Flask, render_template, url_for, request, redirect, make_response, session, Response ++from flask import Flask, render_template, request, Response + app = Flask(__name__) + + mods = { +@@ -48,7 +48,7 @@ def check_methods(): + if mod: + response_str = mod(data) + return response_str +- ++ + + @app.route('/import_host_info', methods=['GET', 'POST']) + def import_host_info(): +@@ -297,7 +297,7 @@ def MT_check_user(): + mod = check_methods() + if mod: + return Response(mod, content_type='application/json') +- ++ + return render_template('MT_check_root.html') + + +@@ -327,7 +327,7 @@ def MT_kernel(): + 跳转检测内核界面 + :return: + """ +- return render_template('MT_kernel.html') ++ return render_template('MT_kernel.html') + + + @app.route('/MT_check_os_kernel', methods=['GET', 'POST']) +@@ -382,7 +382,7 @@ def MT_export_migration_reports(): + if mod: + data = request.get_data() + json_data = json.loads(data) +- mkdir_log_pwd = "/var/uos-migration/" ++ mkdir_log_pwd = "/var/migration-tools/" + isExists=os.path.exists(mkdir_log_pwd) + if not isExists: + try: +@@ -393,7 +393,7 @@ def MT_export_migration_reports(): + + info = mod.split(',') + scp_log = "sshpass -p '%s'" % password + " scp -r %s" % json_data.get('info').split("|")[0] + "@%s" % info[1] \ +- + ":/var/tmp/uos-migration/UOS*.tar.gz /var/uos-migration/" ++ + ":/var/tmp/migration-tools/UOS*.tar.gz /var/migration-tools/" + try: + os.system(scp_log) + print(scp_log) +diff --git a/rpm/migration-tools.spec b/rpm/migration-tools.spec +index 20292a0..3724f0b 100644 +--- a/rpm/migration-tools.spec ++++ b/rpm/migration-tools.spec +@@ -1,84 +1,482 @@ +-Name: migration-tools +-Version: 1.0.0 +-Release: 1 +-License: MulanPSL-2.0 +-Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system ++Name: migration-tools ++Version: 1.0.3 ++Release: 21 ++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 ++Source1: requires.tar.gz ++Source2: xlwt-1.3.0-py2.py3-none-any.whl ++# patches ++Patch001: 0001-download-the-rpm-package-in-the-system.patch ++Patch002: 0002-get-information-before-migration.patch ++Patch003: 0003-export-migration-check-report.patch ++Patch004: 0004-complete-information-report-after-abi-detection.patch ++Patch005: 0005-abi-detection-through-multi-threads.patch ++Patch006: 0006-add-message-query-to-update-abi-process.patch ++Patch007: 0007-start-task-to-check-migration.patch ++Patch008: 0008-add-system-migration-task.patch ++Patch009: 0009-get-abi-detection-process.patch ++Patch010: 0010-update-abi-result-to-database.patch ++Patch011: 0011-initializate-the-migration-status.patch ++Patch012: 0012-get-agent-kernel-version.patch ++Patch013: 0013-set-agent-migration-task.patch ++Patch014: 0014-compare-with-request-agent-ip.patch ++Patch015: 0015-agent-sends-the-task-after-receving-the-request.patch ++Patch016: 0016-export-migration-log.patch ++Patch017: 0017-add-task-to-check-repo.patch ++Patch018: 0018-add-interface-in-agent.patch ++Patch019: 0019-update-the-initilization-repo-file.patch ++#Patch020: 0001-rebrand-for-openeuler.patch ++ + +-Source0: ut-Migration-tools.tar.gz +-BuildArch: noarch ++BuildArch: noarch ++BuildRequires: systemd + %description + UOS Migration Software + +- ++%if 0%{?rhel} >= 7 + %package -n migration-tools-agent +-Summary: migration-tools-agent +-License: GPL +-Requires:dnf +-Requires:libabigail +-Requires:python3 +-Requires:python3-xlrd +-Requires:python3-xlwt +-Requires:python3-paramiko +-Requires:python3-flask +-Requires:rsync +-Requires:yum-utils ++Summary: migration-tools-agent ++License: MulanPSL-2.0 ++Requires: dnf ++Requires: libabigail ++Requires: python3 ++Requires: python3-flask ++Requires: python3-paramiko ++Requires: python3-requests ++Requires: python3-xlrd ++Requires: python3-xlwt ++Requires: openssl ++Requires: rsync ++Requires: yum-utils + + %description -n migration-tools-agent + Migration software agent side +- ++%endif + + %package -n migration-tools-server + Summary: migration-tools-server + License: MulanPSL-2.0 + Requires: python3 + Requires: python3-pip +-Requires: sshpass + Requires: python3-paramiko + Requires: python3-flask + Requires: python3-requests ++Requires: python3-PyMySQL + + %description -n migration-tools-server + Migration software server side + + + %prep +-%setup -c ++%autosetup -p1 ++ ++%if 0%{?openEuler} ++mkdir -p agent-requires/ ++cp -f %SOURCE1 agent-requires/ ++cp -f %SOURCE2 agent-requires/ ++%endif + + %install + rm -rf %{buildroot} + mkdir -p $RPM_BUILD_ROOT/usr/lib/migration-tools-server +-mkdir -p $RPM_BUILD_ROOT/var/tmp/uos-migration ++mkdir -p $RPM_BUILD_ROOT/var/tmp/migration-tools + mkdir -p $RPM_BUILD_ROOT/etc/migration-tools ++mkdir -p $RPM_BUILD_ROOT%{_unitdir} ++%{__cp} -r * $RPM_BUILD_ROOT/usr/lib/migration-tools-server/ ++ ++%if 0%{?rhel} >= 7 ++mkdir -p $RPM_BUILD_ROOT/usr/lib/migration-tools-agent ++%{__cp} -r * $RPM_BUILD_ROOT/usr/lib/migration-tools-agent/ + +-cp -r ut-Migration-tools/* $RPM_BUILD_ROOT/usr/lib/migration-tools-server/ ++%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools-agent.service $RPM_BUILD_ROOT%{_unitdir} ++%endif + + # Install server config + %{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools.conf $RPM_BUILD_ROOT/etc/migration-tools ++%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools-server.service $RPM_BUILD_ROOT%{_unitdir} + ++%posttrans ++%{_bindir}/systemctl daemon-reload + + %post -n migration-tools-server +-mkdir -p /etc/migration-tools +-mkdir -p /var/tmp/uos-migration +-cp -r /usr/lib/migration-tools-server/server/migration-tools-server.service /usr/lib/systemd/system/ ++pip3 install /usr/lib/migration-tools-server/agent-requires/xlwt-1.3.0-py2.py3-none-any.whl --no-cache-dir + chmod +x /usr/lib/migration-tools-server/server/start_webview.sh +-ln -s /usr/lib/migration-tools-server/server/start_webview.sh /usr/bin/migration-tools +-systemctl daemon-reload +-systemctl restart migration-tools-server.service +-systemctl enable migration-tools-server.service ++ln -sf /usr/lib/migration-tools-server/server/start_webview.sh /usr/bin/migration-tools + ++%preun -n migration-tools-server ++if [ $1 = 0 ];then ++ systemctl stop migration-tools-server.service ++fi + + %postun -n migration-tools-server +-systemctl disable migration-tools-server.service +-rm -rf /usr/lib/migration-tools-server/ +-rm -rf /usr/lib/migration-tools + rm -rf /usr/bin/migration-tools + +- + %files -n migration-tools-server + /etc/migration-tools ++/var/tmp/migration-tools + /usr/lib/migration-tools-server ++%{_unitdir}/migration-tools-server.service + ++%if 0%{?rhel} >= 7 ++%files -n migration-tools-agent ++/etc/migration-tools ++/var/tmp/migration-tools ++/usr/lib/migration-tools-agent ++%{_unitdir}/migration-tools-agent.service ++%endif + + %changelog ++* Wed Feb 19 2025 lixin - 1.0.3-20 ++- update for openEuler-25.03 ++- remove redundant patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-19 ++- 0019-update-the-initilization-repo-file.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-18 ++- 0018-add-interface-in-agent.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-17 ++- 0017-add-task-to-check-repo.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-16 ++- 0016-export-migration-log.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-15 ++- 0015-agent-sends-the-task-after-receving-the-request.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-14 ++- 0014-compare-with-request-agent-ip.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-13 ++- 0013-set-agent-migration-task.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-12 ++- 0012-get-agent-kernel-version.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-11 ++- 0011-initializate-the-migration-status.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-10 ++- 0010-update-abi-result-to-database.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-9 ++- 0009-get-abi-detection-process.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-8 ++- 0008-add-system-migration-task.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-7 ++- 0007-start-task-to-check-migration.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-6 ++- 0006-add-message-query-to-update-abi-process.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-5 ++- 0005-abi-detection-through-multi-threads.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-4 ++- 0004-complete-information-report-after-abi-detection.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-3 ++- 0003-export-migration-check-report.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-2 ++- 0002-get-information-before-migration.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-1 ++- 0001-download-the-rpm-package-in-the-system.patch ++ ++* Mon Nov 11 2024 xuezhixin - 1.0.3-0 ++- update to 1.0.3 ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-84 ++- 0084-divide-detection-report-into-mutiple-sheet-pages.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-83 ++- 0083-add-basic-summary-information-to-the-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-82 ++- 0082-write-the-data-of-each-row-and-column-into-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-81 ++- 0081-add-interface-to-export-migration-check-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-80 ++- 0080-write-the-data-of-each-row-into-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-79 ++- 0079-get-agent-storage-information.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-78 ++- 0078-fill-in-the-data-in-the-checked-templace.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-77 ++- 0077-copy-from-unzip-rpm-diractory-and-system-file-to-compatility-diractory.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-76 ++- 0076-detection-storage-interface.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-75 ++- 0075-detection-basic-information-and-format-abi-compatibility-information-to-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-74 ++- 0074-detection-basic-system-information.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-73 ++- 0073-get-os-version-and-os-id.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-72 ++- 0072-count-the-total-number-of-abi-compatible-lists.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-71 ++- 0071-get-package-list-from-repository.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-70 ++- 0070-interface-for-obtaining-repo-interface.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-69 ++- 0069-get-package-list-downloaded-locally-from-the-software-repository.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-68 ++- 0068-get-file-list-and-provide-file-path-to-compare.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-67 ++- 0067-add-an-abi-comparation-function.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-66 ++- 0066-check-if-file-is-binary.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-65 ++- 0065-get-checking-envirnmnet-process.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-64 ++- 0064-get-system-package-information-in-rpm-database.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-63 ++- 0063-add-compare-with-package-result-in-abi-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-62 ++- 0062-add-detection-ELF-content-in-abi-file.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-61 ++- 0061-detection-abi-log.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-60 ++- 0060-add-four-detection-item-to-abi-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-59 ++- 0059-add-kernel-detection-result-to-abi-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-58 ++- 0058-get-detection-envirnment-process-interface.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-57 ++- 0057-abi-basic-data-for-report.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-56 ++- 0056-modify-detection-envirnment-interface.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-55 ++- 0055-add-envirnment-detection-interface-before-migration.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-54 ++- 0054-removed-detection-abi-script.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-53 ++- 0053-get-repository-detection-result.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-52 ++- 0052-increase-the-weight-of-abi-detection-result.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-51 ++- 0051-add-basic-system-detection-information-and-upload-the-database.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-50 ++- 0050-check-free-space-in-system-disk.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-49 ++- 0049-add-interface-to-check-repository-result.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-48 ++- 0048-server-send-kernel-detection-task.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-47 ++- 0047-check-kernel-version-in-repository.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-46 ++- 0046-agent-sends-task-update-requrst-to-the-server.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-45 ++- 0045-modify-repository-file.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-44 ++- 0044-migrate-in-myutiple-steps.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-43 ++- 0043-process-os-version-and-os-name.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-42 ++- 0042-get-initial-os-version-from-agent_info-interface.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-41 ++- 0041-get-migration-status-from-database.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-40 ++- 0040-intial-logfile-and-tmpfile.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-39 ++- 0039-repository-file-choose-kernel-version-to-migration.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-38 ++- 0038-obtain-kernel-data.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-37 ++- 0037-add-subprocess-function-and-loggin.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-36 ++- 0036-add-an-interface-to-obtain-kernel-information.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-35 ++- 0035-the-migration-process-can-choose-not-to-migrate-the-kernel.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-34 ++- 0034-add-centos7-and-centos8-migration-interface.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-33 ++- 0033-check-system-kernrel.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-32 ++- 0032-add-migration.py-to-migration-function.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-31 ++- 0031-migration-check-and-extract-macros.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-30 ++- 0030-system-information-import-info-the-database-after-migration.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-29 ++- 0029-json-and-list-format-interchange.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-28 ++- 0028-send-agent-task.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-27 ++- 0027-fix-grub-file-for-system-option.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-26 ++- 0026-create-repository-and-disable-local-repofile.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-25 ++- 0025-update-migration-status-to-database.patch ++ ++* Tue Nov 5 2024 xuezhixin - 1.0.2-24 ++- 0024-add-url-processing-function.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-23 ++- 0023-update-the-status-of-the-migration-phase.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-22 ++- 0022-udpate-agent-host-status-online.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-21 ++- 0021-get-agent-ip-interface.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-20 ++- 0020-get-task-process-and-migration-stage-information.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-19 ++- 0019-update-abi-result-to-database.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-18 ++- 0018-detection-of-imported-host-information-interface.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-17 ++- 0017-add-process-data-in-database.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-16 ++- 0016-get-local-ip-on-the-agent.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-15 ++- 0015-delete-host-information-interface.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-14 ++- 0014-modify-task-stream-interface.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-13 ++- 0013-display-agent-host-information.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-12 ++- 0012-add-agent_task-in-database.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-11 ++- 0011-replace-agent-with-func-diractory.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-10 ++- 0010-create-task-stream-interface.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-9 ++- 0009-add-task_stream-table-in-database.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-8 ++- 0008-add-agent_info-table-in-database.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-7 ++- 0007-add-function-to-import-machine.patch ++ ++* Mon Nov 4 2024 xuezhixin - 1.0.2-6 ++- 0006-add-loger-interface-function.patch ++ ++* Fri Nov 1 2024 xuezhixin - 1.0.2-5 ++- add 0005-execution-sql-function.patch ++ ++* Fri Nov 1 2024 xuezhixin - 1.0.2-4 ++- add 0004-connect-sql-function.patch ++ ++* Fri Nov 1 2024 xuezhixin - 1.0.2-3 ++- add 0003-delete-redundant-code.patch ++ ++* Fri Nov 1 2024 xuezhixin - 1.0.2-2 ++- add 0002-modify-excel-report-content.patch ++ ++* Thu Oct 31 2024 xuezhixin - 1.0.2-1 ++- add 0001-stander-code.patch ++ ++* Tue Aug 27 2024 lihaipeng - 1.0.1-7 ++- fix cancel button function in tool ++ ++* Tue Jul 09 2024 Wenhua Huang - 1.0.1-6 ++- add BuildRequires systemd ++ ++* Tue Apr 02 2024 lixin - 1.0.1-5 ++- adjust the display sequence ++ ++* Mon Apr 01 2024 lixin - 1.0.1-4 ++- modify description ++ ++* Mon Mar 18 2024 lixin - 1.0.1-3 ++- fix stop service display failed ++- update spec ++ ++* Mon Mar 11 2024 lixin - 1.0.1-2 ++- fix : CVE-2024-24892 ++- use paramiko instead of sshpass to export migration log ++- and data ++ ++* Tue Mar 05 2024 lixin - 1.0.1-1 ++- Supports migrations to OpenEuler system using the web-based interface. ++ ++* Wed Sep 06 2023 lixin - 1.0.0-4 ++- fix: fix uefi boot failed ++- fix: modify grub rules to match NIC name after migration ++ ++* Tue Aug 22 2023 lixin - 1.0.0-3 ++- feat: add aarch64 agent package ++ ++* Mon Aug 21 2023 lixin - 1.0.0-2 ++- fix export log and migration report error ++- fix no migration detail error ++ + * Wed Aug 16 2023 lixin - 1.0.0-1 +-- init ++ init +diff --git a/server/uos-sysmig.conf b/server/migration-tools.conf +similarity index 64% +rename from server/uos-sysmig.conf +rename to server/migration-tools.conf +index 98aaa1c..162c736 100644 +--- a/server/uos-sysmig.conf ++++ b/server/migration-tools.conf +@@ -1,6 +1,10 @@ + [Server] + IP = "0.0.0.0" + PORT = "9999" ++DB_NAME = "uossysmig" ++DB_PASSWORD = "Mig2025.." ++DB_USER = "root" ++ + + [Agent] + IP = "0.0.0.0" +diff --git a/settings.py b/settings.py +index c8e945f..c9f3a56 100644 +--- a/settings.py ++++ b/settings.py +@@ -2,19 +2,18 @@ + # SPDX-License-Identifier: MulanPubL-2.0-or-later + + # AGENT目录 +-AGENT_DIR = '/var/tmp/uos-migration/' ++AGENT_DIR = '/var/tmp/migration-tools/' + + #迁移数据目录 +-MIGRATION_DATA_RPMS_DIR = '/var/tmp/uos-migration/data/exp-rst' +-MIGRATION_DATA_RPMS_3_INFO = '/var/tmp/uos-migration/data/exp-rst/pkginfo_3.txt' +-MIGRATION_DIR = '/var/tmp/uos-migration/UOS_migration_log' +-MIGRATION_KERNEL = '/var/tmp/uos-migration/kernel' +-pstate = '/var/tmp/uos-migration/.state' ++MIGRATION_DATA_RPMS_DIR = '/var/tmp/migration-tools/data/exp-rst' ++MIGRATION_DATA_RPMS_3_INFO = '/var/tmp/migration-tools/data/exp-rst/pkginfo_3.txt' ++MIGRATION_DIR = '/var/tmp/migration-tools/UOS_migration_log' ++MIGRATION_KERNEL = '/var/tmp/migration-tools/kernel' ++pstate = '/var/tmp/migration-tools/.state' + progresslogdir = AGENT_DIR + '.progress' +-PROGRESS = '/var/tmp/uos-migration/.progress' ++PROGRESS = '/var/tmp/migration-tools/.progress' + + # 迁移前分析目录 +-PRE_MIG = '/var/tmp/uos-migration/UOS_analysis_report/rpmva-before.txt' +-PRE_MIG_DIR = '/var/tmp/uos-migration/UOS_analysis_report' +- +-RPMS = '/var/tmp/uos-migration/.rpms' ++PRE_MIG = '/var/tmp/migration-tools/UOS_analysis_report/rpmva-before.txt' ++PRE_MIG_DIR = '/var/tmp/migration-tools/UOS_analysis_report' ++RPMS = '/var/tmp/migration-tools/.rpms' +diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py +index 79e6581..56af395 100644 +--- a/sysmig_agent/Abisystmcompchk.py ++++ b/sysmig_agent/Abisystmcompchk.py +@@ -23,7 +23,7 @@ queueLock = threading.Lock() + + #为便于测试将变量、接口从share.py中拷贝到当前文件,待联调通过后删除即可 + ######################## add for test start ######################## +-local_dir = '/var/tmp/uos-migration/data/' ++local_dir = '/var/tmp/migration-tools/data/' + exp_rst_dir = local_dir+'exp-rst/' + + current_system_unique = exp_rst_dir + 'current-system-unique.csv' +@@ -165,7 +165,7 @@ def agent_ABI_check_result(): + + def logger_init(): + log_file = 'Abisystmcompchk.log' + '.' + datetime.datetime.now().strftime('%Y%m%d%H%M') +- log_path = '/var/tmp/uos-migration/UOS_migration_log/' ++ log_path = '/var/tmp/migration-tools/UOS_migration_log/' + if not os.path.exists(log_path): + os.makedirs(log_path) + +@@ -646,8 +646,8 @@ def mycopyfile(srcfile, dstfile, logger): + #Generate report name + def create_migrate_report_name(flag, logg): + +- migrate_before_report_path = '/var/tmp/uos-migration/UOS_analysis_report/' +- migrate_behind_report_path = '/var/tmp/uos-migration/UOS_migration_completed_report/' ++ migrate_before_report_path = '/var/tmp/migration-tools/UOS_analysis_report/' ++ migrate_behind_report_path = '/var/tmp/migration-tools/UOS_migration_completed_report/' + + migrate_report_before_sample_name = 'UOS_migration_report_HOSTIP_HOSTNAME_YYYYMMDDHHMM-BEFORE.xls' + migrate_report_behind_sample_name = 'UOS_migration_report_HOSTIP_HOSTNAME_YYYYMMDDHHMM-BEHIND.xls' +diff --git a/sysmig_agent/centos72uos.sh b/sysmig_agent/centos72uos.sh +index 4423138..9796ec6 100755 +--- a/sysmig_agent/centos72uos.sh ++++ b/sysmig_agent/centos72uos.sh +@@ -44,7 +44,7 @@ fi + comd=$knl + + yum_url=file:///etc/yum.repos.d/ +-bad_packages=( subscription-manager gstreamer1-plugins-bad-free-gtk python-meh-gui clucene-contribs-lib centos-release centos-release-cr libreport-plugin-rhtsupport yum-rhn-plugin desktop-backgrounds-basic centos-logos libreport-centos libreport-plugin-mantisbt sl-logos python36-rpm) ++bad_packages=( subscription-manager gstreamer1-plugins-bad-free-gtk python-meh-gui clucene-contribs-lib centos-release centos-release-cr libreport-plugin-rhtsupport yum-rhn-plugin desktop-backgrounds-basic centos-logos libreport-centos libreport-plugin-mantisbt sl-logos python36-rpm) + + + usage() { +@@ -84,7 +84,7 @@ restore_repos() { + Your repositories have been restored to your previous configuration." + } + +-yum install -y uos-license-mini license-config ++yum install -y uos-license-mini license-config + ## Start of script + + while getopts "h" option; do +@@ -173,8 +173,8 @@ fi + + ################# 使用uos-release-server默认软件源## + #: ' +-yum -y downgrade python-urlgrabber +-yum -y install python-urlgrabber ++yum -y downgrade python-urlgrabber ++yum -y install python-urlgrabber + #' + ##################################################### + +@@ -273,11 +273,11 @@ then + `) + update=(`ls -1 $kernel_dir |sed -e s/-[[:digit:]]./@/| awk -F '@' '{print $1}' + `) +- ++ + t=0 + flag=0 + declare -a diff_list +- ++ + for i in ${local[@]} + do + for j in ${update[@]} +@@ -302,7 +302,7 @@ then + do + rpm -ef $x --nodeps + done +- ++ + else + echo "Error,The kernel-"$comd" packages was not found in the source" + exit +@@ -311,6 +311,6 @@ fi + + rpm -qa --qf \ + "%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\n" \ +- | sort > "/var/tmp/uos-migration/UOS_migration_log/rpms-list-after.txt ++ | sort > "/var/tmp/migration-tools/UOS_migration_log/rpms-list-after.txt + + echo "Switch complete. UOS Server Enterprise-C 20 recommends rebooting this system." +diff --git a/sysmig_agent/centos82uos.py b/sysmig_agent/centos82uos.py +index cc54eba..a306264 100755 +--- a/sysmig_agent/centos82uos.py ++++ b/sysmig_agent/centos82uos.py +@@ -84,12 +84,12 @@ def clean_and_exit(): + def process_special_pkgs(): + print("swap *-logos related packages with UniontechOS packages") + subprocess.run('rpm -q centos-logos-ipa && dnf swap -y centos-logos-ipa uos-logos-ipa', shell=True) +- subprocess.run('rpm -q centos-logos-httpd && dnf swap -y centos-logos-httpd uos-logos-httpd', shell=True) ++ subprocess.run('rpm -q centos-logos-httpd && dnf swap -y centos-logos-httpd uos-logos-httpd', shell=True) + print("redhat-lsb is replaced by system-lsb on UniontechOS") + subprocess.run('rpm -q redhat-lsb-core && dnf swap -y redhat-lsb-core system-lsb-core', shell=True) + subprocess.run('rpm -q redhat-lsb-submod-security && dnf swap -y redhat-lsb-submod-security system-lsb-submod-security',shell=True) + print("rhn related packages is not provided by UniontechOS") +- subprocess.run('rpm -q rhn-client-tools && dnf -y remove rhn-client-tools python3-rhn-client-tools python3-rhnlib', shell=True) ++ subprocess.run('rpm -q rhn-client-tools && dnf -y remove rhn-client-tools python3-rhn-client-tools python3-rhnlib', shell=True) + print("subscription-manager related packages is not provided by UniontechOS") + subprocess.run('rpm -q subscription-manager && dnf -y remove subscription-manager', shell=True) + print("python3-syspurpose is not provided by UniontechOS") +@@ -104,9 +104,9 @@ def pre_system_rpms_info(): + print("Verifying RPMs installed before the switch against RPM database") + out1 = subprocess.check_output('rpm -qa --qf \ + "%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\\n" \ +- | sort > "/var/tmp/uos-migration/UOS_migration_log/rpms-list-before.txt"', shell=True) +- out2 = subprocess.check_output('rpm -Va | sort -k3 > "/var/tmp/uos-migration/UOS_migration_log/rpms-verified-before.txt"',shell=True) +- files = os.listdir('/var/tmp/uos-migration/') ++ | sort > "/var/tmp/migration-tools/UOS_migration_log/rpms-list-before.txt"', shell=True) ++ out2 = subprocess.check_output('rpm -Va | sort -k3 > "/var/tmp/migration-tools/UOS_migration_log/rpms-verified-before.txt"',shell=True) ++ files = os.listdir('/var/tmp/migration-tools/') + hostname = socket.gethostname() + print("Review the output of following files:") + for f in files: +@@ -119,7 +119,7 @@ def centos8_main(osname): + logger = logging.getLogger() + logger.setLevel(logging.INFO) + #rq = time.strftime('%Y%m%d%H%M', time.localtime(time.time())) +- log_name = '/var/tmp/uos-migration/UOS_migration_log/log' ++ log_name = '/var/tmp/migration-tools/UOS_migration_log/log' + logfile = log_name + fh = logging.FileHandler(logfile, mode='w') + fh.setLevel(logging.DEBUG) +@@ -199,7 +199,7 @@ def centos8_main(osname): + logger.info("========= Checking: dnf =========") + logger.info("Identifying dnf modules that are enabled...") + enabled_modules = str( +- subprocess.check_output("dnf module list --enabled | grep rhel | awk '{print $1}'", shell=True), ++ subprocess.check_output("dnf module list --enabled | grep rhel | awk '{print $1}'", shell=True), + 'utf-8') + enabled_modules = enabled_modules.split('\n')[:-1] + unknown_mods=[] +@@ -262,7 +262,7 @@ install '+ ' '.join(base_packages) + '\n\ + run\n\ + EOF' + try: +- fdout = open("/var/tmp/uos-migration/UOS_migration_log/mig_log.txt",'a') ++ fdout = open("/var/tmp/migration-tools/UOS_migration_log/mig_log.txt",'a') + subprocess.run(cmd,stdout=fdout , shell=True) + fdout.close() + except: +@@ -273,7 +273,7 @@ EOF' + logger.info("Updating initrd...") + indexhtml ='rpm -e --nodeps ' + osname+'-indexhtml' + os.system(indexhtml) +- fdout = open("/var/tmp/uos-migration/UOS_migration_log/mig_log.txt",'a') ++ fdout = open("/var/tmp/migration-tools/UOS_migration_log/mig_log.txt",'a') + subprocess.run('/usr/libexec/plymouth/plymouth-update-initrd',stdout=fdout,shell=True) + #run_cmd2file('/usr/libexec/plymouth/plymouth-update-initrd') + fdout.close() +@@ -283,7 +283,7 @@ EOF' + if subver == '8.3': + subprocess.run('yum -y downgrade crypto-policies --allowerasing', shell=True) + try: +- fdout = open("/var/tmp/uos-migration/UOS_migration_log/mig_log.txt",'a') ++ fdout = open("/var/tmp/migration-tools/UOS_migration_log/mig_log.txt",'a') + subprocess.run('yum -y distro-sync', stdout=fdout ,shell=True) + fdout.close() + except: +diff --git a/sysmig_agent/check.py b/sysmig_agent/check.py +index 1a21c52..3538666 100644 +--- a/sysmig_agent/check.py ++++ b/sysmig_agent/check.py +@@ -22,21 +22,21 @@ os.chdir('/usr/lib/migration-tools-agent') + def init_dir(): + if not os.path.isdir(PRE_MIG_DIR): + os.makedirs(PRE_MIG_DIR) +- ++ + if not os.path.isdir(MIGRATION_DIR): + os.makedirs(MIGRATION_DIR) + + if not os.path.isdir(MIGRATION_KERNEL): + os.makedirs(MIGRATION_KERNEL) +- ++ + if not os.path.isdir(MIGRATION_DATA_RPMS_DIR): + os.makedirs(MIGRATION_DATA_RPMS_DIR) +- ++ + if not os.path.exists(PRE_MIG): + with open(PRE_MIG,'w+') as fp: + fp.write(' ') + fp.close() +- ++ + if not os.path.exists(PROGRESS): + with open(PROGRESS,'w+') as fp: + fp.write(' ') +@@ -240,8 +240,8 @@ def export_reports(data): + ip = json.loads(uos_sysmig_conf).get('agentip').strip() + now = datetime.datetime.now().strftime('%Y%m%d%H%M%S') + +- compression = "tar zcvf /var/tmp/uos-migration/%s" % json_data.get("name") + "_%s" % ip +\ +- "_%s" % hostname + "_%s" % now + ".tar.gz" + " /var/tmp/uos-migration/%s" % json_data.get("export") ++ compression = "tar zcvf /var/tmp/migration-tools/%s" % json_data.get("name") + "_%s" % ip +\ ++ "_%s" % hostname + "_%s" % now + ".tar.gz" + " /var/tmp/migration-tools/%s" % json_data.get("export") + print(compression) + try: + os.system(compression) +@@ -267,7 +267,7 @@ def systemCheckRequires(conflist): + + def fork_sh(cmd): + try: +- fderr = open("/var/tmp/uos-migration/UOS_migration_log/err_log",'a') ++ fderr = open("/var/tmp/migration-tools/UOS_migration_log/err_log",'a') + subprocess.run(cmd, stderr=fderr , shell=True) + messageState('2') + fderr.close() +@@ -317,7 +317,7 @@ def check_environment(data_j): + + # 检测进度 + def analysisProgress(): +- path = '/var/tmp/uos-migration/data/uos/rpms' ++ path = '/var/tmp/migration-tools/data/uos/rpms' + if os.path.exists(path): + file_list = os.listdir(path) + else: +@@ -388,7 +388,7 @@ def ifnot_mig_kernel(kernel_version): + + + def mig_kernel(kernel_version): +- cwd = '/var/tmp/uos-migration/kernel/' ++ cwd = '/var/tmp/migration-tools/kernel/' + ret = os.listdir(cwd) + for i in ret: + os.unlink(cwd+i) +@@ -404,15 +404,15 @@ def mig_kernel(kernel_version): + repo = 'UniontechOS-kernel-'+kernel_version.strip() + else: + return 1 +- down_cmd = 'yumdownloader --destdir "/var/tmp/uos-migration/kernel" --enablerepo '+repo ++ down_cmd = 'yumdownloader --destdir "/var/tmp/migration-tools/kernel" --enablerepo '+repo + ret = os.popen(cmd).readlines() + for i in ret: + downpackage = down_cmd+' '+i.strip()+'-'+kernel_version.strip() + os.system(downpackage) + +- cwd = '/var/tmp/uos-migration/kernel/' ++ cwd = '/var/tmp/migration-tools/kernel/' + if os.listdir(cwd): +- os.system('rpm -Uvh "/var/tmp/uos-migration/kernel/*" --nodeps --oldpackage') ++ os.system('rpm -Uvh "/var/tmp/migration-tools/kernel/*" --nodeps --oldpackage') + else: + ifnot_mig_kernel() + return 1 +@@ -421,7 +421,7 @@ def mig_kernel(kernel_version): + def migration_details(data_j): + uos_sysmig_conf = json.loads(getSysMigConf()) + AGENT_IP = json.loads(uos_sysmig_conf).get('agentip').strip()[1:-1] +- path = '/var/tmp/uos-migration/UOS_migration_log/mig_log.txt' ++ path = '/var/tmp/migration-tools/UOS_migration_log/mig_log.txt' + if os.path.exists(path): + with open(path,'r') as lf: + data = lf.read() +@@ -515,23 +515,23 @@ def system_migration(data_j): + 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'): ++ main_conf(oldos[1]) ++ if os.path.exists('/var/tmp/migration-tools/data/exp-rst/systeminfo.txt'): + run_cmd2file('sh sysmig_agent/Abitranrept.sh') + abi_txt2xls_after_mig() + messageState('4') + elif re.fullmatch('4',state): + messageState('5') +- if os.path.exists('/var/tmp/uos-migration/UOS_migration_log/rpms-verified-after.txt'): ++ if os.path.exists('/var/tmp/migration-tools/UOS_migration_log/rpms-verified-after.txt'): + res = '0' + else: + res = '-1' + elif re.fullmatch('3',state): + messageState('5') +- if os.path.exists('/var/tmp/uos-migration/data/exp-rst/systeminfo.txt'): ++ if os.path.exists('/var/tmp/migration-tools/data/exp-rst/systeminfo.txt'): + run_cmd2file('sysmig_agent/Abitranrept.sh') + abi_txt2xls_after_mig() +- if os.path.exists('/var/tmp/uos-migration/UOS_migration_log/rpms-list-after.txt'): ++ if os.path.exists('/var/tmp/migration-tools/UOS_migration_log/rpms-list-after.txt'): + res = '0' + else: + res = '-1' +@@ -546,7 +546,7 @@ def system_migration(data_j): + keylist = ['ip','res','data'] + valuelist = [AGENT_IP,res,data] + return list_to_json(keylist,valuelist) +- ++ + res = '2' + data = '......' + keylist = ['ip','res','data'] +diff --git a/sysmig_agent/kernel.sh b/sysmig_agent/kernel.sh +index fd3178d..bcd5da9 100755 +--- a/sysmig_agent/kernel.sh ++++ b/sysmig_agent/kernel.sh +@@ -4,7 +4,7 @@ set -x + + set -e + unset CDPATH +-KERNEL=/var/tmp/uos-migration/kernel ++KERNEL=/var/tmp/migration-tools/kernel + + while getopts :d:k: opt + do +diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py +index a3265e9..b4ca652 100644 +--- a/sysmig_agent/migration.py ++++ b/sysmig_agent/migration.py +@@ -6,7 +6,7 @@ from sysmig_agent.centos82uos import * + #sys.path.append("..") + from connect_sql import DBHelper + +-RPMS = '/var/tmp/uos-migration/.rpms' ++RPMS = '/var/tmp/migration-tools/.rpms' + + # migrations function + +@@ -32,7 +32,7 @@ def migprogress(): + + + def readline_log(): +- path = '/var/tmp/uos-migration/UOS_migration_log/mig_log.txt' ++ path = '/var/tmp/migration-tools/UOS_migration_log/mig_log.txt' + if not os.path.exists(path): + return None + else: +@@ -46,7 +46,7 @@ def readline_log(): + + def migInit_porgress(): + uelc_rpm = os.popen('rpm -qa|wc -l').readlines() +- with open('/var/tmp/uos-migration/.rpms', 'w+') as fp: ++ with open('/var/tmp/migration-tools/.rpms', 'w+') as fp: + fp.write(uelc_rpm[0]) + fp.close() + +@@ -136,7 +136,7 @@ def disable_exclude(): + # migration kernel + def mig_kernel(kernel_version): + disable_exclude() +- cwd = '/var/tmp/uos-migration/kernel/' ++ cwd = '/var/tmp/migration-tools/kernel/' + if not os.path.exists(cwd): + os.mkdir(cwd) + ret = os.listdir(cwd) +@@ -155,14 +155,14 @@ def mig_kernel(kernel_version): + repo = 'UniontechOS-kernel-' + kernel_version.strip() + else: + return 1 +- down_cmd = 'yumdownloader --destdir "/var/tmp/uos-migration/kernel" --enablerepo '+repo ++ down_cmd = 'yumdownloader --destdir "/var/tmp/migration-tools/kernel" --enablerepo '+repo + ret = os.popen(cmd).readlines() + for i in ret: + downpackage = down_cmd+' '+i.strip()+'-'+kernel_version.strip() + # os.system(downpackage) + run_subprocess(downpackage) + +- cwd = '/var/tmp/uos-migration/kernel/' ++ cwd = '/var/tmp/migration-tools/kernel/' + if os.listdir(cwd): + cmd = 'rpm -Uvh "{}*" --nodeps --oldpackage'.format(cwd) + # os.system(cmd) +@@ -256,22 +256,22 @@ def mig_system_migration(kernel_version): + fp.close() + oldos = oldos.split(':',1) + main_conf(oldos[1]) +- if os.path.exists('/var/tmp/uos-migration/data/exp-rst/systeminfo.txt'): ++ if os.path.exists('/var/tmp/migration-tools/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'): ++ if os.path.exists('/var/tmp/migration-tools/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'): ++ if os.path.exists('/var/tmp/migration-tools/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'): ++ if os.path.exists('/var/tmp/migration-tools/UOS_migration_log/rpms-list-after.txt'): + res = '0' + else: + res = '-1' +diff --git a/sysmig_agent/share.py b/sysmig_agent/share.py +index 0bd73f6..f253e46 100644 +--- a/sysmig_agent/share.py ++++ b/sysmig_agent/share.py +@@ -17,24 +17,24 @@ from connect_sql import DBHelper + defaultencoding = 'utf-8' + # logdss = Logger('./logdss.log',logging.DEBUG,logging.DEBUG) + new_os = '统信服务器操作系统V20({})' +-AGENT_DIR = '/var/tmp/uos-migration/' +-PRE_MIG = '/var/tmp/uos-migration/UOS_analysis_report/rpmva-before.txt' +-PRE_MIG_DIR = '/var/tmp/uos-migration/UOS_analysis_report' +-MIGRATION_DIR = '/var/tmp/uos-migration/UOS_migration_log' +-MIGRATION_REPORT_DIR = '/var/tmp/uos-migration/UOS_migration_completed_report' +- +- +-PROGRESS = '/var/tmp/uos-migration/.progress' +-RPMS = '/var/tmp/uos-migration/.rpms' +-MIGRATION_KERNEL = '/var/tmp/uos-migration/kernel' +-MIGRATION_LOG = '/var/tmp/uos-migration/UOS_migration_log/log' +-MIGRATION_DATA_RPMS_DIR = '/var/tmp/uos-migration/data/exp-rst' +-MIGRATION_DATA_RPMS_3_INFO = '/var/tmp/uos-migration/data/exp-rst/pkginfo_3.txt' +-pstate = '/var/tmp/uos-migration/.state' +- +-abi_file = '/var/tmp/uos-migration/data/exp-rst/agent_ABI_check_result.csv' ++AGENT_DIR = '/var/tmp/migration-tools/' ++PRE_MIG = '/var/tmp/migration-tools/UOS_analysis_report/rpmva-before.txt' ++PRE_MIG_DIR = '/var/tmp/migration-tools/UOS_analysis_report' ++MIGRATION_DIR = '/var/tmp/migration-tools/UOS_migration_log' ++MIGRATION_REPORT_DIR = '/var/tmp/migration-tools/UOS_migration_completed_report' ++ ++ ++PROGRESS = '/var/tmp/migration-tools/.progress' ++RPMS = '/var/tmp/migration-tools/.rpms' ++MIGRATION_KERNEL = '/var/tmp/migration-tools/kernel' ++MIGRATION_LOG = '/var/tmp/migration-tools/UOS_migration_log/log' ++MIGRATION_DATA_RPMS_DIR = '/var/tmp/migration-tools/data/exp-rst' ++MIGRATION_DATA_RPMS_3_INFO = '/var/tmp/migration-tools/data/exp-rst/pkginfo_3.txt' ++pstate = '/var/tmp/migration-tools/.state' ++ ++abi_file = '/var/tmp/migration-tools/data/exp-rst/agent_ABI_check_result.csv' + #Abi +-local_dir = '/var/tmp/uos-migration/data/' ++local_dir = '/var/tmp/migration-tools/data/' + exp_rst_dir = local_dir+'exp-rst/' + + current_system_unique = exp_rst_dir + 'current-system-unique.csv' +@@ -206,8 +206,8 @@ def getSysMigConf(): + + + def run_cmd2file(cmd): +- fdout = open("/var/tmp/uos-migration/UOS_migration_log/mig_log.txt",'a') +- fderr = open("/var/tmp/uos-migration/UOS_migration_log/err_log",'a') ++ fdout = open("/var/tmp/migration-tools/UOS_migration_log/mig_log.txt",'a') ++ fderr = open("/var/tmp/migration-tools/UOS_migration_log/err_log",'a') + p = subprocess.Popen(cmd, stdout=fdout, stderr=fderr, shell=True) + if p.poll(): + return +@@ -353,7 +353,7 @@ def list_to_json(keylist, valuelist): + def main_conf(osname): + logger = logging.getLogger() + logger.setLevel(logging.INFO) +- log_name = '/var/tmp/uos-migration/UOS_migration_log/log' ++ log_name = '/var/tmp/migration-tools/UOS_migration_log/log' + logfile = log_name + fh = logging.FileHandler(logfile, mode='w') + fh.setLevel(logging.DEBUG) +@@ -381,7 +381,7 @@ def main_conf(osname): + subprocess.run('dnf module disable -y satellite-5-client', shell=True) + except: + pass +- process_special_pkgs() ++ process_special_pkgs() + logger.info("Removing yum cache") + if os.path.isfile('/var/cache/yum'): + os.remove('/var/cache/yum') +@@ -392,7 +392,7 @@ def main_conf(osname): + elif os.path.isdir('/var/cache/dnf'): + shutil.rmtree('/var/cache/dnf') + logger.info("------------- : "+osname) +- ++ + conf_grub() + title_conf(osname) + +@@ -400,8 +400,8 @@ def main_conf(osname): + logger.info("Verifying RPMs installed after the switch against RPM database") + out1 = subprocess.check_output('rpm -qa --qf \ + "%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\n" \ +- | sort > "/var/tmp/uos-migration/UOS_migration_log/rpms-list-after.txt"', shell=True) +- out2 = subprocess.check_output('rpm -Va | sort -k3 > "/var/tmp/uos-migration/UOS_migration_log/rpms-verified-after.txt"',shell=True) ++ | sort > "/var/tmp/migration-tools/UOS_migration_log/rpms-list-after.txt"', shell=True) ++ out2 = subprocess.check_output('rpm -Va | sort -k3 > "/var/tmp/migration-tools/UOS_migration_log/rpms-verified-after.txt"',shell=True) + + logger.info("Switch complete.UniontechOS recommends rebooting this system.") + return 0 +@@ -444,8 +444,8 @@ def run_subprocess(cmd="", print_cmd=True, print_output=True): + output (print_output=True). Switching off printing the command can be useful in case it contains + a password in plain text. + """ +- cwdo = '/var/tmp/uos-migration/UOS_migration_log/mig_log.txt' +- cwde = '/var/tmp/uos-migration/UOS_migration_log/mig_err.txt' ++ cwdo = '/var/tmp/migration-tools/UOS_migration_log/mig_log.txt' ++ cwde = '/var/tmp/migration-tools/UOS_migration_log/mig_err.txt' + # fderr = open(cwde, 'a') + # from logging import * + # if print_cmd: +diff --git a/sysmig_agent/utils.py b/sysmig_agent/utils.py +index 472879b..b690d62 100644 +--- a/sysmig_agent/utils.py ++++ b/sysmig_agent/utils.py +@@ -11,12 +11,12 @@ def list_to_json(keylist, valuelist): + + # 检测进度 + def messageProgress(message): +- with open('/var/tmp/uos-migration/.progress','w') as fp: ++ with open('/var/tmp/migration-tools/.progress','w') as fp: + fp.write(message) + fp.close() + + + def messageState(message): +- with open('/var/tmp/uos-migration/.state','w') as fp: ++ with open('/var/tmp/migration-tools/.state','w') as fp: + fp.write(message) + fp.close() +diff --git a/templates/MT_check_environment.html b/templates/MT_check_environment.html +index 3ca8b01..2724e06 100644 +--- a/templates/MT_check_environment.html ++++ b/templates/MT_check_environment.html +@@ -19,11 +19,11 @@ + + + +
+
+@@ -34,10 +34,10 @@ + + + + +