[ceph-client] enhance logic to enable the autoscaler for Octopus

Change-Id: I90d4d279a96cd298eba03e9c0b05a8f2a752e746
This commit is contained in:
bw6938 2021-01-15 20:32:41 +00:00
parent 567e4703e9
commit 910ed906d0
6 changed files with 10 additions and 23 deletions

View File

@ -15,6 +15,6 @@ apiVersion: v1
appVersion: v1.0.0 appVersion: v1.0.0
description: OpenStack-Helm Ceph Client description: OpenStack-Helm Ceph Client
name: ceph-client name: ceph-client
version: 0.1.7 version: 0.1.8
home: https://github.com/ceph/ceph-client home: https://github.com/ceph/ceph-client
... ...

View File

@ -181,13 +181,7 @@ function pool_validation() {
pg_placement_num=$(echo ${pool_obj} | jq -r .pg_placement_num) pg_placement_num=$(echo ${pool_obj} | jq -r .pg_placement_num)
crush_rule=$(echo ${pool_obj} | jq -r .crush_rule) crush_rule=$(echo ${pool_obj} | jq -r .crush_rule)
name=$(echo ${pool_obj} | jq -r .pool_name) name=$(echo ${pool_obj} | jq -r .pool_name)
pg_autoscale_mode=$(echo ${pool_obj} | jq -r .pg_autoscale_mode)
if [[ "${ENABLE_AUTOSCALER}" == "true" ]]; then
if [[ "${pg_autoscale_mode}" != "on" ]]; then
echo "pg autoscaler not enabled on ${name} pool"
exit 1
fi
fi
if [[ $(ceph mon versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then if [[ $(ceph mon versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then
if [ "x${size}" != "x${RBD}" ] || [ "x${min_size}" != "x${EXPECTED_POOLMINSIZE}" ] \ if [ "x${size}" != "x${RBD}" ] || [ "x${min_size}" != "x${EXPECTED_POOLMINSIZE}" ] \
|| [ "x${crush_rule}" != "x${expectedCrushRuleId}" ]; then || [ "x${crush_rule}" != "x${expectedCrushRuleId}" ]; then

View File

@ -146,13 +146,11 @@ function reweight_osds () {
done done
} }
function enable_or_disable_autoscaling () { function enable_autoscaling () {
if [[ "${ENABLE_AUTOSCALER}" == "true" ]]; then if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then
ceph mgr module enable pg_autoscaler ceph mgr module enable pg_autoscaler # only required for nautilus
ceph config set global osd_pool_default_pg_autoscale_mode on
else
ceph mgr module disable pg_autoscaler
fi fi
ceph config set global osd_pool_default_pg_autoscale_mode on
} }
function set_cluster_flags () { function set_cluster_flags () {
@ -184,10 +182,8 @@ function create_pool () {
ceph --cluster "${CLUSTER}" osd pool application enable "${POOL_NAME}" "${POOL_APPLICATION}" ceph --cluster "${CLUSTER}" osd pool application enable "${POOL_NAME}" "${POOL_APPLICATION}"
fi fi
if [[ $(ceph osd versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] && [[ "${ENABLE_AUTOSCALER}" == "true" ]] ; then if [[ $(ceph osd versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] ; then
ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" pg_autoscale_mode on ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" pg_autoscale_mode on
else
ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" pg_autoscale_mode off
fi fi
# #
# Make sure pool is not protected after creation AND expansion so we can manipulate its settings. # Make sure pool is not protected after creation AND expansion so we can manipulate its settings.
@ -269,8 +265,8 @@ else
cluster_capacity=$(ceph --cluster "${CLUSTER}" df | head -n3 | tail -n1 | awk '{print $1 substr($2, 1, 1)}' | numfmt --from=iec) cluster_capacity=$(ceph --cluster "${CLUSTER}" df | head -n3 | tail -n1 | awk '{print $1 substr($2, 1, 1)}' | numfmt --from=iec)
fi fi
if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then
enable_or_disable_autoscaling enable_autoscaling
fi fi
{{- range $pool := .Values.conf.pool.spec -}} {{- range $pool := .Values.conf.pool.spec -}}

View File

@ -50,8 +50,6 @@ spec:
env: env:
- name: CLUSTER - name: CLUSTER
value: "ceph" value: "ceph"
- name: ENABLE_AUTOSCALER
value: {{ .Values.conf.features.pg_autoscaler | quote }}
- name: CLUSTER_SET_FLAGS - name: CLUSTER_SET_FLAGS
value: {{ .Values.conf.features.cluster_flags.set | quote }} value: {{ .Values.conf.features.cluster_flags.set | quote }}
- name: CLUSTER_UNSET_FLAGS - name: CLUSTER_UNSET_FLAGS

View File

@ -50,8 +50,6 @@ spec:
value: {{ .Values.conf.pool.default.crush_rule | default "replicated_rule" | quote }} value: {{ .Values.conf.pool.default.crush_rule | default "replicated_rule" | quote }}
- name: MGR_COUNT - name: MGR_COUNT
value: {{ .Values.pod.replicas.mgr | default "1" | quote }} value: {{ .Values.pod.replicas.mgr | default "1" | quote }}
- name: ENABLE_AUTOSCALER
value: {{ .Values.conf.features.pg_autoscaler | quote }}
{{- range $pool := .Values.conf.pool.spec -}} {{- range $pool := .Values.conf.pool.spec -}}
{{- with $pool }} {{- with $pool }}
- name: {{ .name | upper | replace "." "_" }} - name: {{ .name | upper | replace "." "_" }}

View File

@ -8,4 +8,5 @@ ceph-client:
- 0.1.5 Fix Helm test check_pgs() check for inactive PGs - 0.1.5 Fix Helm test check_pgs() check for inactive PGs
- 0.1.6 Uplift from Nautilus to Octopus release - 0.1.6 Uplift from Nautilus to Octopus release
- 0.1.7 Don't wait for premerge PGs in the rbd pool job - 0.1.7 Don't wait for premerge PGs in the rbd pool job
- 0.1.8 Enhance logic to enable the pg autoscaler
... ...