Ceph OSD Init Improvements

Some minor improvements are made in this patchset:
1) Move osd_disk_prechecks to the very beginning to make sure the
   required variables are set before running the bulk of the script.
2) Specify variables in a more consistent manner for readability.
3) Remove variables from CLI commands that are not used/set.

Change-Id: I6167b277e111ed59ccf4415e7f7d178fe4338cbd
This commit is contained in:
Parsons, Cliff (cp769u) 2021-06-23 21:31:35 +00:00
parent 62f5cab770
commit b3ebb46ce2
4 changed files with 13 additions and 12 deletions

View File

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

View File

@ -36,7 +36,7 @@ function check_osd_metadata {
local tmpmnt=$(mktemp -d)
mount ${DM_DEV} ${tmpmnt}
if [ "x$JOURNAL_TYPE" != "xdirectory" ]; then
if [ "x${JOURNAL_TYPE}" != "xdirectory" ]; then
if [ -f "${tmpmnt}/whoami" ]; then
OSD_JOURNAL_DISK=$(readlink -f "${tmpmnt}/journal")
local osd_id=$(cat "${tmpmnt}/whoami")
@ -113,7 +113,7 @@ function determine_what_needs_zapping {
fi
if [ ${OSD_FORCE_REPAIR} -eq 1 ] && [ ! -z ${DM_DEV} ]; then
if [ -b $DM_DEV ]; then
if [ -b ${DM_DEV} ]; then
local ceph_fsid=$(ceph-conf --lookup fsid)
if [ ! -z "${ceph_fsid}" ]; then
# Check the OSD metadata and zap the disk if necessary
@ -165,7 +165,7 @@ function osd_journal_prepare {
else
OSD_JOURNAL=${OSD_JOURNAL}
fi
elif [ "x$JOURNAL_TYPE" != "xdirectory" ]; then
elif [ "x${JOURNAL_TYPE}" != "xdirectory" ]; then
# The block device exists but doesn't appear to be paritioned, we will proceed with parititioning the device.
OSD_JOURNAL=$(readlink -f ${OSD_JOURNAL})
until [ -b ${OSD_JOURNAL} ]; do
@ -173,7 +173,7 @@ function osd_journal_prepare {
done
fi
chown ceph. ${OSD_JOURNAL};
elif [ "x$JOURNAL_TYPE" != "xdirectory" ]; then
elif [ "x${JOURNAL_TYPE}" != "xdirectory" ]; then
echo "No journal device specified. OSD and journal will share ${OSD_DEVICE}"
echo "For better performance on HDD, consider moving your journal to a separate device"
fi

View File

@ -181,16 +181,16 @@ function osd_disk_prechecks {
fi
if [[ ! -b "${OSD_DEVICE}" ]]; then
echo "ERROR- The device pointed by OSD_DEVICE ($OSD_DEVICE) doesn't exist !"
echo "ERROR- The device pointed by OSD_DEVICE (${OSD_DEVICE}) doesn't exist !"
exit 1
fi
if [ ! -e $OSD_BOOTSTRAP_KEYRING ]; then
echo "ERROR- $OSD_BOOTSTRAP_KEYRING must exist. You can extract it from your current monitor by running 'ceph auth get client.bootstrap-osd -o $OSD_BOOTSTRAP_KEYRING'"
if [ ! -e ${OSD_BOOTSTRAP_KEYRING} ]; then
echo "ERROR- ${OSD_BOOTSTRAP_KEYRING} must exist. You can extract it from your current monitor by running 'ceph auth get client.bootstrap-osd -o ${OSD_BOOTSTRAP_KEYRING}'"
exit 1
fi
timeout 10 ceph ${CLI_OPTS} --name client.bootstrap-osd --keyring $OSD_BOOTSTRAP_KEYRING health || exit 1
timeout 10 ceph --name client.bootstrap-osd --keyring ${OSD_BOOTSTRAP_KEYRING} health || exit 1
}
function perform_zap {
@ -212,6 +212,9 @@ function perform_zap {
if [[ "${STORAGE_TYPE}" != "directory" ]]; then
# Check to make sure we have what we need to continue
osd_disk_prechecks
# Settle LVM changes before inspecting volumes
udev_settle
@ -242,9 +245,6 @@ if [[ "${STORAGE_TYPE}" != "directory" ]]; then
# Settle LVM changes again after any changes have been made
udev_settle
# Check to make sure we have what we need to continue
osd_disk_prechecks
# Initialize some important global variables
CEPH_LVM_PREPARE=1
OSD_ID=$(get_osd_id_from_device ${OSD_DEVICE})

View File

@ -24,4 +24,5 @@ ceph-osd:
- 0.1.21 Refactor Ceph OSD Init Scripts - First PS
- 0.1.22 Refactor Ceph OSD Init Scripts - Second PS
- 0.1.23 Use full image ref for docker official images
- 0.1.24 Ceph OSD Init Improvements
...