Blame SOURCES/007-shutdown-lock.patch

ed4e54
From f17c99492c7ab9e639b940a34d2a48b55937b605 Mon Sep 17 00:00:00 2001
ed4e54
From: Ken Gaillot <kgaillot@redhat.com>
ed4e54
Date: Tue, 14 Jan 2020 16:00:36 -0600
ed4e54
Subject: [PATCH 03/18] Low: tools: improve crm_resource "why" messages
ed4e54
ed4e54
---
ed4e54
 tools/crm_resource_runtime.c | 21 ++++++++++++---------
ed4e54
 1 file changed, 12 insertions(+), 9 deletions(-)
ed4e54
ed4e54
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
ed4e54
index 9ae24b6..61ceee7 100644
ed4e54
--- a/tools/crm_resource_runtime.c
ed4e54
+++ b/tools/crm_resource_runtime.c
ed4e54
@@ -878,7 +878,7 @@ cli_cleanup_all(crm_ipc_t *crmd_channel, const char *node_name,
ed4e54
 void
ed4e54
 cli_resource_check(cib_t * cib_conn, resource_t *rsc)
ed4e54
 {
ed4e54
-    int need_nl = 0;
ed4e54
+    bool printed = false;
ed4e54
     char *role_s = NULL;
ed4e54
     char *managed = NULL;
ed4e54
     resource_t *parent = uber_parent(rsc);
ed4e54
@@ -897,23 +897,26 @@ cli_resource_check(cib_t * cib_conn, resource_t *rsc)
ed4e54
             // Treated as if unset
ed4e54
 
ed4e54
         } else if(role == RSC_ROLE_STOPPED) {
ed4e54
-            printf("\n  * The configuration specifies that '%s' should remain stopped\n", parent->id);
ed4e54
-            need_nl++;
ed4e54
+            printf("\n  * Configuration specifies '%s' should remain stopped\n",
ed4e54
+                   parent->id);
ed4e54
+            printed = true;
ed4e54
 
ed4e54
         } else if (is_set(parent->flags, pe_rsc_promotable)
ed4e54
                    && (role == RSC_ROLE_SLAVE)) {
ed4e54
-            printf("\n  * The configuration specifies that '%s' should not be promoted\n", parent->id);
ed4e54
-            need_nl++;
ed4e54
+            printf("\n  * Configuration specifies '%s' should not be promoted\n",
ed4e54
+                   parent->id);
ed4e54
+            printed = true;
ed4e54
         }
ed4e54
     }
ed4e54
 
ed4e54
-    if(managed && crm_is_true(managed) == FALSE) {
ed4e54
-        printf("%s  * The configuration prevents the cluster from stopping or starting '%s' (unmanaged)\n", need_nl == 0?"\n":"", parent->id);
ed4e54
-        need_nl++;
ed4e54
+    if (managed && !crm_is_true(managed)) {
ed4e54
+        printf("%s  * Configuration prevents cluster from stopping or starting unmanaged '%s'\n",
ed4e54
+               (printed? "" : "\n"), parent->id);
ed4e54
+        printed = true;
ed4e54
     }
ed4e54
     free(managed);
ed4e54
 
ed4e54
-    if(need_nl) {
ed4e54
+    if (printed) {
ed4e54
         printf("\n");
ed4e54
     }
ed4e54
 }
ed4e54
-- 
ed4e54
1.8.3.1
ed4e54