diff --git a/0079-get-agent-storage-information.patch b/0079-get-agent-storage-information.patch new file mode 100644 index 0000000..27ab59b --- /dev/null +++ b/0079-get-agent-storage-information.patch @@ -0,0 +1,62 @@ +From 353746455579de2e782f180b70d66a666c3572e0 Mon Sep 17 00:00:00 2001 +From: lixin +Date: Mon, 13 Nov 2023 14:31:05 +0800 +Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96agent=E5=AD=98=E5=82=A8?= + =?UTF-8?q?=E7=A9=BA=E9=97=B4?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + index.py | 1 + + views/server.py | 23 ++++++++++++++++++++++- + 2 files changed, 23 insertions(+), 1 deletion(-) + +diff --git a/index.py b/index.py +index 6b3b3d7..2f5c946 100644 +--- a/index.py ++++ b/index.py +@@ -35,6 +35,7 @@ mods = { + 'check_environment':migration.check_environment, + 'get_environment_data': server.get_environment_data, + 'get_repo_arch_info': server.get_repo_arch_info, ++ 'get_storage_num': server.get_storage_num, + } + + +diff --git a/views/server.py b/views/server.py +index 0a8eeed..369a750 100644 +--- a/views/server.py ++++ b/views/server.py +@@ -322,4 +322,25 @@ def get_repo_arch_info(data): + res = {} + res['info'] = info_list + json_res = json.dumps(res) +- return json_res +\ No newline at end of file ++ return json_res ++ ++ ++def get_storage_num(data): ++ """ ++ 获取可用空间足够和不足数量 ++ :param data: ++ :return: ++ """ ++ success_num_sql = "select agent_ip from agent_info where agent_online_status='0' and agent_storage>='10' " \ ++ "and agent_migration_os is null;" ++ get_success_num = DBHelper().execute(success_num_sql).fetchall() ++ ++ faild_num_sql = "select agent_ip from agent_info where agent_online_status='0' and agent_storage<'10' " \ ++ "and agent_migration_os is null;" ++ get_faild_num = DBHelper().execute(faild_num_sql).fetchall() ++ ++ success = len(get_success_num) ++ faild = len(get_faild_num) ++ data = {'success': success, 'faild': faild} ++ json_data = json.dumps(data) ++ return json_data +\ No newline at end of file +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index 2aa3df7..3657ba5 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 78 +Release: 79 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 @@ -85,7 +85,7 @@ Patch75: 0075-detection-basic-information-and-format-abi-compatibility-inform Patch76: 0076-detection-storage-interface.patch Patch77: 0077-copy-from-unzip-rpm-diractory-and-system-file-to-compatility-diractory.patch Patch78: 0078-fill-in-the-data-in-the-checked-templace.patch - +Patch79: 0079-get-agent-storage-information.patch BuildArch: noarch @@ -185,6 +185,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* 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