[ceph-osd] Fix a bug with DB orphan volume removal

The volume naming convention prefixes logical volume names with
ceph-lv-, ceph-db-, or ceph-wal-. The code that was added recently
to remove orphaned DB and WAL volumes does a string replacement of
"db" or "wal" with "lv" when searching for corresponding data
volumes. This causes DB volumes to get identified incorrectly as
orphans and removed when "db" appears in the PV UUID portion of
the volume name.

Change-Id: I0c9477483b70c9ec844b37a6de10a50c0f2e1df8
This commit is contained in:
Stephen Taylor 2021-01-19 10:10:38 -07:00
parent f60c94fc16
commit b2c0028349
2 changed files with 2 additions and 2 deletions

View File

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

View File

@ -207,7 +207,7 @@ function prep_device {
fi fi
logical_volumes="$(lvs --noheadings -o lv_name ${VG} | xargs)" logical_volumes="$(lvs --noheadings -o lv_name ${VG} | xargs)"
for volume in ${logical_volumes}; do for volume in ${logical_volumes}; do
data_volume=$(echo ${volume} | sed -E -e 's/db|wal/lv/g') data_volume=$(echo ${volume} | sed -E -e 's/-db-|-wal-/-lv-/g')
if [[ -z $(lvs --noheadings -o lv_name -S "lv_name=${data_volume}") ]]; then if [[ -z $(lvs --noheadings -o lv_name -S "lv_name=${data_volume}") ]]; then
# DB or WAL volume without a corresponding data volume, remove it # DB or WAL volume without a corresponding data volume, remove it
lvremove -y /dev/${VG}/${volume} lvremove -y /dev/${VG}/${volume}