[CEPH] Fixes for the OSD defrag cronjob

Fix a naming issue with the cronjob's binary, and schedule the cron
job to run every 15 minutes for the gates. Additonally check to
to ensure we are only running on block devices. Also update the
script to work with ceph-volume created devices.

Change-Id: I8aedab0ac41c191ef39a08034fff3278027d7520
This commit is contained in:
Matthew Heler 2019-01-28 13:41:19 -06:00
parent f0f1b57b3c
commit fc76091261
7 changed files with 65 additions and 11 deletions

View File

@ -31,14 +31,15 @@ if [ "x${ARG}" == "xcron" ]; then
done
fi
if [ "x${ARG}" == "xdefrag" ]; then
if [ "x${ARG}" == "xdefrag" ] && [ "x${STORAGE_TYPE%-*}" == "xblock" ]; then
OSD_DEVICE=$(readlink -f ${STORAGE_LOCATION})
ODEV=$(echo ${OSD_DEVICE} | sed 's/[0-9]//g' | cut -f 3 -d '/')
OSD_PATH=$(cat /proc/mounts | awk '/ceph-/{print $2}')
OSD_DEVICE=$(cat /proc/mounts | awk '/ceph-/{print $1}')
OSD_STORE=$(cat ${OSD_PATH}/type)
DATA_PART=$(cat /proc/mounts | awk '/ceph-/{print $1}')
ODEV=$(echo "${OSD_DEVICE}" | sed 's/\(.*[^0-9]\)[0-9]*$/\1/' | awk -F'/' '{print $3}')
ODEV_ROTATIONAL=$(cat /sys/block/${ODEV}/queue/rotational)
ODEV_SCHEDULER=$(cat /sys/block/${ODEV}/queue/scheduler)
ODEV_SCHEDULER=$(cat /sys/block/${ODEV}/queue/scheduler | tr -d '[]')
# NOTE(supamatt): TODO implement bluestore defrag options once it's available upstream
if [ "${ODEV_ROTATIONAL}" -eq "1" ] && [ "x${OSD_STORE}" == "xfilestore" ]; then

View File

@ -84,12 +84,12 @@ spec:
fieldPath: metadata.namespace
- name: KUBECTL_PARAM
value: {{ tuple $envAll "ceph" "ceph-defragosd" | include "helm-toolkit.snippets.kubernetes_kubectl_params" | indent 10 }}
command: ["/tmp/utils-defragosds.sh"]
command: ["/tmp/utils-defragOSDs.sh"]
args: ["cron"]
volumeMounts:
- name: ceph-osd-bin
mountPath: /tmp/utils-defragosds.sh
subPath: utils-defragosds.sh
mountPath: /tmp/utils-defragOSDs.sh
subPath: utils-defragOSDs.sh
readOnly: true
restartPolicy: Never
hostNetwork: true

View File

@ -272,4 +272,4 @@ manifests:
daemonset_osd: true
job_image_repo_sync: true
helm_tests: true
cronjob_defragosds: true
cronjob_defragosds: false

View File

@ -74,9 +74,22 @@ conf:
journal:
type: directory
location: /var/lib/openstack-helm/ceph/osd/journal-one
jobs:
ceph_defragosds:
# Execute every 15 minutes for gates
cron: "*/15 * * * *"
history:
# Number of successful job to keep
successJob: 1
# Number of failed job to keep
failJob: 1
concurrency:
# Skip new job if previous job still active
execPolicy: Forbid
startingDeadlineSecs: 60
manifests:
cronjob_checkPGs: true
cronjob_defragosds: true
EOF
for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do

View File

@ -166,15 +166,27 @@ conf:
journal:
type: directory
location: /var/lib/openstack-helm/ceph/osd/journal-one
pod:
replicas:
mds: 1
mgr: 1
rgw: 1
jobs:
ceph_defragosds:
# Execute every 15 minutes for gates
cron: "*/15 * * * *"
history:
# Number of successful job to keep
successJob: 1
# Number of failed job to keep
failJob: 1
concurrency:
# Skip new job if previous job still active
execPolicy: Forbid
startingDeadlineSecs: 60
manifests:
cronjob_checkPGs: true
cronjob_defragosds: true
EOF
for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do

View File

@ -57,8 +57,22 @@ deployment:
cephfs_provisioner: true
client_secrets: false
rgw_keystone_user_and_endpoints: false
jobs:
ceph_defragosds:
# Execute every 15 minutes for gates
cron: "*/15 * * * *"
history:
# Number of successful job to keep
successJob: 1
# Number of failed job to keep
failJob: 1
concurrency:
# Skip new job if previous job still active
execPolicy: Forbid
startingDeadlineSecs: 60
manifests:
deployment_mds: false
cronjob_defragosds: true
bootstrap:
enabled: true
conf:

View File

@ -88,8 +88,22 @@ storageclass:
admin_secret_namespace: tenant-ceph
bootstrap:
enabled: true
jobs:
ceph_defragosds:
# Execute every 15 minutes for gates
cron: "*/15 * * * *"
history:
# Number of successful job to keep
successJob: 1
# Number of failed job to keep
failJob: 1
concurrency:
# Skip new job if previous job still active
execPolicy: Forbid
startingDeadlineSecs: 60
manifests:
deployment_mds: false
cronjob_defragosds: true
ceph_mgr_modules_config:
prometheus:
server_port: 9284