From c8dd26f1d331a520f64cbc090726696e03d407e7 Mon Sep 17 00:00:00 2001 From: Chinasubbareddy Mallavarapu Date: Tue, 2 Jul 2019 14:13:19 -0500 Subject: [PATCH] Ceph-osd: update helm tests logic for osds This is to update helm test logic to test and exit if there are no osds up in the cluster. This may heppen when we miss ceph-osd label on the nodes. Change-Id: I98971106e202a9c4fd9d236f368492c6c6498ce1 --- ceph-osd/templates/bin/_helm-tests.sh.tpl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ceph-osd/templates/bin/_helm-tests.sh.tpl b/ceph-osd/templates/bin/_helm-tests.sh.tpl index 3527614f28..6c51763832 100644 --- a/ceph-osd/templates/bin/_helm-tests.sh.tpl +++ b/ceph-osd/templates/bin/_helm-tests.sh.tpl @@ -29,9 +29,14 @@ function check_osd_status() { up_osds=$(echo $ceph_osd_stat_output | jq '.num_up_osds') in_osds=$(echo $ceph_osd_stat_output | jq '.num_in_osds') # - # In a correctly deployed cluster the number of UP and IN OSDs must be the same as the total number of OSDs. - # - if [ "x${num_osds}" == "x${up_osds}" ] && [ "x${num_osds}" == "x${in_osds}" ] ; then + #NOTE: This check will fail if deployed OSDs are not running correctly + #In a correctly deployed cluster the number of UP and IN OSDs must be + #the same as the total number of OSDs + + if [ "x${num_osds}" == "x0" ] ; then + echo "There are no osds in the cluster" + exit 1 + elif [ "x${num_osds}" == "x${up_osds}" ] && [ "x${num_osds}" == "x${in_osds}" ] ; then echo "Success: Total OSDs=${num_osds} Up=${up_osds} In=${in_osds}" else echo "Failure: Total OSDs=${num_osds} Up=${up_osds} In=${in_osds}"