pacemaker: Use long format for crm_ticket -v

This commit is contained in:
bizhiyuan 2024-02-29 16:48:10 +08:00
parent a53c51af41
commit e4f84c4de1
2 changed files with 59 additions and 1 deletions

View File

@ -24,7 +24,7 @@
%bcond_with run_build_tests %bcond_with run_build_tests
%bcond_with include_unit_test %bcond_with include_unit_test
%global release 3 %global release 4
## User and group to use for nonprivileged services (should be in sync with pacemaker) ## User and group to use for nonprivileged services (should be in sync with pacemaker)
%global uname hacluster %global uname hacluster
@ -50,6 +50,7 @@ Url: https://github.com/%{github_owner}/%{name}
Source0: https://github.com/%{github_owner}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/%{github_owner}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Patch0: Remove-const-warning.patch Patch0: Remove-const-warning.patch
Patch1: pacemaker-Don-t-add-explicit-error-prefix-in-log.patch Patch1: pacemaker-Don-t-add-explicit-error-prefix-in-log.patch
Patch2: pacemaker-Use-long-format-for-crm_ticket-v.patch
# direct build process dependencies # direct build process dependencies
BuildRequires: autoconf BuildRequires: autoconf
@ -298,6 +299,9 @@ VERBOSE=1 make check
%{_usr}/lib/ocf/resource.d/booth/sharedrsc %{_usr}/lib/ocf/resource.d/booth/sharedrsc
%changelog %changelog
* Thu Feb 29 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-4
- pacemaker: Use long format for crm_ticket -v
* Thu Feb 29 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-3 * Thu Feb 29 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-3
- pacemaker: Don't add explicit error prefix in log - pacemaker: Don't add explicit error prefix in log

View File

@ -0,0 +1,54 @@
From d649490dfb30e89dd725d200283f0b9848d24f61 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 29 Feb 2024 16:42:28 +0800
Subject: [PATCH] pacemaker: Use long format for crm_ticket -v
---
src/pacemaker.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/pacemaker.c b/src/pacemaker.c
index cef8c41..8ad3c69 100644
--- a/src/pacemaker.c
+++ b/src/pacemaker.c
@@ -46,7 +46,7 @@ enum atomic_ticket_supported atomicity = UNKNOWN;
-#define COMMAND_MAX 1024
+#define COMMAND_MAX 2048
/** Determines whether the installed crm_ticket can do atomic ticket grants,
@@ -126,14 +126,14 @@ static int pcmk_write_ticket_atomic(struct ticket_config *tk, int grant)
int rv;
- /* The values are appended to "-v", so that NO_ONE
- * (which is -1) isn't seen as another option. */
+ /* The long format (--attr-value=) for attribute value is used instead of "-v",
+ * so that NO_ONE (which is -1) isn't seen as another option. */
snprintf(cmd, COMMAND_MAX,
"crm_ticket -t '%s' "
"%s --force "
- "-S owner -v%" PRIi32 " "
- "-S expires -v%" PRIi64 " "
- "-S term -v%" PRIi64,
+ "-S owner --attr-value=%" PRIi32 " "
+ "-S expires --attr-value=%" PRIi64 " "
+ "-S term --attr-value=%" PRIi64,
tk->name,
(grant > 0 ? "-g" :
grant < 0 ? "-r" :
@@ -232,7 +232,7 @@ static int pcmk_set_attr(struct ticket_config *tk, const char *attr, const char
char cmd[COMMAND_MAX];
snprintf(cmd, COMMAND_MAX,
- "crm_ticket -t '%s' -S '%s' -v '%s'",
+ "crm_ticket -t '%s' -S '%s' --attr-value='%s'",
tk->name, attr, val);
return _run_crm_ticket(cmd);
}
--
2.25.1