[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 done
fi 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_PATH=$(cat /proc/mounts | awk '/ceph-/{print $2}')
OSD_DEVICE=$(cat /proc/mounts | awk '/ceph-/{print $1}')
OSD_STORE=$(cat ${OSD_PATH}/type) 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_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 # NOTE(supamatt): TODO implement bluestore defrag options once it's available upstream
if [ "${ODEV_ROTATIONAL}" -eq "1" ] && [ "x${OSD_STORE}" == "xfilestore" ]; then if [ "${ODEV_ROTATIONAL}" -eq "1" ] && [ "x${OSD_STORE}" == "xfilestore" ]; then

View File

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

View File

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

View File

@ -74,9 +74,22 @@ conf:
journal: journal:
type: directory type: directory
location: /var/lib/openstack-helm/ceph/osd/journal-one 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: manifests:
cronjob_checkPGs: true cronjob_checkPGs: true
cronjob_defragosds: true
EOF EOF
for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do

View File

@ -166,15 +166,27 @@ conf:
journal: journal:
type: directory type: directory
location: /var/lib/openstack-helm/ceph/osd/journal-one location: /var/lib/openstack-helm/ceph/osd/journal-one
pod: pod:
replicas: replicas:
mds: 1 mds: 1
mgr: 1 mgr: 1
rgw: 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: manifests:
cronjob_checkPGs: true cronjob_checkPGs: true
cronjob_defragosds: true
EOF EOF
for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do

View File

@ -57,8 +57,22 @@ deployment:
cephfs_provisioner: true cephfs_provisioner: true
client_secrets: false client_secrets: false
rgw_keystone_user_and_endpoints: 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: manifests:
deployment_mds: false deployment_mds: false
cronjob_defragosds: true
bootstrap: bootstrap:
enabled: true enabled: true
conf: conf:

View File

@ -88,8 +88,22 @@ storageclass:
admin_secret_namespace: tenant-ceph admin_secret_namespace: tenant-ceph
bootstrap: bootstrap:
enabled: true 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: manifests:
deployment_mds: false deployment_mds: false
cronjob_defragosds: true
ceph_mgr_modules_config: ceph_mgr_modules_config:
prometheus: prometheus:
server_port: 9284 server_port: 9284