1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #1232: Adjust ceph monitor if there is a quota on the pool

This commit is contained in:
Jan Orel 2019-03-15 10:52:47 +01:00 committed by Ruben S. Montero
parent 00cf56a087
commit cd7a147c02
2 changed files with 10 additions and 2 deletions

View File

@ -186,7 +186,7 @@ rbd_rm_r() {
#--------------------------------------------------------------------------------
rbd_df_monitor() {
local monitor_data i j xpath_elements pool_name bytes_used free
local monitor_data i j xpath_elements pool_name bytes_used quota_bytes free
monitor_data=$1
pool_name=$2
@ -195,11 +195,19 @@ rbd_df_monitor() {
xpath_elements[i++]="$element"
done < <(echo $monitor_data | $XPATH \
"/stats/pools/pool[name = \"${pool_name}\"]/stats/bytes_used" \
"/stats/pools/pool[name = \"${pool_name}\"]/stats/quota_bytes" \
"/stats/pools/pool[name = \"${pool_name}\"]/stats/max_avail")
bytes_used="${xpath_elements[j++]:-0}"
quota_bytes="${xpath_elements[j++]:-0}"
free="${xpath_elements[j++]:-0}"
if [ $quota_bytes -ne 0 ]; then
if [ $quota_bytes -lt $free ]; then
export free=$quota_bytes
fi
fi
cat << EOF | tr -d '[:blank:][:space:]'
USED_MB=$(($bytes_used / 1024**2))\n
TOTAL_MB=$((($bytes_used + $free) / 1024**2))\n

View File

@ -81,7 +81,7 @@ fi
# ------------ Compute datastore usage -------------
MONITOR_SCRIPT=$(cat <<EOF
$CEPH df --format xml
$CEPH df detail --format xml
EOF
)