Skip to content

fix: adapt to new libnvme Python API (Phase 2 + exception hierarchy)#488

Merged
martin-belanger merged 1 commit intolinux-nvme:mainfrom
martin-belanger:update-libnvme-python-api
Apr 30, 2026
Merged

fix: adapt to new libnvme Python API (Phase 2 + exception hierarchy)#488
martin-belanger merged 1 commit intolinux-nvme:mainfrom
martin-belanger:update-libnvme-python-api

Conversation

@martin-belanger
Copy link
Copy Markdown
Collaborator

@martin-belanger martin-belanger commented Apr 30, 2026

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_keyhost.dhchap_host_key
  • ctrl.connected()ctrl.connected (property, not method)
  • ctrl.supported_log_pagesctrl.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.

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
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 60.84%. Comparing base (d561432) to head (96168ee).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
staslib/ctrl.py 85.71% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martin-belanger martin-belanger merged commit e7b3831 into linux-nvme:main Apr 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant