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

B #~: CEPH monitor pools correctly (#4074)

TOTAL = MAX_AVAIL + USED is wrong as MAX_AVAIL
is already a number considering the replica mode.
However, USED is a total number of data used on
all replicas altogether.

TOTAL = MAX_AVAIL + STORE is correct.

(cherry picked from commit c16328cde5319183ca61ca79dc421a5d53663ac8)
This commit is contained in:
Jan Orel 2020-01-07 14:00:45 +01:00 committed by Ruben S. Montero
parent 4c50a44ba6
commit a0c46ae584
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -208,7 +208,7 @@ rbd_rm_r() {
#--------------------------------------------------------------------------------
rbd_df_monitor() {
local monitor_data i j xpath_elements pool_name bytes_used quota_bytes free
local monitor_data i j xpath_elements pool_name stored quota_bytes free
monitor_data=$1
pool_name=$2
@ -216,11 +216,11 @@ rbd_df_monitor() {
while IFS= read -r -d '' element; do
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/stored" \
"/stats/pools/pool[name = \"${pool_name}\"]/stats/quota_bytes" \
"/stats/pools/pool[name = \"${pool_name}\"]/stats/max_avail")
bytes_used="${xpath_elements[j++]:-0}"
stored="${xpath_elements[j++]:-0}"
quota_bytes="${xpath_elements[j++]:-0}"
free="${xpath_elements[j++]:-0}"
@ -231,8 +231,8 @@ rbd_df_monitor() {
fi
cat << EOF | tr -d '[:blank:][:space:]'
USED_MB=$(($bytes_used / 1024**2))\n
TOTAL_MB=$((($bytes_used + $free) / 1024**2))\n
USED_MB=$(($stored / 1024**2))\n
TOTAL_MB=$((($stored + $free) / 1024**2))\n
FREE_MB=$(($free / 1024**2))\n
EOF
}