fix xalarm log not print and add on iter problem

(cherry picked from commit ad580fd653e1ecbc110f9927d20578f2116059da)
This commit is contained in:
PshySimon 2025-02-18 20:23:00 +08:00 committed by openeuler-sync-bot
parent 15c5030b68
commit 5ef6a41567
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 732393fb7990fbb086976c8d7e33bb13e9aadedb Mon Sep 17 00:00:00 2001
From: PshySimon <caixiaomeng2@huawei.com>
Date: Tue, 18 Feb 2025 20:13:07 +0800
Subject: [PATCH] fix xalarm log not print and add on iter problem
---
src/services/xalarm/xalarm_transfer.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/services/xalarm/xalarm_transfer.py b/src/services/xalarm/xalarm_transfer.py
index 2ed5da4..ccf16f9 100644
--- a/src/services/xalarm/xalarm_transfer.py
+++ b/src/services/xalarm/xalarm_transfer.py
@@ -98,8 +98,9 @@ def wait_for_connection(server_sock, epoll, fd_to_socket, thread_should_stop):
logging.info(f"connection reach max num of {MAX_CONNECTION_NUM}, closed current connection!")
connection.close()
continue
- fd_to_socket[connection.fileno()] = connection
- logging.info("connection %d registered event.")
+ with LOCK:
+ fd_to_socket[connection.fileno()] = connection
+ logging.info("connection fd %d registered event.", connection.fileno())
except socket.error as e:
logging.debug(f"socket error, reason is {e}")
break
@@ -122,7 +123,8 @@ def transmit_alarm(server_sock, epoll, fd_to_socket, bin_data, alarm_str):
if connection is not server_sock:
try:
connection.sendall(bin_data)
- logging.info("Broadcast msg success, alarm msg is %s", alarm_str)
+ logging.info("Broadcast msg success, fd is %d, alarm msg is %s",
+ fileno, alarm_str)
except (BrokenPipeError, ConnectionResetError):
to_remove.append(fileno)
except Exception as e:
--
2.27.0

View File

@ -4,7 +4,7 @@
Summary: System Inspection Framework Summary: System Inspection Framework
Name: sysSentry Name: sysSentry
Version: 1.0.3 Version: 1.0.3
Release: 4 Release: 5
License: Mulan PSL v2 License: Mulan PSL v2
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
@ -12,6 +12,7 @@ Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{n
Patch1: add-bidirectional-communication-for-xalarm.patch Patch1: add-bidirectional-communication-for-xalarm.patch
Patch2: fix-some-test-cases.patch Patch2: fix-some-test-cases.patch
Patch3: add-log-for-xalarmd-and-fix-delete-on-iter-problem.patch Patch3: add-log-for-xalarmd-and-fix-delete-on-iter-problem.patch
Patch4: fix-xalarm-log-not-print-and-add-on-iter-problem.patch
BuildRequires: cmake gcc-c++ BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools BuildRequires: python3 python3-setuptools
@ -208,6 +209,12 @@ rm -rf /var/run/sysSentry | :
%attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py %attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
%changelog %changelog
* Tue Feb 18 2025 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.3-5
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: fix xalarm log not print and add on iter problem
* Tue Feb 18 2025 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.3-4 * Tue Feb 18 2025 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.3-4
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA