|
|
7cbf69 |
From bb58699a47a7b9070d555490f980c33caa3066e9 Mon Sep 17 00:00:00 2001
|
|
|
7cbf69 |
From: Jan Friesse <jfriesse@redhat.com>
|
|
|
7cbf69 |
Date: Mon, 8 Jun 2020 15:38:06 +0200
|
|
|
7cbf69 |
Subject: [PATCH] pacemaker: Handle updated exit code of crm_ticket
|
|
|
7cbf69 |
|
|
|
7cbf69 |
crm_ticket included since Pacemaker version 2.0.0-rc2 doesn't return
|
|
|
7cbf69 |
EPERM (1) error code any longer when ticket is updated without using
|
|
|
7cbf69 |
--force. Instead new value CRM_EX_INSUFFICIENT_PRIV (4) is used.
|
|
|
7cbf69 |
|
|
|
7cbf69 |
This return value is used in the test_atomicity function which is
|
|
|
7cbf69 |
failing with new enough Pacemaker.
|
|
|
7cbf69 |
|
|
|
7cbf69 |
Solution is to check also for return code 4.
|
|
|
7cbf69 |
|
|
|
7cbf69 |
Also previously when unexpected code is returned, log contained full
|
|
|
7cbf69 |
return value as returned by system call. This is not very readable so
|
|
|
7cbf69 |
use only exit status (WEXITSTATUS) instead.
|
|
|
7cbf69 |
|
|
|
7cbf69 |
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
|
|
|
7cbf69 |
---
|
|
|
7cbf69 |
src/pacemaker.c | 6 ++++--
|
|
|
7cbf69 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
7cbf69 |
|
|
|
7cbf69 |
diff --git a/src/pacemaker.c b/src/pacemaker.c
|
|
|
7cbf69 |
index 7e3f9e6..1582fa8 100644
|
|
|
7cbf69 |
--- a/src/pacemaker.c
|
|
|
7cbf69 |
+++ b/src/pacemaker.c
|
|
|
7cbf69 |
@@ -59,6 +59,7 @@ enum atomic_ticket_supported atomicity = UNKNOWN;
|
|
|
7cbf69 |
* - the old version asks for "Y/N" via STDIN, and returns 0
|
|
|
7cbf69 |
* when reading "no";
|
|
|
7cbf69 |
* - the new version just reports an error without asking.
|
|
|
7cbf69 |
+ * Since 2.0.0-rc2 error code is changed from 1 (EPERM) to 4 (CRM_EX_INSUFFICIENT_PRIV)
|
|
|
7cbf69 |
*/
|
|
|
7cbf69 |
static void test_atomicity(void)
|
|
|
7cbf69 |
{
|
|
|
7cbf69 |
@@ -86,7 +87,8 @@ static void test_atomicity(void)
|
|
|
7cbf69 |
log_info("Old \"crm_ticket\" found, using non-atomic ticket updates.");
|
|
|
7cbf69 |
break;
|
|
|
7cbf69 |
|
|
|
7cbf69 |
- case 1:
|
|
|
7cbf69 |
+ case 1: /* Pacemaker < 2.0.0-rc2 - EPERM */
|
|
|
7cbf69 |
+ case 4: /* Pacemaker >= 2.0.0-rc2 - CRM_EX_INSUFFICIENT_PRIV */
|
|
|
7cbf69 |
atomicity = YES;
|
|
|
7cbf69 |
log_info("New \"crm_ticket\" found, using atomic ticket updates.");
|
|
|
7cbf69 |
break;
|
|
|
7cbf69 |
@@ -94,7 +96,7 @@ static void test_atomicity(void)
|
|
|
7cbf69 |
default:
|
|
|
7cbf69 |
log_error("Unexpected return value from \"crm_ticket\" (%d), "
|
|
|
7cbf69 |
"falling back to non-atomic ticket updates.",
|
|
|
7cbf69 |
- rv);
|
|
|
7cbf69 |
+ WEXITSTATUS(rv));
|
|
|
7cbf69 |
atomicity = NO;
|
|
|
7cbf69 |
}
|
|
|
7cbf69 |
|
|
|
7cbf69 |
--
|
|
|
7cbf69 |
2.18.2
|
|
|
7cbf69 |
|