Skip to content

qa/nvme_loop: avoid nvme-cli host identity issues when connecting loop devices - #71971

Merged
rkachach merged 1 commit into
ceph:mainfrom
rkachach:fix_nvme_connect_issue
Sep 24, 2026
Merged

rkachach merged 1 commit into
ceph:mainfrom
rkachach:fix_nvme_connect_issue

Conversation

@rkachach

@rkachach rkachach commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes: https://tracker.ceph.com/issues/71816

Description

qa/tasks/nvme_loop.py currently uses nvme connect to attach the NVMe
loop targets. This has become unreliable across different nvme-cli
versions because of how the tool handles the host identity.

Historically, the test passed -q hostnqn, where hostnqn was effectively
a placeholder. A fallback without -q was later added for Ubuntu 24.04,
but that is still not sufficient with newer nvme-cli versions: even when
-q is omitted, nvme-cli may inject its own HostNQN/HostID pair.

Depending on the host configuration, that pair can be inconsistent and the
kernel rejects the connection with:

Failed to write to /dev/nvme-fabrics: Invalid argument

This makes the test dependent on nvme-cli userspace behavior and version
differences between distributions.

Instead of using nvme connect, this change connects the loop target
directly through the kernel NVMe fabrics interface by writing:

nqn=<subsystem>,transport=loop

to:

/dev/nvme-fabrics

By not passing an explicit HostNQN/HostID pair, we avoid nvme-cli host
identity injection and the associated compatibility issue.

Using /dev/nvme-fabrics directly is intentional here rather than a
shortcut around nvme connect. A comment is added next to the connection
code to document why nvme connect must not be used here, so a future
cleanup does not accidentally reintroduce the same problem.

This also removes the now-unnecessary synthetic hostnqn configfs entry
and the nvme connect fallback logic.

The rest of the NVMe loop setup, discovery, and teardown remains unchanged.

Testing

Tested as part of the orch:cephadm teuthology suite together with the
device-discovery fallback from #69837.

Verified successful NVMe loop setup and OSD lifecycle operations on:

In both cases, the loop devices were successfully connected, discovered,
used by the OSD tests, and disconnected during teardown.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@rkachach rkachach added the wip-rkachach-testing-2 rkachach testing label Sep 22, 2026
@github-actions github-actions Bot added the tests label Sep 22, 2026
@rkachach
rkachach requested a review from a team September 23, 2026 08:28
@rkachach
rkachach force-pushed the fix_nvme_connect_issue branch from f04754c to 9ffca99 Compare September 23, 2026 08:34
@rkachach rkachach changed the title WIP qa/nvme_loop: avoid nvme-cli host identity issues when connecting loop devices Sep 23, 2026
@rkachach
rkachach marked this pull request as ready for review September 23, 2026 08:36
@rkachach

rkachach commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

The changes on this PR were tested in combination with #69837 results showed all the test cases where nvme_loop is used ran successfully. NFS errors are not related:

https://pulpito.ceph.com/rkachach-2026-09-22_20:34:48-orch:cephadm-wip-rkachach-testing-2-2026-09-22-1751-distro-default-trial/

@guits

guits commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

Comment thread qa/tasks/nvme_loop.py Resolved
Use the kernel NVMe fabrics interface directly when connecting loop
devices instead of `nvme connect`.

Depending on the nvme-cli version and host configuration, `nvme connect`
may provide an inconsistent HostNQN/HostID pair and fail with EINVAL.

Writing only the subsystem NQN and loop transport to
`/dev/nvme-fabrics` lets the kernel use its default host identity and
avoids nvme-cli-specific host identity handling.

Fixes: https://tracker.ceph.com/issues/71816
Assisted-by: ChatGPT <chatgpt.com>
Signed-off-by: Redouane Kachach <[email protected]>
@rkachach
rkachach force-pushed the fix_nvme_connect_issue branch from 9ffca99 to 3f0bcd1 Compare September 24, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants