File 0001-Low-NodeUtilization-Fix-checking-for-Xen-commands.patch of Package resource-agents.35387

From 5cf585876c639303c59215eafd832358fc7a36c5 Mon Sep 17 00:00:00 2001
From: Petr Pavlu <petr.pavlu@suse.com>
Date: Thu, 17 Oct 2019 14:24:29 +0200
Subject: [PATCH 1/1] Low: NodeUtilization: Fix checking for Xen commands

Fix shell quoting in function Host_Total_Memory(). Missing quotes caused
that if no Xen command (xl or xm) was found the function made a
non-sense call to the info utility. This could have resulted in
unexpected messages appearing in pacemaker logs. Example:
> lrmd[3476]:   notice: prm_node_util_monitor_300000:3915:stderr [ info: Writing node (dir)Top... ]
> lrmd[3476]:   notice: prm_node_util_monitor_300000:3915:stderr [ info: Cannot find node `(dir)GNU Free Documentation License'. ]
> lrmd[3476]:   notice: prm_node_util_monitor_300000:3915:stderr [ info: Done. ]

The patch also changes a warning about no Xen command being available to
a debug message. With the fixed quoting, if a NodeUtilization resource
was configured to use the default utilization_hv_memory=true parameter
but the Xen tools were not available, the warning would be reported each
time when the monitor operation is run. This change preserves the
previous behaviour that reported no warning.
---
 heartbeat/NodeUtilization | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/heartbeat/NodeUtilization b/heartbeat/NodeUtilization
index 544707bf..64b81258 100755
--- a/heartbeat/NodeUtilization
+++ b/heartbeat/NodeUtilization
@@ -135,10 +135,10 @@ Host_Total_Memory() {
 
     xentool=$(which xl 2> /dev/null || which xm 2> /dev/null)
 
-    if [ -x $xentool ]; then
-        $xentool info | awk '/total_memory/{printf("%d\n",$3);exit(0)}'
+    if [ -x "$xentool" ]; then
+        "$xentool" info | awk '/total_memory/{printf("%d\n",$3);exit(0)}'
     else
-        ocf_log warn "Can only set hv_memory for Xen hypervisor"
+        ocf_log debug "Can only set hv_memory for Xen hypervisor"
         echo "0"
     fi
 }
-- 
2.16.4

openSUSE Build Service is sponsored by