Skip to content

Commit

Permalink
Merge pull request #845 from gbregman/devel
Browse files Browse the repository at this point in the history
Handle empty log_level values as if there was no value set
  • Loading branch information
gbregman authored Sep 2, 2024
2 parents 3a57abd + a646068 commit 9f7ecbd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions control/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ def serve(self):
# Set SPDK log level
log_level_args = {}
log_level = self.config.get_with_default("spdk", "log_level", None)
if log_level:
log_level = log_level.upper()
if log_level and log_level.strip():
log_level = log_level.strip().upper()
log_req = pb2.set_spdk_nvmf_logs_req(log_level=log_level, print_level=log_level)
self.gateway_rpc.set_spdk_nvmf_logs(log_req)

Expand Down Expand Up @@ -374,12 +374,16 @@ 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")
if not protocol_log_level or not protocol_log_level.strip():
protocol_log_level = "WARNING"
else:
protocol_log_level = protocol_log_level.strip().upper()
# connect timeout: spdk client retries 5 times per sec
conn_retries = int(timeout * 5)
self.logger.info(f"SPDK process id: {self.spdk_process.pid}")
self.logger.info(
f"Attempting to initialize SPDK: rpc_socket: {self.spdk_rpc_socket_path},"
f" conn_retries: {conn_retries}, timeout: {timeout}"
f" conn_retries: {conn_retries}, timeout: {timeout}, log level: {protocol_log_level}"
)
try:
self.spdk_rpc_client = rpc_client.JSONRPCClient(
Expand Down

0 comments on commit 9f7ecbd

Please sign in to comment.