Merge "[Ceph-osd] Avoid using lsblk/blkid."
This commit is contained in:
commit
0d5aeaacbb
@ -213,8 +213,8 @@ function zap_extra_partitions {
|
|||||||
function disk_zap {
|
function disk_zap {
|
||||||
# Run all the commands that ceph-disk zap uses to clear a disk
|
# Run all the commands that ceph-disk zap uses to clear a disk
|
||||||
local device=${1}
|
local device=${1}
|
||||||
local device_filter=$(echo $device | cut -d'/' -f3)
|
local device_filter=$(basename "${device}")
|
||||||
local dm_devices=$(lsblk -o name,type -l | grep "lvm" | grep "$device_filter" | awk '/ceph/{print $1}' | tr '\n' ' ')
|
local dm_devices=$(get_lvm_path_from_device "pv_name=~${device_filter},lv_name=~ceph")
|
||||||
for dm_device in ${dm_devices}; do
|
for dm_device in ${dm_devices}; do
|
||||||
if [[ ! -z ${dm_device} ]]; then
|
if [[ ! -z ${dm_device} ]]; then
|
||||||
dmsetup remove ${dm_device}
|
dmsetup remove ${dm_device}
|
||||||
@ -384,6 +384,13 @@ function get_osd_wal_device_from_device {
|
|||||||
get_lvm_tag_from_device ${device} ceph.wal_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 {
|
function set_device_class {
|
||||||
if [ ! -z "$DEVICE_CLASS" ]; then
|
if [ ! -z "$DEVICE_CLASS" ]; then
|
||||||
if [ "x$DEVICE_CLASS" != "x$(get_device_class)" ]; then
|
if [ "x$DEVICE_CLASS" != "x$(get_device_class)" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user