migration-tools/0022-udpate-agent-host-status-online.patch
2024-11-05 10:27:22 +08:00

43 lines
1.4 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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