Skip to content

Commit

Permalink
Handle empty log_level values as if there was no value set.
Browse files Browse the repository at this point in the history
Signed-off-by: Gil Bregman <[email protected]>
  • Loading branch information
gbregman committed Sep 1, 2024
1 parent 3a57abd commit 9663097
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 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,6 +374,10 @@ 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}")
Expand Down

0 comments on commit 9663097

Please sign in to comment.