From 4214e85a7750d77e79a83fc026115b5731457292 Mon Sep 17 00:00:00 2001 From: Chinasubbareddy Mallavarapu Date: Fri, 14 Aug 2020 13:22:42 -0500 Subject: [PATCH] [CEPH] Add missing ceph cluster name for helm tests This is to export the ceph cluster name as environment variable since its getting referred by scripts. also to fix the query to get inactive pgs. Change-Id: I1db5cfbd594c0cc6d54f748f22af5856d9594922 --- ceph-client/templates/bin/_helm-tests.sh.tpl | 5 +++-- ceph-client/templates/pod-helm-tests.yaml | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ceph-client/templates/bin/_helm-tests.sh.tpl b/ceph-client/templates/bin/_helm-tests.sh.tpl index 5f15eea46..0f749f1c0 100755 --- a/ceph-client/templates/bin/_helm-tests.sh.tpl +++ b/ceph-client/templates/bin/_helm-tests.sh.tpl @@ -265,7 +265,8 @@ function pool_failuredomain_validation() { } function pg_validation() { - inactive_pgs=(`ceph --cluster ${CLUSTER} pg ls | tail -n +2 | grep -v "active+"|awk '{ print $1 }'`) + ceph pg ls + inactive_pgs=(`ceph --cluster ${CLUSTER} pg ls -f json-pretty | grep '"pgid":\|"state":' | grep -v "active" | grep -B1 '"state":' | awk -F "\"" '/pgid/{print $4}'`) if [ ${#inactive_pgs[*]} -gt 0 ];then echo "There are few incomplete pgs in the cluster" echo ${inactive_pgs[*]} @@ -290,7 +291,7 @@ OSD_POOLS_DETAILS=$(ceph osd pool ls detail -f json-pretty) OSD_CRUSH_RULE_DUMP=$(ceph osd crush rule dump -f json-pretty) PG_STAT=$(ceph pg stat -f json-pretty) - +ceph -s pg_validation pool_validation pool_failuredomain_validation diff --git a/ceph-client/templates/pod-helm-tests.yaml b/ceph-client/templates/pod-helm-tests.yaml index 951a22cb8..f9117d8e9 100644 --- a/ceph-client/templates/pod-helm-tests.yaml +++ b/ceph-client/templates/pod-helm-tests.yaml @@ -40,6 +40,8 @@ spec: {{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} {{ dict "envAll" $envAll "application" "test" "container" "test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }} env: + - name: CLUSTER + value: "ceph" - name: CEPH_DEPLOYMENT_NAMESPACE value: {{ .Release.Namespace }} - name: REQUIRED_PERCENT_OF_OSDS