23 lines
1015 B
Diff
23 lines
1015 B
Diff
|
From a678ce6daf71326fee7c6e2309c480f34673b0d3 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
|
||
|
Date: Wed, 15 Mar 2017 13:36:15 +0100
|
||
|
Subject: [PATCH] NodeUtilization: Never set hv_memory to a negative value
|
||
|
|
||
|
---
|
||
|
extra/resources//NodeUtilization | 2 ++
|
||
|
1 file changed, 2 insertions(+)
|
||
|
|
||
|
diff --git a/heartbeat/NodeUtilization b/heartbeat/NodeUtilization
|
||
|
index f246010..61969e6 100755
|
||
|
--- a/extra/resources//NodeUtilization
|
||
|
+++ b/extra/resources//NodeUtilization
|
||
|
@@ -155,6 +155,8 @@ set_utilization() {
|
||
|
hv_mem=$(( $(Host_Total_Memory) - OCF_RESKEY_utilization_hv_memory_reservation ))
|
||
|
uti_mem=$(crm_attribute -Q -t nodes -U "$host_name" -z -n hv_memory 2>/dev/null)
|
||
|
|
||
|
+ [ $hv_mem -lt 0 ] && hv_mem=0
|
||
|
+
|
||
|
if [ "$hv_mem" != "$uti_mem" ]; then
|
||
|
if ! crm_attribute -t nodes -U "$host_name" -z -n hv_memory -v $hv_mem; then
|
||
|
ocf_log err "Failed to set the hv_memory utilization attribute for $host_name using crm_attribute."
|