Skip to content

Commit

Permalink
set_ana_state: add debug logs
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Indenbaum <[email protected]>
  • Loading branch information
Alexander Indenbaum committed Dec 5, 2023
1 parent 6723476 commit 7602990
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion control/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,21 +477,27 @@ def set_ana_state_safe(self, ana_info: pb2.ana_info, context=None):
for nas in ana_info.states:
nqn = nas.nqn
prefix = f"{self.gateway_state.local.LISTENER_PREFIX}_{nqn}_{self.gateway_name}_"
for listener_key in [key for key in state.keys() if key.startswith(prefix)]:
listener_keys = [key for key in state.keys() if key.startswith(prefix)]
self.logger.info(f"Iterate over {nqn=} {prefix=} {listener_keys=}")

for listener_key in listener_keys:
listener = json.loads(state[listener_key])
self.logger.info(f"{listener_key=} {listener=}")

# Iterate over ana_group_state in nqn_ana_states
for gs in nas.states:
# Access grp_id and state
grp_id = gs.grp_id
ana_state = "optimized" if gs.state == pb2.ana_state.OPTIMIZED else "inaccessible"
try:
self.logger.info(f"SPDK nvmf_subsystem_listener_set_ana_state {nqn=} {listener=} {ana_state=} {grp_id=}")
ret = rpc_nvmf.nvmf_subsystem_listener_set_ana_state(
self.spdk_rpc_client,
nqn=nqn,
listen_address=listener,
ana_state=ana_state,
anagrpid=grp_id)
self.logger.info(f"SPDK nvmf_subsystem_listener_set_ana_state response {ret=}")
if not ret:
raise Exception(f"nvmf_subsystem_listener_set_ana_state({nqn=}, {listener=}, {ana_state=}, {grp_id=}) error")
except Exception as ex:
Expand Down

0 comments on commit 7602990

Please sign in to comment.