[ceph-osd] Correct naming convention for logical volumes in disk_zap()

OSD logical volume names used to be based on the logical disk path,
i.e. /dev/sdb, but that has changed. The lvremove logic in disk_zap()
is still using the old naming convention. This change fixes that.

Change-Id: If32ab354670166a3c844991de1744de63a508303
This commit is contained in:
Stephen Taylor 2020-12-16 10:35:53 -07:00
parent 81f928544b
commit 213596d71c
2 changed files with 10 additions and 7 deletions

View File

@ -15,6 +15,6 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Ceph OSD
name: ceph-osd
version: 0.1.14
version: 0.1.15
home: https://github.com/ceph/ceph
...

View File

@ -305,18 +305,21 @@ function disk_zap {
# Run all the commands that ceph-disk zap uses to clear a disk
local device=${1}
local device_filter=$(basename "${device}")
local lv_name=$(get_lv_name_from_device "${device}" lv)
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} ]] && [[ ! -z $(dmsetup ls | grep ${dm_device}) ]]; then
dmsetup remove ${dm_device}
fi
done
local logical_volumes=$(lvdisplay | grep "LV Path" | grep "$device_filter" | awk '/ceph/{print $3}' | tr '\n' ' ')
for logical_volume in ${logical_volumes}; do
if [[ ! -z ${logical_volume} ]]; then
lvremove -y ${logical_volume}
fi
done
if [[ ! -z "${lv_name}" ]]; then
local logical_volumes=$(lvdisplay | grep "LV Path" | grep "${lv_name}" | awk '/ceph/{print $3}' | tr '\n' ' ')
for logical_volume in ${logical_volumes}; do
if [[ ! -z ${logical_volume} ]]; then
lvremove -y ${logical_volume}
fi
done
fi
local volume_group=$(pvdisplay -ddd -v ${device} | grep "VG Name" | awk '/ceph/{print $3}' | grep "ceph")
if [[ ${volume_group} ]]; then
vgremove -y ${volume_group}