Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not try to add connection to the list if there is no active qpair #709

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions control/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1985,32 +1985,42 @@ def list_connections_safe(self, request, context):
trtype = "TCP"
hostnqn = conn["hostnqn"]
connected = False
found = False

for qp in qpair_ret:
try:
if qp["cntlid"] != conn["cntlid"]:
continue
if qp["state"] != "active":
self.logger.debug(f"Qpair {qp} is not active")
continue
addr = qp["listen_address"]
if not addr:
continue
traddr = addr["traddr"]
if not traddr:
continue
trsvcid = int(addr["trsvcid"])
try:
trtype = addr["trtype"].upper()
except Exception:
pass
if not trtype:
trtype = "TCP"
try:
adrfam = addr["adrfam"].lower()
except Exception:
pass
if not adrfam:
adrfam = "ipv4"
found = True
break
except Exception:
self.logger.exception(f"Got exception while parsing qpair: {qp}")
pass
if not found:
self.logger.debug(f"Can't find active qpair for connection {conn}")
continue
if not trtype:
trtype = "TCP"
if not adrfam:
adrfam = "ipv4"
one_conn = pb2.connection(nqn=hostnqn, connected=True,
traddr=traddr, trsvcid=trsvcid, trtype=trtype, adrfam=adrfam,
qpairs_count=conn["num_io_qpairs"], controller_id=conn["cntlid"])
Expand Down
Loading