c8dd26f1d3
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
48 lines
1.5 KiB
Smarty
48 lines
1.5 KiB
Smarty
#!/bin/bash
|
|
|
|
{{/*
|
|
Copyright 2017 The Openstack-Helm Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/}}
|
|
|
|
set -ex
|
|
|
|
# Check OSD status
|
|
function check_osd_status() {
|
|
echo "--Start: Checking OSD status--"
|
|
ceph_osd_stat_output=$(ceph osd stat -f json)
|
|
#
|
|
# Extract each value needed to check correct deployment of the OSDs
|
|
#
|
|
num_osds=$(echo $ceph_osd_stat_output | jq '.num_osds')
|
|
up_osds=$(echo $ceph_osd_stat_output | jq '.num_up_osds')
|
|
in_osds=$(echo $ceph_osd_stat_output | jq '.num_in_osds')
|
|
#
|
|
#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}"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
check_osd_status
|