From ac2706f4236e01d7e1df2f168438b34a47e7d1f5 Mon Sep 17 00:00:00 2001 From: Martin Belanger Date: Thu, 4 Sep 2025 06:10:35 -0400 Subject: [PATCH] python: Don't exit immediately on discovery fail. In the example, when ctrl.discover() fails, we should not invoke sys.exit() immediately, but instead allow the ctrl.disconnect() to be invoked. Signed-off-by: Martin Belanger --- examples/discover-loop.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/discover-loop.py b/examples/discover-loop.py index 3657a7fa1..944d8dd4a 100644 --- a/examples/discover-loop.py +++ b/examples/discover-loop.py @@ -46,9 +46,8 @@ def disc_supp_str(dlp_supp_opts): lsp = nvme.NVMF_LOG_DISC_LSP_PLEO if dlp_supp_opts & nvme.NVMF_LOG_DISC_LID_PLEOS else 0 disc_log = ctrl.discover(lsp=lsp) except Exception as e: - sys.exit(f'Failed to discover: {e}') + print(f'Failed to discover: {e}') disc_log = [] - pass for dlpe in disc_log: print(f'log entry {dlpe["portid"]}: {dlpe["subtype"]} {dlpe["subnqn"]}')