From d2c8de85c9d8d7cf90e91aafb7ee92ede5e15c13 Mon Sep 17 00:00:00 2001 From: Stephen Taylor Date: Tue, 14 Jun 2022 13:35:36 -0600 Subject: [PATCH] [ceph-client] Handle multiple mon versions in the pool job The mon version check in the rbd-pool job can cause the script to error and abort if there are multiple mon versions present in the Ceph cluster. This change chooses the lowest-numbered major version from the available mon versions when performing the version check since the check is performed in order to determine the right way to parse JSON output from a mon query. Change-Id: I51cc6d1de0034affdc0cc616298c2d2cd3476dbb --- ceph-client/Chart.yaml | 2 +- ceph-client/templates/bin/pool/_init.sh.tpl | 2 +- releasenotes/notes/ceph-client.yaml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ceph-client/Chart.yaml b/ceph-client/Chart.yaml index 4ea3353d1..da94f9490 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.34 +version: 0.1.35 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 4563c9be2..0d86251a8 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -49,7 +49,7 @@ function wait_for_pgs () { pgs_ready=0 query='map({state: .state}) | group_by(.state) | map({state: .[0].state, count: length}) | .[] | select(.state | contains("active") or contains("premerge") | not)' - if [[ $(ceph mon versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then + if [[ $(ceph mon versions | awk '/version/{print $3}' | sort -n | head -n 1 | cut -d. -f1) -ge 14 ]]; then query=".pg_stats | ${query}" fi diff --git a/releasenotes/notes/ceph-client.yaml b/releasenotes/notes/ceph-client.yaml index de9c100b1..ad2e7c617 100644 --- a/releasenotes/notes/ceph-client.yaml +++ b/releasenotes/notes/ceph-client.yaml @@ -35,4 +35,5 @@ ceph-client: - 0.1.32 Simplify test rules for ceph-mgr deployment - 0.1.33 More robust naming of clusterrole-checkdns - 0.1.34 Migrated CronJob resource to batch/v1 API version + - 0.1.35 Handle multiple mon versions in the pool job ...