get migration status from database

This commit is contained in:
xuezhixin 2024-11-06 09:54:31 +08:00
parent 244eb3df08
commit 1354f67a2e
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From ec7c2d5065e3aeab507bcc4f10e667e7712df201 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Fri, 10 Nov 2023 14:21:06 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E5=BA=93?=
=?UTF-8?q?=E8=BF=81=E7=A7=BB=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/migration.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py
index ef78ed8..6dddb7b 100644
--- a/sysmig_agent/migration.py
+++ b/sysmig_agent/migration.py
@@ -201,3 +201,12 @@ def init_log_dir():
migInit_porgress()
+def get_mig_state(task_id):
+ sql = "SELECT task_data FROM agent_task WHERE task_id = {} ;".format(task_id)
+ ret_sql_msg_info = DBHelper().execute(sql)
+ try:
+ state = ret_sql_msg_info.fetchall()[0][0]
+ if len(state):
+ return str(state)
+ except:
+ return None
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 40
Release: 41
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
@ -47,6 +47,8 @@ Patch37: 0037-add-subprocess-function-and-loggin.patch
Patch38: 0038-obtain-kernel-data.patch
Patch39: 0039-repository-file-choose-kernel-version-to-migration.patch
Patch40: 0040-intial-logfile-and-tmpfile.patch
Patch41: 0041-get-migration-status-from-database.patch
BuildArch: noarch
BuildRequires: systemd
@ -145,6 +147,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-41
- 0041-get-migration-status-from-database.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-40
- 0040-intial-logfile-and-tmpfile.patch