Add USB drive SMART support with multiple bridge chipset attempts

**Issue**: osd.2 is a USB-connected 1TB drive that couldn't read SMART

Error was: "Read Device Identity failed: scsi error unsupported field"
This is typical for USB-attached drives that need bridge-specific flags.

**Solution**: Added USB transport detection and multiple fallback methods:
- SAT (SCSI-ATA Translation) - most common USB bridges
- usbjmicron - JMicron USB bridge chipsets
- usbcypress - Cypress USB bridge chipsets
- Generic USB fallback
- SCSI passthrough

Also added USB/SAT attempt to unknown transport types as fallback.

**Debug Enhancement**:
- Now shows detected transport type in debug output
- Helps diagnose why SMART fails

**Note**: USB drives in Ceph clusters are unconventional but functional.
This OSD appears to be temporary/supplemental storage capacity.

If SMART still fails after this update, the USB bridge may be incompatible
with smartmontools, which is acceptable for temporary storage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-06 15:16:35 -05:00
parent 3d498a4092
commit 03374fa784

View File

@@ -162,6 +162,16 @@ def get_smart_data_remote(device_path, hostname):
f"smartctl -a -j {device_path} -d nvme", # Try without sudo
f"sudo smartctl -a -j {device_path}",
]
elif tran == "usb":
# USB-connected drives need special device type flags
commands_to_try = [
f"sudo smartctl -a -j {device_path} -d sat", # SAT (SCSI-ATA Translation)
f"sudo smartctl -a -j {device_path} -d usbjmicron", # JMicron USB bridge
f"sudo smartctl -a -j {device_path} -d usbcypress", # Cypress USB bridge
f"sudo smartctl -a -j {device_path} -d usb", # Generic USB
f"sudo smartctl -a -j {device_path} -d scsi", # SCSI passthrough
f"sudo smartctl -a -j {device_path}", # Auto-detect
]
elif tran == "sata":
commands_to_try = [
f"sudo smartctl -a -j {device_path}",
@@ -169,10 +179,11 @@ def get_smart_data_remote(device_path, hostname):
f"sudo smartctl -a -j {device_path} -d ata",
]
else:
# Unknown or no transport, try generic approaches
# Unknown or no transport, try generic approaches including USB
commands_to_try = [
f"sudo smartctl -a -j {device_path}",
f"smartctl -a -j {device_path}",
f"sudo smartctl -a -j {device_path} -d sat", # Try USB/SAT
f"sudo smartctl -a -j {device_path} -d auto",
]
@@ -186,6 +197,7 @@ def get_smart_data_remote(device_path, hostname):
if DEBUG:
print(f"{Colors.RED}DEBUG: All SMART methods failed for {device_path} on {hostname}{Colors.END}")
print(f"{Colors.YELLOW}DEBUG: Transport type detected: {tran if tran else 'unknown'}{Colors.END}")
return None