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