Do not use blkid to create partition symlinks

This removes the use of blkid to find disk partitions and their
associated partition UUIDs. Instead /proc/partitions is parsed
to enumerate disk partitions and sgdisk is used to extract their
partition UUIDs. This prevents a race condition from causing a
deadlock between ceph-osd and krbd when deploying ceph-osd pods.

Change-Id: I875f8c0565ce6efb7cd2052725af37dec3bb3a59
This commit is contained in:
Taylor, Stephen (st053q) 2019-05-17 11:20:51 -06:00
parent b69584bd65
commit 47a4b611b3
1 changed files with 4 additions and 2 deletions

View File

@ -164,8 +164,10 @@ function udev_settle {
# On occassion udev may not make the correct device symlinks for Ceph, just in case we make them manually
mkdir -p /dev/disk/by-partuuid
for dev in $(timeout 60 blkid -o device | grep -Ev 'block|rbd'); do
ln -s "../../$(echo ${dev} | awk -F '/' '{print $3}')" "/dev/disk/by-partuuid/$(blkid -o value -s PARTUUID ${dev})" || true
for dev in $(awk '!/rbd/{print $4}' /proc/partitions | grep "[0-9]"); do
diskdev=$(echo "${dev//[!a-z]/}")
partnum=$(echo "${dev//[!0-9]/}")
ln -s "../../${dev}" "/dev/disk/by-partuuid/$(sgdisk -i ${partnum} /dev/${diskdev} | awk '/Partition unique GUID/{print tolower($4)}')" || true
done
}