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
|
# Parse ceph-volume lvm list output
|
||||||
# Format: blocks starting with "====== osd.X =======" followed by device info
|
# Format: blocks starting with "====== osd.X =======" followed by device info
|
||||||
local current_osd=""
|
local current_osd=""
|
||||||
|
local osd_count=0
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
# Match OSD header: "====== osd.5 ======="
|
# Match OSD header: "====== osd.5 ======="
|
||||||
if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+======= ]]; then
|
if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+======= ]]; then
|
||||||
@@ -672,9 +673,12 @@ build_ceph_cache() {
|
|||||||
# Match block device line: " block device /dev/sda"
|
# Match block device line: " block device /dev/sda"
|
||||||
elif [[ -n "$current_osd" && "$line" =~ block[[:space:]]device[[:space:]]+/dev/([^[:space:]]+) ]]; then
|
elif [[ -n "$current_osd" && "$line" =~ block[[:space:]]device[[:space:]]+/dev/([^[:space:]]+) ]]; then
|
||||||
local dev_name="${BASH_REMATCH[1]}"
|
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
|
fi
|
||||||
done < <(ceph-volume lvm list 2>/dev/null)
|
done < <(ceph-volume lvm list 2>/dev/null)
|
||||||
|
log_info "Cached $osd_count Ceph OSDs"
|
||||||
|
|
||||||
# Skip if ceph command is not available
|
# Skip if ceph command is not available
|
||||||
if ! command -v ceph &>/dev/null; then
|
if ! command -v ceph &>/dev/null; then
|
||||||
@@ -751,16 +755,28 @@ parse_smart_data() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Device type detection - handles SSD, HDD, and NVMe
|
# 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
|
if [[ "$device" == nvme* ]]; then
|
||||||
type="NVMe"
|
type="NVMe"
|
||||||
elif echo "$smart_info" | grep -q "Rotation Rate"; then
|
elif echo "$smart_info" | grep -qE "Rotation Rate:"; then
|
||||||
if echo "$smart_info" | grep "Rotation Rate" | grep -qiE "solid state|0 rpm"; 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"
|
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
|
else
|
||||||
|
# Unknown rotation rate, default to HDD
|
||||||
type="HDD"
|
type="HDD"
|
||||||
fi
|
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"
|
type="SSD"
|
||||||
|
else
|
||||||
|
# Default to HDD for spinning rust
|
||||||
|
type="HDD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Health status (basic SMART check)
|
# Health status (basic SMART check)
|
||||||
|
|||||||
Reference in New Issue
Block a user