From 69a7916b920566b9d193adcb79949ae39b59e7f3 Mon Sep 17 00:00:00 2001 From: Stephen Taylor Date: Thu, 11 Mar 2021 14:13:07 -0700 Subject: [PATCH] [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 --- ceph-client/Chart.yaml | 2 +- ceph-client/templates/bin/pool/_init.sh.tpl | 30 ++++++++++++--------- releasenotes/notes/ceph-client.yaml | 1 + 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ceph-client/Chart.yaml b/ceph-client/Chart.yaml index 6c38f1e55..b369b93a3 100644 --- a/ceph-client/Chart.yaml +++ b/ceph-client/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph Client name: ceph-client -version: 0.1.11 +version: 0.1.12 home: https://github.com/ceph/ceph-client ... diff --git a/ceph-client/templates/bin/pool/_init.sh.tpl b/ceph-client/templates/bin/pool/_init.sh.tpl index 2e338d95e..70a77191b 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -146,18 +146,18 @@ function reweight_osds () { done } -function enable_or_disable_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 # only required for nautilus - fi - ceph config set global osd_pool_default_pg_autoscale_mode on - else - if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then - ceph mgr module disable pg_autoscaler # only required for nautilus - fi - ceph config set global osd_pool_default_pg_autoscale_mode off +function enable_autoscaling () { + if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then + ceph mgr module enable pg_autoscaler # only required for nautilus fi + ceph config set global osd_pool_default_pg_autoscale_mode on +} + +function disable_autoscaling () { + if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then + ceph mgr module disable pg_autoscaler # only required for nautilus + fi + ceph config set global osd_pool_default_pg_autoscale_mode off } function set_cluster_flags () { @@ -319,6 +319,10 @@ if [[ ${quota_sum} -gt ${target_quota} ]]; then exit 1 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 -}} {{- with $pool }} # 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 }} -if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then - enable_or_disable_autoscaling +if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] && [[ "${ENABLE_AUTOSCALER}" == "true" ]]; then + enable_autoscaling fi {{- if .Values.conf.pool.crush.tunables }} diff --git a/releasenotes/notes/ceph-client.yaml b/releasenotes/notes/ceph-client.yaml index 724b0cd6d..e9246a21d 100644 --- a/releasenotes/notes/ceph-client.yaml +++ b/releasenotes/notes/ceph-client.yaml @@ -12,4 +12,5 @@ ceph-client: - 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.11 enhance logic to enable and disable the autoscaler + - 0.1.12 Disable autoscaling before pools are created ...