Compare commits
3 Commits
4a86cdd167
...
e6cc9a3853
| Author | SHA1 | Date | |
|---|---|---|---|
| e6cc9a3853 | |||
| 51cc739da5 | |||
| 2b9871d887 |
@@ -665,6 +665,7 @@ build_ceph_cache() {
|
||||
# Parse ceph-volume lvm list output
|
||||
# Format: blocks starting with "====== osd.X =======" followed by device info
|
||||
local current_osd=""
|
||||
local osd_count=0
|
||||
while IFS= read -r line; do
|
||||
# Match OSD header: "====== osd.5 ======="
|
||||
if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+======= ]]; then
|
||||
@@ -672,9 +673,12 @@ build_ceph_cache() {
|
||||
# Match block device line: " block device /dev/sda"
|
||||
elif [[ -n "$current_osd" && "$line" =~ block[[:space:]]device[[:space:]]+/dev/([^[:space:]]+) ]]; then
|
||||
local dev_name="${BASH_REMATCH[1]}"
|
||||
CEPH_DEVICE_TO_OSD[$dev_name]="$current_osd"
|
||||
CEPH_DEVICE_TO_OSD["$dev_name"]="$current_osd"
|
||||
((osd_count++))
|
||||
log_info "Found $current_osd on $dev_name"
|
||||
fi
|
||||
done < <(ceph-volume lvm list 2>/dev/null)
|
||||
log_info "Cached $osd_count Ceph OSDs"
|
||||
|
||||
# Skip if ceph command is not available
|
||||
if ! command -v ceph &>/dev/null; then
|
||||
@@ -751,16 +755,28 @@ parse_smart_data() {
|
||||
fi
|
||||
|
||||
# Device type detection - handles SSD, HDD, and NVMe
|
||||
# Priority: 1) NVMe by name, 2) Rotation Rate field, 3) Model name hints, 4) Default HDD
|
||||
if [[ "$device" == nvme* ]]; then
|
||||
type="NVMe"
|
||||
elif echo "$smart_info" | grep -q "Rotation Rate"; then
|
||||
if echo "$smart_info" | grep "Rotation Rate" | grep -qiE "solid state|0 rpm"; then
|
||||
elif echo "$smart_info" | grep -qE "Rotation Rate:"; then
|
||||
# Check the Rotation Rate field value (may have leading whitespace)
|
||||
local rotation_rate
|
||||
rotation_rate="$(echo "$smart_info" | grep -E "Rotation Rate:" | head -1)"
|
||||
if echo "$rotation_rate" | grep -qiE "solid state"; then
|
||||
type="SSD"
|
||||
elif echo "$rotation_rate" | grep -qE "[0-9]+ rpm"; then
|
||||
# Has actual RPM value (e.g., "7200 rpm") - it's an HDD
|
||||
type="HDD"
|
||||
else
|
||||
# Unknown rotation rate, default to HDD
|
||||
type="HDD"
|
||||
fi
|
||||
elif echo "$smart_info" | grep -qiE "SSD|Solid State"; then
|
||||
elif echo "$smart_info" | grep -qE "Device Model:.*SSD|Model Number:.*SSD"; then
|
||||
# Match SSD in the model name field
|
||||
type="SSD"
|
||||
else
|
||||
# Default to HDD for spinning rust
|
||||
type="HDD"
|
||||
fi
|
||||
|
||||
# Health status (basic SMART check)
|
||||
|
||||
Reference in New Issue
Block a user