!75 update the status of agent status online

From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
This commit is contained in:
openeuler-ci-bot 2024-11-05 05:21:26 +00:00 committed by Gitee
commit 8554e58951
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 3a4f5ea15df617babd1f7c39143d01b937bbb417 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Fri, 10 Nov 2023 10:35:43 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E5=9C=A8=E7=BA=BF=E7=8A=B6?=
=?UTF-8?q?=E6=80=81=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/share.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sysmig_agent/share.py b/sysmig_agent/share.py
index 0c989a8..abbe452 100644
--- a/sysmig_agent/share.py
+++ b/sysmig_agent/share.py
@@ -30,6 +30,21 @@ def sql_abi_progress(data):
pass
+def sql_online_statue(statue, task_id):
+ """
+ sqlagent主机的在线状态更新
+ :param statue: 0在线; 1离线
+ :param task_id:agent的json内的task_id
+ :return:
+ """
+ # sql = "UPDATE agent_info SET agent_online_status = {} WHERE agent_ip = {};".format(statue, get_local_ip())
+ sql = "UPDATE agent_info SET agent_online_status = {} WHERE agent_ip = (SELECT agent_ip FROM agent_task WHERE task_id = '{}');".format(
+ statue, task_id)
+ try:
+ ret = DBHelper().execute(sql)
+ except:
+ pass
+
def sql_show_tables():
sql = "SELECT task_progress,task_data FROM agent_task WHERE agent_ip = '{}';".format(get_local_ip())
ret_sql_msg_info = DBHelper().execute(sql)
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 21
Release: 22
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
@ -28,6 +28,9 @@ Patch18: 0018-detection-of-imported-host-information-interface.patch
Patch19: 0019-update-abi-result-to-database.patch
Patch20: 0020-get-task-process-and-migration-stage-information.patch
Patch21: 0021-get-agent-ip-interface.patch
Patch22: 0022-udpate-agent-host-status-online.patch
BuildArch: noarch
BuildRequires: systemd
%description
@ -125,6 +128,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-22
- 0022-udpate-agent-host-status-online.patch
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-21
- 0021-get-agent-ip-interface.patch