fix: adapt to new libnvme Python API (Phase 2 + exception hierarchy)#488
Merged
martin-belanger merged 1 commit intolinux-nvme:mainfrom Apr 30, 2026
Merged
Conversation
Update nvme-stas to match the libnvme Python binding changes from nvme-cli PR #3332 (redesign) and the subsequent exception hierarchy refactor: - nvme.global_ctx() → nvme.GlobalCtx() - nvme.host() → nvme.Host() - nvme.ctrl() → nvme.Ctrl() - host.dhchap_key → host.dhchap_host_key - ctrl.connected() → ctrl.connected (property, not method) - ctrl.supported_log_pages → ctrl.get_supported_log_pages (raises NvmeError on failure instead of returning None) The try/except (TypeError, IndexError) guard around the dlp_supp_opts extraction is removed: get_supported_log_pages() always returns a fixed-size list of integers or raises, so neither exception is structurally possible any more. Update the TestDc.Ctrl stub in test-controller.py to expose connected as a @Property instead of a method, matching the new API. Signed-off-by: Martin Belanger <[email protected]> Assisted-by: Claude:claude-sonnet-4-6 [Claude Code]
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #488 +/- ##
==========================================
+ Coverage 60.77% 60.84% +0.06%
==========================================
Files 16 16
Lines 2616 2613 -3
==========================================
Hits 1590 1590
+ Misses 1026 1023 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update nvme-stas to match the libnvme Python binding changes from nvme-cli PR #3332 (redesign) and the subsequent exception hierarchy refactor:
nvme.global_ctx()→nvme.GlobalCtx()nvme.host()→nvme.Host()nvme.ctrl()→nvme.Ctrl()host.dhchap_key→host.dhchap_host_keyctrl.connected()→ctrl.connected(property, not method)ctrl.supported_log_pages→ctrl.get_supported_log_pages(raises
NvmeErroron failure instead of returningNone)The
try/except (TypeError, IndexError)guard around thedlp_supp_opts extractionis removed:get_supported_log_pages()always returns a fixed-size list of integers or raises, so neither exception is structurally possible any more.Update the
TestDc.Ctrlstub intest-controller.pyto expose connected as a@propertyinstead of a method, matching the new API.