From f5ec7ee0672a1526170334151ae9501d62bae7cf Mon Sep 17 00:00:00 2001 From: Gil Bregman Date: Mon, 14 Oct 2024 17:08:07 +0300 Subject: [PATCH] Add a separate log level field for SPDK, don't display error for string context params. Fixes #873 Fixes #901 Signed-off-by: Gil Bregman --- ceph-nvmeof.conf | 3 ++- control/grpc.py | 3 +++ control/server.py | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ceph-nvmeof.conf b/ceph-nvmeof.conf index 481afa8e..05f385ff 100644 --- a/ceph-nvmeof.conf +++ b/ceph-nvmeof.conf @@ -66,7 +66,8 @@ tgt_path = /usr/local/bin/nvmf_tgt #rpc_socket_name = spdk.sock #tgt_cmd_extra_args = --env-context="--no-huge -m1024" --iova-mode=va timeout = 60.0 -#log_level = WARNING +#log_level = +#protocol_log_level = WARNING # Example value: -m 0x3 -L all # tgt_cmd_extra_args = diff --git a/control/grpc.py b/control/grpc.py index ff0994d8..59b17c35 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -822,6 +822,9 @@ def get_peer_message(self, context) -> str: if not context: return "" + if not hasattr(context, 'peer'): + return "" + try: peer = context.peer().split(":", 1) addr_fam = peer[0].lower() diff --git a/control/server.py b/control/server.py index 3c15df29..4a2f92a0 100644 --- a/control/server.py +++ b/control/server.py @@ -414,7 +414,9 @@ def _start_spdk(self, omap_state): # Initialization timeout = self.config.getfloat_with_default("spdk", "timeout", 60.0) - protocol_log_level = self.config.get_with_default("spdk", "log_level", "WARNING") + protocol_log_level = self.config.get_with_default("spdk", "protocol_log_level", None) + if not protocol_log_level or not protocol_log_level.strip(): + protocol_log_level = self.config.get_with_default("spdk", "log_level", "WARNING") if not protocol_log_level or not protocol_log_level.strip(): protocol_log_level = "WARNING" else: