[map-osd-to-disktype] fixing bug: grep matched on c0u1 and c0u10 at the same time, causing an extra entry to appear, and messing up the output

This commit is contained in:
root 2020-05-27 19:42:27 +02:00
parent 058a1d0baa
commit 4309c1639d

View file

@ -15,7 +15,7 @@ for osd in $(ceph osd tree | grep 'ssd\|hdd' | grep -v down | cut -b 1-3); do ls
for MOUNT in $(cat /tmp/list_osd_mountpoint.out | awk '{print $1}' | sed 's/[0-9]*//g') ; do cat /tmp/megaclisas-status.out | grep $MOUNT | awk '{print $1}' >> /tmp/megacli-mappings.out; done for MOUNT in $(cat /tmp/list_osd_mountpoint.out | awk '{print $1}' | sed 's/[0-9]*//g') ; do cat /tmp/megaclisas-status.out | grep $MOUNT | awk '{print $1}' >> /tmp/megacli-mappings.out; done
# Gets the hardware types for the Megacli mappings # Gets the hardware types for the Megacli mappings
for megacli_mappings in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep $megacli_mappings | cut -d '|' -f 2-6,8 >> /tmp/disk_types.out; done for megacli_mappings in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep -w "$megacli_mappings"p0 | cut -d '|' -f 2-6,8 >> /tmp/disk_types.out; done
# Formatting, to get the local $OSDTYPE osd-s # Formatting, to get the local $OSDTYPE osd-s
for osd_num in $(cat /tmp/list_osd_mountpoint.out | awk '{print $2}' | cut -c 24- ); do echo osd-$osd_num >> /tmp/local_osds.out; done for osd_num in $(cat /tmp/list_osd_mountpoint.out | awk '{print $2}' | cut -c 24- ); do echo osd-$osd_num >> /tmp/local_osds.out; done