!91 obtain kernel data
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
ebf2ab53c6
56
0038-obtain-kernel-data.patch
Normal file
56
0038-obtain-kernel-data.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From 05c4f0df087afa8b95ba5f365a55cee52cdd8d56 Mon Sep 17 00:00:00 2001
|
||||
From: lixin <lixinb@uniontech.com>
|
||||
Date: Fri, 10 Nov 2023 14:08:34 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=86=85=E6=A0=B8=E6=95=B0?=
|
||||
=?UTF-8?q?=E6=8D=AE=E6=96=B9=E6=B3=95?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
views/server.py | 29 +++++++++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
diff --git a/views/server.py b/views/server.py
|
||||
index e7570b8..71cbb8e 100644
|
||||
--- a/views/server.py
|
||||
+++ b/views/server.py
|
||||
@@ -181,5 +181,34 @@ def delete_host_info(data):
|
||||
DBHelper().execute(sql)
|
||||
|
||||
res = {'data': 'success'}
|
||||
+ json_res = json.dumps(res)
|
||||
+ return json_res
|
||||
+
|
||||
+
|
||||
+def get_kernel_data(data):
|
||||
+ """
|
||||
+ 获取系统内核和仓库内核版本
|
||||
+ :return:
|
||||
+ """
|
||||
+ get_kernel_version_sql = 'select agent_ip,agent_kernel,agent_repo_kernel from agent_info where ' \
|
||||
+ 'agent_online_status=0 and repo_status=0 and agent_storage>=10 and ' \
|
||||
+ 'agent_migration_os is null;'
|
||||
+ data = DBHelper().execute(get_kernel_version_sql).fetchall()
|
||||
+ res = {}
|
||||
+ info_list = []
|
||||
+ info_dict_keys_list = ['agent_ip', 'agent_kernel', 'agent_repo_kernel']
|
||||
+ if len(data) != 0:
|
||||
+ for i in data:
|
||||
+ if i[1] and i[2]:
|
||||
+ kernel_arr = ('不迁移内核' + ',' + i[2]).split(',')
|
||||
+ kernel_list = list(i)
|
||||
+ kernel_list[2] = kernel_arr
|
||||
+ else:
|
||||
+ kernel_list = [list(i)[0], '', '']
|
||||
+ info_list.append(dict(zip(info_dict_keys_list, kernel_list)))
|
||||
+
|
||||
+ res['info'] = info_list
|
||||
+ res['num'] = len(info_list)
|
||||
+
|
||||
json_res = json.dumps(res)
|
||||
return json_res
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 37
|
||||
Release: 38
|
||||
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
|
||||
@ -44,6 +44,7 @@ Patch34: 0034-add-centos7-and-centos8-migration-interface.patch
|
||||
Patch35: 0035-the-migration-process-can-choose-not-to-migrate-the-kernel.patch
|
||||
Patch36: 0036-add-an-interface-to-obtain-kernel-information.patch
|
||||
Patch37: 0037-add-subprocess-function-and-loggin.patch
|
||||
Patch38: 0038-obtain-kernel-data.patch
|
||||
|
||||
|
||||
BuildArch: noarch
|
||||
@ -143,6 +144,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-38
|
||||
- 0038-obtain-kernel-data.patch
|
||||
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-37
|
||||
- 0037-add-subprocess-function-and-loggin.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user