From e89c0bb6ffde8ca53b3b7c6a5f059064018ff8a2 Mon Sep 17 00:00:00 2001 From: wuzhaomin Date: Fri, 12 Apr 2024 18:18:35 +0800 Subject: [PATCH] Optimize the get blktrace info function and add special case judgment --- category/get_disk_info.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/category/get_disk_info.py b/category/get_disk_info.py index fc56533..d9cc0b4 100644 --- a/category/get_disk_info.py +++ b/category/get_disk_info.py @@ -79,6 +79,12 @@ class DiskInfo: get blktrace information in output/blktrace ''' + if 1 != int(self.__bt_enable): + return True + + if not Command.cmd_exists('blktrace'): + return False + ret = True bt_devlst = self.__bt_devlst.split(',') i = 0 @@ -102,4 +108,8 @@ class DiskInfo: split = '=' if i==len(bt_devlst) else '-' ret &= Command.cmd_output(cmd_name, res, self.__default_file_name, split) + else: + Logger().error("blktrace功能异常: 配置文件中设置磁盘[{}]不存在,请修改后重试。".format(dev)) + ret &= False + return ret \ No newline at end of file -- Gitee