[ceph-client] Disable autoscaling before pools are created

When autoscaling is disabled after pools are created, there is an
opportunity for some autoscaling to take place before autoscaling
is disabled. This change checks to see if autoscaling needs to be
disabled before creating pools, then checks to see if it needs to
be enabled after creating pools. This ensures that autoscaling
won't happen when autoscaler is disabled and autoscaling won't
start prematurely as pools are being created when it is enabled.

Change-Id: I8803b799b51735ecd3a4878d62be45ec50bbbe19
This commit is contained in:
Stephen Taylor 2021-03-11 14:13:07 -07:00 committed by chinasubbareddy mallavarapu
parent 4b42f3f57f
commit 69a7916b92
3 changed files with 19 additions and 14 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.11 version: 0.1.12
home: https://github.com/ceph/ceph-client home: https://github.com/ceph/ceph-client
... ...

View File

@ -146,18 +146,18 @@ 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 if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then
ceph mgr module enable pg_autoscaler # only required for nautilus ceph mgr module enable pg_autoscaler # only required for nautilus
fi fi
ceph config set global osd_pool_default_pg_autoscale_mode on ceph config set global osd_pool_default_pg_autoscale_mode on
else }
function disable_autoscaling () {
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) -eq 14 ]]; then
ceph mgr module disable pg_autoscaler # only required for nautilus ceph mgr module disable pg_autoscaler # only required for nautilus
fi fi
ceph config set global osd_pool_default_pg_autoscale_mode off ceph config set global osd_pool_default_pg_autoscale_mode off
fi
} }
function set_cluster_flags () { function set_cluster_flags () {
@ -319,6 +319,10 @@ if [[ ${quota_sum} -gt ${target_quota} ]]; then
exit 1 exit 1
fi fi
if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] && [[ "${ENABLE_AUTOSCALER}" != "true" ]]; then
disable_autoscaling
fi
{{- range $pool := .Values.conf.pool.spec -}} {{- range $pool := .Values.conf.pool.spec -}}
{{- with $pool }} {{- with $pool }}
# Read the pool quota from the pool spec (no quota if absent) # Read the pool quota from the pool spec (no quota if absent)
@ -332,8 +336,8 @@ manage_pool {{ .application }} {{ .name }} {{ .replication }} {{ .percent_total_
{{- end }} {{- end }}
{{- end }} {{- end }}
if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] && [[ "${ENABLE_AUTOSCALER}" == "true" ]]; then
enable_or_disable_autoscaling enable_autoscaling
fi fi
{{- if .Values.conf.pool.crush.tunables }} {{- if .Values.conf.pool.crush.tunables }}

View File

@ -12,4 +12,5 @@ ceph-client:
- 0.1.9 Revert "[ceph-client] enhance logic to enable the autoscaler for Octopus" - 0.1.9 Revert "[ceph-client] enhance logic to enable the autoscaler for Octopus"
- 0.1.10 Separate pool quotas from pg_num calculations - 0.1.10 Separate pool quotas from pg_num calculations
- 0.1.11 enhance logic to enable and disable the autoscaler - 0.1.11 enhance logic to enable and disable the autoscaler
- 0.1.12 Disable autoscaling before pools are created
... ...