[Ceph-osd] Avoid using lsblk/blkid.

The PS improves performance by replacing lsblk/blkid (In some cases blkid may be pretty slow).
Also it allows to avoid deadlocks when there are RBDs mapped on the host.

Change-Id: If607e168515f55478e9e55e421738d2d00269d3f
This commit is contained in:
Kabanov, Dmitrii 2020-05-26 15:03:59 -07:00 committed by Dmitrii Kabanov
parent c61fc590fb
commit 4841f53ca6

View File

@ -213,8 +213,8 @@ function zap_extra_partitions {
function disk_zap {
# Run all the commands that ceph-disk zap uses to clear a disk
local device=${1}
local device_filter=$(echo $device | cut -d'/' -f3)
local dm_devices=$(lsblk -o name,type -l | grep "lvm" | grep "$device_filter" | awk '/ceph/{print $1}' | tr '\n' ' ')
local device_filter=$(basename "${device}")
local dm_devices=$(get_lvm_path_from_device "pv_name=~${device_filter},lv_name=~ceph")
for dm_device in ${dm_devices}; do
if [[ ! -z ${dm_device} ]]; then
dmsetup remove ${dm_device}
@ -384,6 +384,13 @@ function get_osd_wal_device_from_device {
get_lvm_tag_from_device ${device} ceph.wal_device
}
function get_lvm_path_from_device {
select="$1"
options="--noheadings -o lv_dm_path"
pvs ${options} -S "${select}" | tr -d ' '
}
function set_device_class {
if [ ! -z "$DEVICE_CLASS" ]; then
if [ "x$DEVICE_CLASS" != "x$(get_device_class)" ]; then