Fix OSD header regex to match double-digit OSD numbers
The ceph-volume lvm list output varies the number of trailing equals signs based on OSD number length: - Single digit: "====== osd.5 =======" (7 equals) - Double digit: "====== osd.19 ======" (6 equals) Changed regex to require exactly 6 trailing equals, which matches both formats. Fixes: #17 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -667,8 +667,9 @@ build_ceph_cache() {
|
|||||||
local current_osd=""
|
local current_osd=""
|
||||||
local osd_count=0
|
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 =======" or "====== osd.19 ======"
|
||||||
if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+======= ]]; then
|
# Number of trailing equals varies based on OSD number length
|
||||||
|
if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+====== ]]; then
|
||||||
current_osd="osd.${BASH_REMATCH[1]}"
|
current_osd="osd.${BASH_REMATCH[1]}"
|
||||||
# Match "devices" line which has the actual physical device: " devices /dev/sda"
|
# Match "devices" line which has the actual physical device: " devices /dev/sda"
|
||||||
# This is more reliable than "block device" which may show LVM paths
|
# This is more reliable than "block device" which may show LVM paths
|
||||||
|
|||||||
Reference in New Issue
Block a user