mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 13:15:14 +09:00
B #1232: Adjust ceph monitor if there is a quota on the pool
(cherry picked from commit cd7a147c02)
This commit is contained in:
1 parent
e1497baf1d
commit
52b811b338
2 files changed
+10
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -81,7 +81,7 @@ fi
|
||||
# ------------ Compute datastore usage -------------
|
||||
|
||||
MONITOR_SCRIPT=$(cat <<EOF
|
||||
$CEPH df --format xml
|
||||
$CEPH df detail --format xml
|
||||
EOF
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user