GetWwnByScsiInq: handle sg_inq v2.3x (sg3_utils 1.48+) output format change#862
Open
carterpewpew wants to merge 1 commit into
Open
GetWwnByScsiInq: handle sg_inq v2.3x (sg3_utils 1.48+) output format change#862carterpewpew wants to merge 1 commit into
carterpewpew wants to merge 1 commit into
Conversation
sg3_utils 1.48+ changed `sg_inq -p 0x83` to output raw hex bytes instead of the decoded Device Identification page. This breaks WWN extraction and prevents volumes from mounting (the driver discovers an empty device and fails NodeStageVolume). Fix by trying `sg_inq -i` first, which produces the decoded human-readable output with bracketed WWN on all sg_inq versions (the -i/--id flag has existed since at least sg3_utils 1.42). Fall back to `-p 0x83` if `-i` fails. Also add a raw `0x<hex>` regex as a secondary match on the WWN line for any future format variants. Extract output parsing into getWwnFromScsiInqOutput for testability. When execution and parse errors are mixed (e.g. -i output unparseable and -p 0x83 times out), surface the execution error instead of returning MultipathDeviceNotFoundForVolumeError, so operators see the actionable host-command failure rather than a misleading connectivity message. Fixes: IBM#850 Fixes: IBM#824 Signed-off-by: Jathavedhan M <jathavedhan.m@ibm.com>
48e8498 to
8c7629e
Compare
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.
Problem
sg3_utils 1.48+changedsg_inq -p 0x83to output raw hex bytes instead of the decoded Device Identification VPD page. This breaksGetWwnByScsiInqthe driver extracts an empty WWN,NodeStageVolumefails, and volumes never mount.Reproduced on:
The actual output on affected systems for
sg_inq -p 0x83 /dev/dm-X:The driver expected the decoded text output with
[0x<wwn>]brackets, which no longer appears.Fix
sg_inq -ifirst. The-i/--idflag produces the decoded Device Identification output (with bracketed WWN) on all sg_inq versions — it has existed since at least sg3_utils 1.42.sg_inq -p 0x83if-ifails to execute or its output is unparseable.0x<hex>regex (without brackets) on the WWN line as defense for any future format variants.-ioutput unparseable +-p 0x83times out) instead of returning a misleadingMultipathDeviceNotFoundForVolumeError.getWwnFromScsiInqOutput()for testability.Tests
sg_inq -isuccess (bracketed WWN) — NAA6 and EUI-64sg_inq -iraw hex output (no brackets) — NAA6 and EUI-64-ioutput unparseable → fallback to-p 0x83succeeds-iexecution failure →-p 0x83succeedsMultipathDeviceNotFoundForVolumeErrorBackwards compatibility
On older sg3_utils (< 1.48),
sg_inq -iproduces the same decoded output that-p 0x83used to. The driver will parse it via the existing bracket regex on the first attempt. The-p 0x83fallback is never reached in the happy path no behavior change for working environments.Fixes #850
Fixes #824