Repository navigation
qa/tasks/nvme_loop: fall back to sysfs-based discovery if needed - #69837
Conversation
a3614a7 to
5460afa
Compare
There was a problem hiding this comment.
Pull request overview
Adds sysfs-based NVMe loop-device discovery when nvme list -o json repeatedly crashes.
Changes:
- Tracks consecutive JSON command crashes.
- Falls back to sysfs discovery after five failures.
- Adds a helper for enumerating NVMe namespace devices.
58b9e7f to
f0514aa
Compare
|
The changes on this PR were tested in combination with #71971 results showed all the test cases where nvme_loop is used ran successfully. NFS errors are not related: |
|
jenkins test make check |
nvme list -o json segfaults deterministically on kernel 6.8.0-* nodes (ubuntu_22.04/24.04), exhausting all 15 safe_while retries (ceph#69232 lets it retry, but every retry hits the same crash) and failing smoke-roleless nvme_loop jobs. This adds a fallback: after 5 consecutive CommandCrashedErrors, skip nvme list -o json and discover devices via sysfs instead. Each loop subsystem is connected using the device's basename as its NQN, which the kernel exposes at /sys/class/nvme/nvmeX/subsysnqn; we match that against /sys/class/nvme/nvmeX/nvmeXnY to recover the device path, with no nvme-cli JSON parsing involved. The existing JSON path is unchanged for nodes where it works normally — json_failures resets on any success, so the fallback only triggers on sustained crashes. https://tracker.ceph.com/issues/77106 Assisted-by: ChatGPT <chatgpt.com> Signed-off-by: Redouane Kachach <[email protected]>
`nvme_loop.py` falls back to sysfs-based device discovery when `nvme list -o json` repeatedly crashes. The existing fallback walks controller-specific paths such as: ```text /sys/class/nvme/nvmeX/nvmeXnY ``` This is not reliable with native NVMe multipath, where the user-visible namespace-head device may be exposed separately under `/sys/class/block` and use a different naming relationship from the controller path. As a result, the fallback can return no devices even though the newly connected NVMe loop devices are already visible through `lsblk`, eventually causing the task to fail with `MaxWhileTries`. This change: * records the existing NVMe namespace devices before creating the loop connections; * discovers visible namespace-head devices from `/sys/class/block`; * identifies the new loop devices using the before/after difference; * excludes partitions and controller-path devices. The normal `nvme list -o json` path remains unchanged. Only the fallback discovery path is modified. https://tracker.ceph.com/issues/77106 Assisted-by: ChatGPT <chatgpt.com> Signed-off-by: Redouane Kachach <[email protected]>
f0514aa to
1253059
Compare
guits
left a comment
There was a problem hiding this comment.
one 'nice to have' comment
I think extra logging can really help if the fallback fails...
otherwise the patch looks good to me
kginonredhat
left a comment
There was a problem hiding this comment.
The sysfs fallback is the right approach for the nvme list -o json crashes, but the NQN compare needs a strip before merge.
On a host with real NVMe devices, /sys/class/nvme-subsystem/*/subsysnqn is space-padded (Identify SUBNQN). Exact match then misses even when the glob already found nvme0n1 / nvme1n1.
expected_nqns must stay the scratch-device basenames used by nvme connect -n. Do not substitute vendor NQNs such as nqn.1994-11.com.samsung:…; those are the physical drives and would be passed to bluestore_zap().
e0263a9 to
d4d573b
Compare
Restrict sysfs fallback discovery to NVMe namespace heads whose subsystem NQN matches one of the scratch-device basenames. This preserves native multipath-compatible discovery while preventing unrelated NVMe namespaces that appear during setup from being selected and potentially passed to bluestore_zap(). https://tracker.ceph.com/issues/77106 Assisted-by: ChatGPT <chatgpt.com> Signed-off-by: Redouane Kachach <[email protected]>
d4d573b to
c96a0e1
Compare
kginonredhat
left a comment
There was a problem hiding this comment.
Thanks, the sysfs NQN strip looks good and expected_nqns stays the scratch-device basenames. LGTM.
Fixes: https://tracker.ceph.com/issues/77106
Summary
Add a sysfs-based fallback to
qa/tasks/nvme_loop.pyfor discovering NVMe loop namespace devices whennvme list -o jsonrepeatedly fails.The fallback is compatible with native NVMe multipath and restricts discovery to namespace heads belonging to the NVMe subsystems created by the task.
Problem
On some systems,
nvme list -o jsoncan fail even though the NVMe loop devices were successfully created.The original fallback walked controller-specific paths under
/sys/class/nvme, which is unreliable with native NVMe multipath because namespace-head and controller-path device names can differ.A later fallback based only on the set of newly appearing
/sys/class/block/nvme*n*devices fixed the multipath issue, but could also include unrelated NVMe namespaces that appeared during setup.Since discovered devices are later passed to
bluestore_zap(), the fallback needs to ensure that only namespaces belonging to the task are selected.Fix
The task now:
/sys/class/nvme-subsystem/nvme-subsys*subsysnqnThis keeps the discovery compatible with native NVMe multipath while excluding unrelated NVMe devices.
The normal
nvme list -o jsonpath remains unchanged and the sysfs logic is only used after repeatednvme listfailures.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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.