diff --git a/0050-check-free-space-in-system-disk.patch b/0050-check-free-space-in-system-disk.patch new file mode 100644 index 0000000..8ced3b9 --- /dev/null +++ b/0050-check-free-space-in-system-disk.patch @@ -0,0 +1,52 @@ +From 50941c1ad6ad3be2d8b1826a690df73227e15831 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Fri, 10 Nov 2023 15:09:48 +0800 +Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=B3=BB=E7=BB=9F=E7=9A=84?= + =?UTF-8?q?=E7=A3=81=E7=9B=98=E5=8F=AF=E7=94=A8=E7=A9=BA=E9=97=B4?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/share.py | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/sysmig_agent/share.py b/sysmig_agent/share.py +index 9e7bd35..0bd73f6 100644 +--- a/sysmig_agent/share.py ++++ b/sysmig_agent/share.py +@@ -484,3 +484,31 @@ def run_subprocess(cmd="", print_cmd=True, print_output=True): + return_code = process.poll() + return output, return_code + ++ ++ ++def os_storage(): ++ """ ++ 判断系统剩余空间大小 ++ :return: GB ++ """ ++ path = '/var/cache' ++ stat = os.statvfs(path) ++ CACHE_SPACE = 10.0 ++ state = 1 ++ ava_cache = format(stat.f_bavail * stat.f_frsize / 1024 // 1024 / 1024, '.1f') ++ if stat: ++ # with open(PRE_MIG,'a+') as pf: ++ # pf.write('/var/cache可用空间为'+ava_cache+'GB') ++ # pf.close() ++ if float(ava_cache) >= CACHE_SPACE: ++ state = 0 ++ return ava_cache ++ # data = '可用空间为'+ava_cache+'GB' ++ else: ++ return ava_cache ++ # data = '可用空间为' + ava_cache + 'GB,请清理/var/cache的空间后重试。' ++ else: ++ return ava_cache ++ # data = '可用空间为'+ava_cache+'GB,请清理/var/cache的空间后重试。' ++ # return list_to_json(keylist,valuelist) ++ +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index fa23cc4..2ad56b1 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 49 +Release: 50 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 @@ -56,6 +56,9 @@ Patch46: 0046-agent-sends-task-update-requrst-to-the-server.patch Patch47: 0047-check-kernel-version-in-repository.patch Patch48: 0048-server-send-kernel-detection-task.patch Patch49: 0049-add-interface-to-check-repository-result.patch +Patch50: 0050-check-free-space-in-system-disk.patch + + BuildArch: noarch BuildRequires: systemd @@ -154,6 +157,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Tue Nov 5 2024 xuezhixin - 1.0.2-50 +- 0050-check-free-space-in-system-disk.patch + * Tue Nov 5 2024 xuezhixin - 1.0.2-49 - 0049-add-interface-to-check-repository-result.patch