commit
565c4384a8
@ -0,0 +1,2 @@
|
||||
SOURCES/nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz
|
||||
SOURCES/pacemaker-dc6eb4362.tar.gz
|
@ -0,0 +1,2 @@
|
||||
2cbec94ad67dfbeba75e38d2c3c5c44961b3cd16 SOURCES/nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz
|
||||
24ccc9f234896595a1f7a8baec22652620fd609f SOURCES/pacemaker-dc6eb4362.tar.gz
|
@ -0,0 +1,127 @@
|
||||
From 243139b2ec0f6b17877a4e7f651fc3f70f76b11a Mon Sep 17 00:00:00 2001
|
||||
From: Christine Caulfield <ccaulfie@redhat.com>
|
||||
Date: Fri, 6 May 2022 15:23:43 +0100
|
||||
Subject: [PATCH 1/2] fenced: Don't ignore CIB updates if stonith-enabled=false
|
||||
|
||||
Fixes: T378
|
||||
---
|
||||
daemons/fenced/pacemaker-fenced.c | 23 +++--------------------
|
||||
1 file changed, 3 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c
|
||||
index caab7de83..dadd187b6 100644
|
||||
--- a/daemons/fenced/pacemaker-fenced.c
|
||||
+++ b/daemons/fenced/pacemaker-fenced.c
|
||||
@@ -1136,11 +1136,8 @@ static void
|
||||
update_cib_cache_cb(const char *event, xmlNode * msg)
|
||||
{
|
||||
int rc = pcmk_ok;
|
||||
- xmlNode *stonith_enabled_xml = NULL;
|
||||
- static gboolean stonith_enabled_saved = TRUE;
|
||||
long timeout_ms_saved = stonith_watchdog_timeout_ms;
|
||||
gboolean need_full_refresh = FALSE;
|
||||
- bool value = false;
|
||||
|
||||
if(!have_cib_devices) {
|
||||
crm_trace("Skipping updates until we get a full dump");
|
||||
@@ -1191,32 +1188,18 @@ update_cib_cache_cb(const char *event, xmlNode * msg)
|
||||
return;
|
||||
}
|
||||
CRM_ASSERT(local_cib != NULL);
|
||||
- stonith_enabled_saved = FALSE; /* Trigger a full refresh below */
|
||||
+ need_full_refresh = TRUE;
|
||||
}
|
||||
|
||||
pcmk__refresh_node_caches_from_cib(local_cib);
|
||||
update_stonith_watchdog_timeout_ms(local_cib);
|
||||
|
||||
- stonith_enabled_xml = get_xpath_object("//nvpair[@name='stonith-enabled']",
|
||||
- local_cib, LOG_NEVER);
|
||||
- if (pcmk__xe_get_bool_attr(stonith_enabled_xml, XML_NVPAIR_ATTR_VALUE, &value) == pcmk_rc_ok && !value) {
|
||||
- crm_trace("Ignoring CIB updates while fencing is disabled");
|
||||
- stonith_enabled_saved = FALSE;
|
||||
-
|
||||
- } else if (stonith_enabled_saved == FALSE) {
|
||||
- crm_info("Updating fencing device and topology lists "
|
||||
- "now that fencing is enabled");
|
||||
- stonith_enabled_saved = TRUE;
|
||||
- need_full_refresh = TRUE;
|
||||
-
|
||||
- } else {
|
||||
- if (timeout_ms_saved != stonith_watchdog_timeout_ms) {
|
||||
+ if (timeout_ms_saved != stonith_watchdog_timeout_ms) {
|
||||
need_full_refresh = TRUE;
|
||||
- } else {
|
||||
+ } else {
|
||||
update_fencing_topology(event, msg);
|
||||
update_cib_stonith_devices(event, msg);
|
||||
watchdog_device_update();
|
||||
- }
|
||||
}
|
||||
|
||||
if (need_full_refresh) {
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From c600ef49022e7473acbe121fae50a0c1aa2d7c03 Mon Sep 17 00:00:00 2001
|
||||
From: Christine Caulfield <ccaulfie@redhat.com>
|
||||
Date: Thu, 9 Jun 2022 11:08:43 +0100
|
||||
Subject: [PATCH 2/2] Also don't check for stonith-disabled in
|
||||
update_stonith_watchdog_timeout_ms
|
||||
|
||||
---
|
||||
daemons/fenced/pacemaker-fenced.c | 34 +++++++++++--------------------
|
||||
1 file changed, 12 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c
|
||||
index dadd187b6..ec42d5bc2 100644
|
||||
--- a/daemons/fenced/pacemaker-fenced.c
|
||||
+++ b/daemons/fenced/pacemaker-fenced.c
|
||||
@@ -643,31 +643,21 @@ watchdog_device_update(void)
|
||||
static void
|
||||
update_stonith_watchdog_timeout_ms(xmlNode *cib)
|
||||
{
|
||||
- xmlNode *stonith_enabled_xml = NULL;
|
||||
- bool stonith_enabled = false;
|
||||
- int rc = pcmk_rc_ok;
|
||||
long timeout_ms = 0;
|
||||
+ xmlNode *stonith_watchdog_xml = NULL;
|
||||
+ const char *value = NULL;
|
||||
|
||||
- stonith_enabled_xml = get_xpath_object("//nvpair[@name='stonith-enabled']",
|
||||
- cib, LOG_NEVER);
|
||||
- rc = pcmk__xe_get_bool_attr(stonith_enabled_xml, XML_NVPAIR_ATTR_VALUE, &stonith_enabled);
|
||||
-
|
||||
- if (rc != pcmk_rc_ok || stonith_enabled) {
|
||||
- xmlNode *stonith_watchdog_xml = NULL;
|
||||
- const char *value = NULL;
|
||||
-
|
||||
- stonith_watchdog_xml = get_xpath_object("//nvpair[@name='stonith-watchdog-timeout']",
|
||||
- cib, LOG_NEVER);
|
||||
- if (stonith_watchdog_xml) {
|
||||
- value = crm_element_value(stonith_watchdog_xml, XML_NVPAIR_ATTR_VALUE);
|
||||
- }
|
||||
- if (value) {
|
||||
- timeout_ms = crm_get_msec(value);
|
||||
- }
|
||||
+ stonith_watchdog_xml = get_xpath_object("//nvpair[@name='stonith-watchdog-timeout']",
|
||||
+ cib, LOG_NEVER);
|
||||
+ if (stonith_watchdog_xml) {
|
||||
+ value = crm_element_value(stonith_watchdog_xml, XML_NVPAIR_ATTR_VALUE);
|
||||
+ }
|
||||
+ if (value) {
|
||||
+ timeout_ms = crm_get_msec(value);
|
||||
+ }
|
||||
|
||||
- if (timeout_ms < 0) {
|
||||
- timeout_ms = pcmk__auto_watchdog_timeout();
|
||||
- }
|
||||
+ if (timeout_ms < 0) {
|
||||
+ timeout_ms = pcmk__auto_watchdog_timeout();
|
||||
}
|
||||
|
||||
stonith_watchdog_timeout_ms = timeout_ms;
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,425 @@
|
||||
From 80c64be80f2bffdcf5d2432e1e59d633fd68d516 Mon Sep 17 00:00:00 2001
|
||||
From: Grace Chin <gchin@redhat.com>
|
||||
Date: Mon, 13 Jun 2022 09:02:32 -0400
|
||||
Subject: [PATCH 1/4] Add pcmk__is_user_in_group()
|
||||
|
||||
---
|
||||
lib/common/crmcommon_private.h | 3 +++
|
||||
lib/common/utils.c | 33 +++++++++++++++++++++++++++++++++
|
||||
2 files changed, 36 insertions(+)
|
||||
|
||||
diff --git a/lib/common/crmcommon_private.h b/lib/common/crmcommon_private.h
|
||||
index 6b7be9c68..c2fcb0adf 100644
|
||||
--- a/lib/common/crmcommon_private.h
|
||||
+++ b/lib/common/crmcommon_private.h
|
||||
@@ -96,6 +96,9 @@ void pcmk__free_acls(GList *acls);
|
||||
G_GNUC_INTERNAL
|
||||
void pcmk__unpack_acl(xmlNode *source, xmlNode *target, const char *user);
|
||||
|
||||
+G_GNUC_INTERNAL
|
||||
+bool pcmk__is_user_in_group(const char *user, const char *group);
|
||||
+
|
||||
G_GNUC_INTERNAL
|
||||
void pcmk__apply_acl(xmlNode *xml);
|
||||
|
||||
diff --git a/lib/common/utils.c b/lib/common/utils.c
|
||||
index 2dfbef278..f23583acb 100644
|
||||
--- a/lib/common/utils.c
|
||||
+++ b/lib/common/utils.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <time.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
+#include <grp.h>
|
||||
|
||||
#include <qb/qbdefs.h>
|
||||
|
||||
@@ -53,6 +54,38 @@ gboolean crm_config_error = FALSE;
|
||||
gboolean crm_config_warning = FALSE;
|
||||
char *crm_system_name = NULL;
|
||||
|
||||
+bool
|
||||
+pcmk__is_user_in_group(const char *user, const char *group)
|
||||
+{
|
||||
+ struct group *grent;
|
||||
+ char **gr_mem;
|
||||
+
|
||||
+ if (user == NULL || group == NULL) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ setgrent();
|
||||
+ while ((grent = getgrent()) != NULL) {
|
||||
+ if (grent->gr_mem == NULL) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if(strcmp(group, grent->gr_name) != 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ gr_mem = grent->gr_mem;
|
||||
+ while (*gr_mem != NULL) {
|
||||
+ if (!strcmp(user, *gr_mem++)) {
|
||||
+ endgrent();
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ endgrent();
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
int
|
||||
crm_user_lookup(const char *name, uid_t * uid, gid_t * gid)
|
||||
{
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 5fbe5c310de00390fb36d866823a7745ba4812e3 Mon Sep 17 00:00:00 2001
|
||||
From: Grace Chin <gchin@redhat.com>
|
||||
Date: Mon, 13 Jun 2022 09:04:57 -0400
|
||||
Subject: [PATCH 2/4] Add unit test for pcmk__is_user_in_group()
|
||||
|
||||
---
|
||||
lib/common/Makefile.am | 2 +-
|
||||
lib/common/mock.c | 31 +++++--
|
||||
lib/common/mock_private.h | 11 +++
|
||||
lib/common/tests/acl/Makefile.am | 11 ++-
|
||||
.../tests/acl/pcmk__is_user_in_group_test.c | 92 +++++++++++++++++++
|
||||
5 files changed, 137 insertions(+), 10 deletions(-)
|
||||
create mode 100644 lib/common/tests/acl/pcmk__is_user_in_group_test.c
|
||||
|
||||
diff --git a/lib/common/Makefile.am b/lib/common/Makefile.am
|
||||
index d7aae53bf..04d56dc3c 100644
|
||||
--- a/lib/common/Makefile.am
|
||||
+++ b/lib/common/Makefile.am
|
||||
@@ -94,7 +94,7 @@ libcrmcommon_la_SOURCES += watchdog.c
|
||||
libcrmcommon_la_SOURCES += xml.c
|
||||
libcrmcommon_la_SOURCES += xpath.c
|
||||
|
||||
-WRAPPED = calloc getenv getpwnam_r uname
|
||||
+WRAPPED = calloc getenv getpwnam_r uname setgrent getgrent endgrent
|
||||
WRAPPED_FLAGS = $(foreach fn,$(WRAPPED),-Wl,--wrap=$(fn))
|
||||
|
||||
libcrmcommon_test_la_SOURCES = $(libcrmcommon_la_SOURCES)
|
||||
diff --git a/lib/common/mock.c b/lib/common/mock.c
|
||||
index 55812ddbc..fa9431e6d 100644
|
||||
--- a/lib/common/mock.c
|
||||
+++ b/lib/common/mock.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/utsname.h>
|
||||
+#include <grp.h>
|
||||
|
||||
#include "mock_private.h"
|
||||
|
||||
@@ -18,13 +19,13 @@
|
||||
* libcrmcommon_test.a, not into libcrmcommon.so. It is used to support
|
||||
* constructing mock versions of library functions for unit testing.
|
||||
*
|
||||
- * Each unit test will only ever want to use a mocked version of one or two
|
||||
- * library functions. However, we need to mark all the mocked functions as
|
||||
- * wrapped (with -Wl,--wrap= in the LDFLAGS) in libcrmcommon_test.a so that
|
||||
- * all those unit tests can share the same special test library. The unit
|
||||
- * test then defines its own wrapped function. Because a unit test won't
|
||||
- * define every single wrapped function, there will be undefined references
|
||||
- * at link time.
|
||||
+ * Each unit test will only ever want to use a mocked version of a few
|
||||
+ * library functions (i.e. not all of them). However, we need to mark all
|
||||
+ * the mocked functions as wrapped (with -Wl,--wrap= in the LDFLAGS) in
|
||||
+ * libcrmcommon_test.a so that all those unit tests can share the same
|
||||
+ * special test library. The unit test then defines its own wrapped
|
||||
+ * function. Because a unit test won't define every single wrapped
|
||||
+ * function, there will be undefined references at link time.
|
||||
*
|
||||
* This file takes care of those undefined references. It defines a
|
||||
* wrapped version of every function that simply calls the real libc
|
||||
@@ -74,3 +75,19 @@ int __attribute__((weak))
|
||||
__wrap_uname(struct utsname *buf) {
|
||||
return __real_uname(buf);
|
||||
}
|
||||
+
|
||||
+void __attribute__((weak))
|
||||
+__wrap_setgrent(void) {
|
||||
+ __real_setgrent();
|
||||
+}
|
||||
+
|
||||
+struct group * __attribute__((weak))
|
||||
+__wrap_getgrent(void) {
|
||||
+ return __real_getgrent();
|
||||
+}
|
||||
+
|
||||
+void __attribute__((weak))
|
||||
+__wrap_endgrent(void) {
|
||||
+ __real_endgrent();
|
||||
+}
|
||||
+
|
||||
diff --git a/lib/common/mock_private.h b/lib/common/mock_private.h
|
||||
index 3df7c9839..0c1134cc3 100644
|
||||
--- a/lib/common/mock_private.h
|
||||
+++ b/lib/common/mock_private.h
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/utsname.h>
|
||||
+#include <grp.h>
|
||||
|
||||
/* This header is for the sole use of libcrmcommon_test. */
|
||||
|
||||
@@ -31,4 +32,14 @@ int __wrap_getpwnam_r(const char *name, struct passwd *pwd,
|
||||
int __real_uname(struct utsname *buf);
|
||||
int __wrap_uname(struct utsname *buf);
|
||||
|
||||
+void __real_setgrent(void);
|
||||
+void __wrap_setgrent(void);
|
||||
+
|
||||
+struct group *__real_getgrent(void);
|
||||
+struct group *__wrap_getgrent(void);
|
||||
+
|
||||
+void __real_endgrent(void);
|
||||
+void __wrap_endgrent(void);
|
||||
+
|
||||
+
|
||||
#endif // MOCK_PRIVATE__H
|
||||
diff --git a/lib/common/tests/acl/Makefile.am b/lib/common/tests/acl/Makefile.am
|
||||
index 679c9cb8e..a73fc354c 100644
|
||||
--- a/lib/common/tests/acl/Makefile.am
|
||||
+++ b/lib/common/tests/acl/Makefile.am
|
||||
@@ -1,19 +1,26 @@
|
||||
#
|
||||
-# Copyright 2021 the Pacemaker project contributors
|
||||
+# Copyright 2021-2022 the Pacemaker project contributors
|
||||
#
|
||||
# The version control history for this file may have further details.
|
||||
#
|
||||
# This source code is licensed under the GNU General Public License version 2
|
||||
# or later (GPLv2+) WITHOUT ANY WARRANTY.
|
||||
#
|
||||
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
|
||||
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/lib/common
|
||||
LDADD = $(top_builddir)/lib/common/libcrmcommon.la -lcmocka
|
||||
|
||||
+pcmk__is_user_in_group_test_LDADD = $(top_builddir)/lib/common/libcrmcommon_test.la -lcmocka
|
||||
+pcmk__is_user_in_group_test_LDFLAGS = \
|
||||
+ -Wl,--wrap=setgrent \
|
||||
+ -Wl,--wrap=getgrent \
|
||||
+ -Wl,--wrap=endgrent
|
||||
+
|
||||
include $(top_srcdir)/mk/tap.mk
|
||||
|
||||
# Add "_test" to the end of all test program names to simplify .gitignore.
|
||||
|
||||
check_PROGRAMS = \
|
||||
+ pcmk__is_user_in_group_test \
|
||||
pcmk_acl_required_test \
|
||||
xml_acl_denied_test \
|
||||
xml_acl_enabled_test
|
||||
diff --git a/lib/common/tests/acl/pcmk__is_user_in_group_test.c b/lib/common/tests/acl/pcmk__is_user_in_group_test.c
|
||||
new file mode 100644
|
||||
index 000000000..67b8c2c7c
|
||||
--- /dev/null
|
||||
+++ b/lib/common/tests/acl/pcmk__is_user_in_group_test.c
|
||||
@@ -0,0 +1,92 @@
|
||||
+/*
|
||||
+ * Copyright 2020-2022 the Pacemaker project contributors
|
||||
+ *
|
||||
+ * The version control history for this file may have further details.
|
||||
+ *
|
||||
+ * This source code is licensed under the GNU Lesser General Public License
|
||||
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
|
||||
+ */
|
||||
+
|
||||
+#include <crm_internal.h>
|
||||
+#include <crm/common/acl.h>
|
||||
+#include "../../crmcommon_private.h"
|
||||
+
|
||||
+#include "mock_private.h"
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+#include <stddef.h>
|
||||
+#include <stdint.h>
|
||||
+#include <setjmp.h>
|
||||
+#include <cmocka.h>
|
||||
+
|
||||
+// THe index of the group that is going to be returned next from "get group entry" (getgrent)
|
||||
+static int group_idx = 0;
|
||||
+
|
||||
+// Data used for testing
|
||||
+static const char* grp0_members[] = {
|
||||
+ "user0", "user1", NULL
|
||||
+};
|
||||
+
|
||||
+static const char* grp1_members[] = {
|
||||
+ "user1", NULL
|
||||
+};
|
||||
+
|
||||
+static const char* grp2_members[] = {
|
||||
+ "user2", "user1", NULL
|
||||
+};
|
||||
+
|
||||
+// an array of "groups" (a struct from grp.h), the members of the groups are initalized here to some testing data.
|
||||
+// Casting away the consts to make the compiler happy and simplify initialization.
|
||||
+// We never actually change these variables during the test!
|
||||
+// string literal = const char* (cannot be changed b/c ? ) vs. char* (its getting casted to this)
|
||||
+static const int NUM_GROUPS = 3;
|
||||
+static struct group groups[] = {
|
||||
+ {(char*)"grp0", (char*)"", 0, (char**)grp0_members},
|
||||
+ {(char*)"grp1", (char*)"", 1, (char**)grp1_members},
|
||||
+ {(char*)"grp2", (char*)"", 2, (char**)grp2_members},
|
||||
+};
|
||||
+
|
||||
+// This function resets the group_idx to 0.
|
||||
+void
|
||||
+__wrap_setgrent(void) {
|
||||
+ group_idx = 0;
|
||||
+}
|
||||
+
|
||||
+// This function returns the next group entry in the list of groups, or
|
||||
+// NULL if there aren't any left.
|
||||
+// group_idx is a global variable which keeps track of where you are in the list
|
||||
+struct group *
|
||||
+__wrap_getgrent(void) {
|
||||
+ if(group_idx >= NUM_GROUPS) return NULL;
|
||||
+ return &groups[group_idx++];
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+__wrap_endgrent(void) {
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+is_pcmk__is_user_in_group(void **state)
|
||||
+{
|
||||
+ // null user
|
||||
+ assert_false(pcmk__is_user_in_group(NULL, "grp0"));
|
||||
+ // null group
|
||||
+ assert_false(pcmk__is_user_in_group("user0", NULL));
|
||||
+ // nonexistent group
|
||||
+ assert_false(pcmk__is_user_in_group("user0", "nonexistent_group"));
|
||||
+ // user is in group
|
||||
+ assert_true(pcmk__is_user_in_group("user0", "grp0"));
|
||||
+ // user is not in group
|
||||
+ assert_false(pcmk__is_user_in_group("user2", "grp0"));
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(int argc, char **argv)
|
||||
+{
|
||||
+ const struct CMUnitTest tests[] = {
|
||||
+ cmocka_unit_test(is_pcmk__is_user_in_group)
|
||||
+ };
|
||||
+
|
||||
+ cmocka_set_message_output(CM_OUTPUT_TAP);
|
||||
+ return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 1bb7fda60f5b8547d7457f20543b7e50089cf06b Mon Sep 17 00:00:00 2001
|
||||
From: Grace Chin <gchin@redhat.com>
|
||||
Date: Mon, 13 Jun 2022 09:17:36 -0400
|
||||
Subject: [PATCH 3/4] Add ACL group support
|
||||
|
||||
closes T61
|
||||
---
|
||||
lib/common/acl.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/lib/common/acl.c b/lib/common/acl.c
|
||||
index f68069bbd..d7f8469b1 100644
|
||||
--- a/lib/common/acl.c
|
||||
+++ b/lib/common/acl.c
|
||||
@@ -320,6 +320,13 @@ pcmk__unpack_acl(xmlNode *source, xmlNode *target, const char *user)
|
||||
crm_debug("Unpacking ACLs for user '%s'", id);
|
||||
p->acls = parse_acl_entry(acls, child, p->acls);
|
||||
}
|
||||
+ } else if (!strcmp(tag, XML_ACL_TAG_GROUP)) {
|
||||
+ const char *id = crm_element_value(child, XML_ATTR_ID);
|
||||
+
|
||||
+ if (id && pcmk__is_user_in_group(user,id)) {
|
||||
+ crm_debug("Unpacking ACLs for group '%s'", id);
|
||||
+ p->acls = parse_acl_entry(acls, child, p->acls);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From f4efd55d9424d34908ba3e2bcffe16c00b2cf660 Mon Sep 17 00:00:00 2001
|
||||
From: Grace Chin <gchin@redhat.com>
|
||||
Date: Mon, 13 Jun 2022 09:20:36 -0400
|
||||
Subject: [PATCH 4/4] Allow acl_target and acl_group elements to take a 'name'
|
||||
attribute to use a name different from 'id'
|
||||
|
||||
closes T60
|
||||
---
|
||||
include/crm/msg_xml.h | 1 +
|
||||
lib/common/acl.c | 21 +++++++++++++++++----
|
||||
2 files changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/include/crm/msg_xml.h b/include/crm/msg_xml.h
|
||||
index b36dcf060..6470520b1 100644
|
||||
--- a/include/crm/msg_xml.h
|
||||
+++ b/include/crm/msg_xml.h
|
||||
@@ -133,6 +133,7 @@ extern "C" {
|
||||
# define XML_ATTR_VERSION "version"
|
||||
# define XML_ATTR_DESC "description"
|
||||
# define XML_ATTR_ID "id"
|
||||
+# define XML_ATTR_NAME "name"
|
||||
# define XML_ATTR_IDREF "id-ref"
|
||||
# define XML_ATTR_ID_LONG "long-id"
|
||||
# define XML_ATTR_TYPE "type"
|
||||
diff --git a/lib/common/acl.c b/lib/common/acl.c
|
||||
index d7f8469b1..b9f7472ee 100644
|
||||
--- a/lib/common/acl.c
|
||||
+++ b/lib/common/acl.c
|
||||
@@ -278,8 +278,13 @@ pcmk__apply_acl(xmlNode *xml)
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
- * \brief Unpack ACLs for a given user
|
||||
- *
|
||||
+ * \brief Unpack ACLs for a given user into the
|
||||
+ * metadata of the target XML tree
|
||||
+ *
|
||||
+ * Taking the description of ACLs from the source XML tree and
|
||||
+ * marking up the target XML tree with access information for the
|
||||
+ * given user by tacking it onto the relevant nodes
|
||||
+ *
|
||||
* \param[in] source XML with ACL definitions
|
||||
* \param[in,out] target XML that ACLs will be applied to
|
||||
* \param[in] user Username whose ACLs need to be unpacked
|
||||
@@ -314,14 +319,22 @@ pcmk__unpack_acl(xmlNode *source, xmlNode *target, const char *user)
|
||||
|
||||
if (!strcmp(tag, XML_ACL_TAG_USER)
|
||||
|| !strcmp(tag, XML_ACL_TAG_USERv1)) {
|
||||
- const char *id = crm_element_value(child, XML_ATTR_ID);
|
||||
+ const char *id = crm_element_value(child, XML_ATTR_NAME);
|
||||
+
|
||||
+ if (id == NULL) {
|
||||
+ id = crm_element_value(child, XML_ATTR_ID);
|
||||
+ }
|
||||
|
||||
if (id && strcmp(id, user) == 0) {
|
||||
crm_debug("Unpacking ACLs for user '%s'", id);
|
||||
p->acls = parse_acl_entry(acls, child, p->acls);
|
||||
}
|
||||
} else if (!strcmp(tag, XML_ACL_TAG_GROUP)) {
|
||||
- const char *id = crm_element_value(child, XML_ATTR_ID);
|
||||
+ const char *id = crm_element_value(child, XML_ATTR_NAME);
|
||||
+
|
||||
+ if (id == NULL) {
|
||||
+ id = crm_element_value(child, XML_ATTR_ID);
|
||||
+ }
|
||||
|
||||
if (id && pcmk__is_user_in_group(user,id)) {
|
||||
crm_debug("Unpacking ACLs for group '%s'", id);
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,88 @@
|
||||
From 9853f4d05a376062d60f2e4c90938e587992237b Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 27 Jun 2022 12:06:24 -0400
|
||||
Subject: [PATCH 1/2] Fix: tools: Don't output "(null)" in crm_attribute's
|
||||
quiet mode.
|
||||
|
||||
If the attribute queried for has no value, simply do not output
|
||||
anything.
|
||||
|
||||
Regression in 2.1.3 introduced by 8c03553bbf
|
||||
|
||||
Fixes T502
|
||||
See: rhbz#2099331
|
||||
---
|
||||
tools/crm_attribute.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_attribute.c b/tools/crm_attribute.c
|
||||
index 0bd9dee81..b1463f906 100644
|
||||
--- a/tools/crm_attribute.c
|
||||
+++ b/tools/crm_attribute.c
|
||||
@@ -56,7 +56,9 @@ attribute_text(pcmk__output_t *out, va_list args)
|
||||
char *host G_GNUC_UNUSED = va_arg(args, char *);
|
||||
|
||||
if (out->quiet) {
|
||||
- pcmk__formatted_printf(out, "%s\n", value);
|
||||
+ if (value != NULL) {
|
||||
+ pcmk__formatted_printf(out, "%s\n", value);
|
||||
+ }
|
||||
} else {
|
||||
out->info(out, "%s%s %s%s %s%s value=%s",
|
||||
scope ? "scope=" : "", scope ? scope : "",
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 16d00a9b3ef27afd09f5c046ea1be50fc664ed84 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 27 Jun 2022 12:18:06 -0400
|
||||
Subject: [PATCH 2/2] Test: cts: Add a test for querying an attribute that does
|
||||
not exist.
|
||||
|
||||
---
|
||||
cts/cli/regression.tools.exp | 4 ++++
|
||||
cts/cts-cli.in | 5 +++++
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/cts/cli/regression.tools.exp b/cts/cli/regression.tools.exp
|
||||
index 0d1cfa2ab..464472d42 100644
|
||||
--- a/cts/cli/regression.tools.exp
|
||||
+++ b/cts/cli/regression.tools.exp
|
||||
@@ -24,6 +24,10 @@ A new shadow instance was created. To begin using it paste the following into y
|
||||
</cib>
|
||||
=#=#=#= End test: Validate CIB - OK (0) =#=#=#=
|
||||
* Passed: cibadmin - Validate CIB
|
||||
+=#=#=#= Begin test: Query the value of an attribute that does not exist =#=#=#=
|
||||
+crm_attribute: Error performing operation: No such device or address
|
||||
+=#=#=#= End test: Query the value of an attribute that does not exist - No such object (105) =#=#=#=
|
||||
+* Passed: crm_attribute - Query the value of an attribute that does not exist
|
||||
=#=#=#= Begin test: Configure something before erasing =#=#=#=
|
||||
=#=#=#= Current cib after: Configure something before erasing =#=#=#=
|
||||
<cib epoch="2" num_updates="0" admin_epoch="0">
|
||||
diff --git a/cts/cts-cli.in b/cts/cts-cli.in
|
||||
index 8565c485a..b895d36ec 100755
|
||||
--- a/cts/cts-cli.in
|
||||
+++ b/cts/cts-cli.in
|
||||
@@ -511,6 +511,10 @@ function test_tools() {
|
||||
cmd="cibadmin -Q"
|
||||
test_assert $CRM_EX_OK
|
||||
|
||||
+ desc="Query the value of an attribute that does not exist"
|
||||
+ cmd="crm_attribute -n ABCD --query --quiet"
|
||||
+ test_assert $CRM_EX_NOSUCH 0
|
||||
+
|
||||
desc="Configure something before erasing"
|
||||
cmd="crm_attribute -n cluster-delay -v 60s"
|
||||
test_assert $CRM_EX_OK
|
||||
@@ -1980,6 +1984,7 @@ for t in $tests; do
|
||||
-e 's/ end=\"[0-9][-+: 0-9]*Z*\"/ end=\"\"/' \
|
||||
-e 's/ start=\"[0-9][-+: 0-9]*Z*\"/ start=\"\"/' \
|
||||
-e 's/^Error checking rule: Device not configured/Error checking rule: No such device or address/' \
|
||||
+ -e 's/Error performing operation: Device not configured/Error performing operation: No such device or address/' \
|
||||
-e 's/\(Injecting attribute last-failure-ping#monitor_10000=\)[0-9]*/\1/' \
|
||||
-e 's/^lt-//' \
|
||||
-e 's/ocf::/ocf:/' \
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,624 @@
|
||||
From e8f96dec79bb33c11d39c9037ac623f18a67b539 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||
Date: Tue, 24 May 2022 18:08:57 +0200
|
||||
Subject: [PATCH] Low: schemas: copy API schemas in preparation for changes
|
||||
|
||||
Copy crm_mon, crm_simulate and nodes API schemas in preparation for
|
||||
changes and bump the external reference version in crm_mon and
|
||||
crm_simulate to point to the new nodes schema.
|
||||
---
|
||||
include/crm/common/output_internal.h | 2 +-
|
||||
xml/api/crm_mon-2.21.rng | 183 +++++++++++++++
|
||||
xml/api/crm_simulate-2.21.rng | 338 +++++++++++++++++++++++++++
|
||||
xml/api/nodes-2.21.rng | 51 ++++
|
||||
4 files changed, 573 insertions(+), 1 deletion(-)
|
||||
create mode 100644 xml/api/crm_mon-2.21.rng
|
||||
create mode 100644 xml/api/crm_simulate-2.21.rng
|
||||
create mode 100644 xml/api/nodes-2.21.rng
|
||||
|
||||
diff --git a/include/crm/common/output_internal.h b/include/crm/common/output_internal.h
|
||||
index 577fd5247..74ee833c1 100644
|
||||
--- a/include/crm/common/output_internal.h
|
||||
+++ b/include/crm/common/output_internal.h
|
||||
@@ -28,7 +28,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
|
||||
-# define PCMK__API_VERSION "2.20"
|
||||
+# define PCMK__API_VERSION "2.21"
|
||||
|
||||
#if defined(PCMK__WITH_ATTRIBUTE_OUTPUT_ARGS)
|
||||
# define PCMK__OUTPUT_ARGS(ARGS...) __attribute__((output_args(ARGS)))
|
||||
diff --git a/xml/api/crm_mon-2.21.rng b/xml/api/crm_mon-2.21.rng
|
||||
new file mode 100644
|
||||
index 000000000..37036d665
|
||||
--- /dev/null
|
||||
+++ b/xml/api/crm_mon-2.21.rng
|
||||
@@ -0,0 +1,183 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="element-crm-mon"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="element-crm-mon">
|
||||
+ <optional>
|
||||
+ <ref name="element-summary" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="nodes-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="resources-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="node-attributes-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <externalRef href="node-history-2.12.rng"/>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="failures-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="fence-event-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="tickets-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="bans-list" />
|
||||
+ </optional>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-summary">
|
||||
+ <element name="summary">
|
||||
+ <optional>
|
||||
+ <element name="stack">
|
||||
+ <attribute name="type"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="current_dc">
|
||||
+ <attribute name="present"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <group>
|
||||
+ <attribute name="version"> <text /> </attribute>
|
||||
+ <attribute name="name"> <text /> </attribute>
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <attribute name="with_quorum"> <data type="boolean" /> </attribute>
|
||||
+ </group>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="last_update">
|
||||
+ <attribute name="time"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ <element name="last_change">
|
||||
+ <attribute name="time"> <text /> </attribute>
|
||||
+ <attribute name="user"> <text /> </attribute>
|
||||
+ <attribute name="client"> <text /> </attribute>
|
||||
+ <attribute name="origin"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="nodes_configured">
|
||||
+ <attribute name="number"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ </element>
|
||||
+ <element name="resources_configured">
|
||||
+ <attribute name="number"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="disabled"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="blocked"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="cluster_options">
|
||||
+ <attribute name="stonith-enabled"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="symmetric-cluster"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="no-quorum-policy"> <text /> </attribute>
|
||||
+ <attribute name="maintenance-mode"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="stop-all-resources"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="stonith-timeout-ms"> <data type="integer" /> </attribute>
|
||||
+ <attribute name="priority-fencing-delay-ms"> <data type="integer" /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resources-list">
|
||||
+ <element name="resources">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="resources-2.4.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="nodes-list">
|
||||
+ <element name="nodes">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="nodes-2.21.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="node-attributes-list">
|
||||
+ <element name="node_attributes">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="node-attrs-2.8.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="failures-list">
|
||||
+ <element name="failures">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="failure-2.8.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="fence-event-list">
|
||||
+ <element name="fence_history">
|
||||
+ <optional>
|
||||
+ <attribute name="status"> <data type="integer" /> </attribute>
|
||||
+ </optional>
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="fence-event-2.15.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="tickets-list">
|
||||
+ <element name="tickets">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-ticket" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="bans-list">
|
||||
+ <element name="bans">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-ban" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-ticket">
|
||||
+ <element name="ticket">
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <attribute name="status">
|
||||
+ <choice>
|
||||
+ <value>granted</value>
|
||||
+ <value>revoked</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ <attribute name="standby"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="last-granted"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-ban">
|
||||
+ <element name="ban">
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <attribute name="resource"> <text /> </attribute>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <attribute name="weight"> <data type="integer" /> </attribute>
|
||||
+ <attribute name="promoted-only"> <data type="boolean" /> </attribute>
|
||||
+ <!-- DEPRECATED: master_only is a duplicate of promoted-only that is
|
||||
+ provided solely for API backward compatibility. It will be
|
||||
+ removed in a future release. Check promoted-only instead.
|
||||
+ -->
|
||||
+ <attribute name="master_only"> <data type="boolean" /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
diff --git a/xml/api/crm_simulate-2.21.rng b/xml/api/crm_simulate-2.21.rng
|
||||
new file mode 100644
|
||||
index 000000000..75a9b399b
|
||||
--- /dev/null
|
||||
+++ b/xml/api/crm_simulate-2.21.rng
|
||||
@@ -0,0 +1,338 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="element-crm-simulate"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="element-crm-simulate">
|
||||
+ <choice>
|
||||
+ <ref name="timings-list" />
|
||||
+ <group>
|
||||
+ <ref name="cluster-status" />
|
||||
+ <optional>
|
||||
+ <ref name="modifications-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="allocations-utilizations-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="action-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="cluster-injected-actions-list" />
|
||||
+ <ref name="revised-cluster-status" />
|
||||
+ </optional>
|
||||
+ </group>
|
||||
+ </choice>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="allocations-utilizations-list">
|
||||
+ <choice>
|
||||
+ <element name="allocations">
|
||||
+ <zeroOrMore>
|
||||
+ <choice>
|
||||
+ <ref name="element-allocation" />
|
||||
+ <ref name="element-promotion" />
|
||||
+ </choice>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ <element name="utilizations">
|
||||
+ <zeroOrMore>
|
||||
+ <choice>
|
||||
+ <ref name="element-capacity" />
|
||||
+ <ref name="element-utilization" />
|
||||
+ </choice>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ <element name="allocations_utilizations">
|
||||
+ <zeroOrMore>
|
||||
+ <choice>
|
||||
+ <ref name="element-allocation" />
|
||||
+ <ref name="element-promotion" />
|
||||
+ <ref name="element-capacity" />
|
||||
+ <ref name="element-utilization" />
|
||||
+ </choice>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </choice>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="cluster-status">
|
||||
+ <element name="cluster_status">
|
||||
+ <ref name="nodes-list" />
|
||||
+ <ref name="resources-list" />
|
||||
+ <optional>
|
||||
+ <ref name="node-attributes-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <externalRef href="node-history-2.12.rng" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="failures-list" />
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="modifications-list">
|
||||
+ <element name="modifications">
|
||||
+ <optional>
|
||||
+ <attribute name="quorum"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="watchdog"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-inject-modify-node" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-inject-modify-ticket" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-inject-spec" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-inject-attr" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="revised-cluster-status">
|
||||
+ <element name="revised_cluster_status">
|
||||
+ <ref name="nodes-list" />
|
||||
+ <ref name="resources-list" />
|
||||
+ <optional>
|
||||
+ <ref name="node-attributes-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="failures-list" />
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-attr">
|
||||
+ <element name="inject_attr">
|
||||
+ <attribute name="cib_node"> <text /> </attribute>
|
||||
+ <attribute name="name"> <text /> </attribute>
|
||||
+ <attribute name="node_path"> <text /> </attribute>
|
||||
+ <attribute name="value"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-modify-node">
|
||||
+ <element name="modify_node">
|
||||
+ <attribute name="action"> <text /> </attribute>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-spec">
|
||||
+ <element name="inject_spec">
|
||||
+ <attribute name="spec"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-modify-ticket">
|
||||
+ <element name="modify_ticket">
|
||||
+ <attribute name="action"> <text /> </attribute>
|
||||
+ <attribute name="ticket"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="cluster-injected-actions-list">
|
||||
+ <element name="transition">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-injected-actions" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="node-attributes-list">
|
||||
+ <element name="node_attributes">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="node-attrs-2.8.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="failures-list">
|
||||
+ <element name="failures">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="failure-2.8.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="nodes-list">
|
||||
+ <element name="nodes">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="nodes-2.21.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resources-list">
|
||||
+ <element name="resources">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="resources-2.4.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="timings-list">
|
||||
+ <element name="timings">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-timing" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="action-list">
|
||||
+ <element name="actions">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-node-action" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-rsc-action" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-allocation">
|
||||
+ <element name="node_weight">
|
||||
+ <attribute name="function"> <text /> </attribute>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <externalRef href="../score.rng" />
|
||||
+ <optional>
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-capacity">
|
||||
+ <element name="capacity">
|
||||
+ <attribute name="comment"> <text /> </attribute>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <element>
|
||||
+ <anyName />
|
||||
+ <text />
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-cluster-action">
|
||||
+ <element name="cluster_action">
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <attribute name="task"> <text /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-injected-actions">
|
||||
+ <choice>
|
||||
+ <ref name="element-inject-cluster-action" />
|
||||
+ <ref name="element-inject-fencing-action" />
|
||||
+ <ref name="element-inject-pseudo-action" />
|
||||
+ <ref name="element-inject-rsc-action" />
|
||||
+ </choice>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-fencing-action">
|
||||
+ <element name="fencing_action">
|
||||
+ <attribute name="op"> <text /> </attribute>
|
||||
+ <attribute name="target"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-node-action">
|
||||
+ <element name="node_action">
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <attribute name="reason"> <text /> </attribute>
|
||||
+ <attribute name="task"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-promotion">
|
||||
+ <element name="promotion_score">
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <externalRef href="../score.rng" />
|
||||
+ <optional>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-pseudo-action">
|
||||
+ <element name="pseudo_action">
|
||||
+ <attribute name="task"> <text /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-inject-rsc-action">
|
||||
+ <element name="rsc_action">
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <attribute name="op"> <text /> </attribute>
|
||||
+ <attribute name="resource"> <text /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="interval"> <data type="integer" /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-timing">
|
||||
+ <element name="timing">
|
||||
+ <attribute name="file"> <text /> </attribute>
|
||||
+ <attribute name="duration"> <data type="double" /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-rsc-action">
|
||||
+ <element name="rsc_action">
|
||||
+ <attribute name="action"> <text /> </attribute>
|
||||
+ <attribute name="resource"> <text /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="blocked"> <data type="boolean" /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="dest"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="next-role"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="reason"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="role"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="source"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-utilization">
|
||||
+ <element name="utilization">
|
||||
+ <attribute name="function"> <text /> </attribute>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <attribute name="resource"> <text /> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <element>
|
||||
+ <anyName />
|
||||
+ <text />
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
diff --git a/xml/api/nodes-2.21.rng b/xml/api/nodes-2.21.rng
|
||||
new file mode 100644
|
||||
index 000000000..df4c77f37
|
||||
--- /dev/null
|
||||
+++ b/xml/api/nodes-2.21.rng
|
||||
@@ -0,0 +1,51 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="element-full-node"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="element-full-node">
|
||||
+ <element name="node">
|
||||
+ <attribute name="name"> <text/> </attribute>
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="online"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="standby"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="standby_onfail"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="maintenance"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="pending"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="unclean"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="health">
|
||||
+ <choice>
|
||||
+ <value>red</value>
|
||||
+ <value>yellow</value>
|
||||
+ <value>green</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ <attribute name="shutdown"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="expected_up"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="is_dc"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="resources_running"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="type">
|
||||
+ <choice>
|
||||
+ <value>unknown</value>
|
||||
+ <value>member</value>
|
||||
+ <value>remote</value>
|
||||
+ <value>ping</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ <optional>
|
||||
+ <!-- for virtualized pacemaker_remote nodes, crm_mon 1.1.13 uses
|
||||
+ "container_id" while later versions use "id_as_resource" -->
|
||||
+ <choice>
|
||||
+ <attribute name="container_id"> <text/> </attribute>
|
||||
+ <attribute name="id_as_resource"> <text/> </attribute>
|
||||
+ </choice>
|
||||
+ </optional>
|
||||
+ <externalRef href="resources-2.4.rng" />
|
||||
+ </element>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,46 @@
|
||||
From 5b6280ac1a213e176aee6d61945b3283ea060a88 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||
Date: Tue, 24 May 2022 18:02:31 +0200
|
||||
Subject: [PATCH] Feature: tools: report CRM feature set of nodes by crm_mon
|
||||
|
||||
Enable crm_mon to report when CRM feature set is not consistent among
|
||||
online nodes and output a version of each node if --show-detail is
|
||||
specified.
|
||||
---
|
||||
xml/api/crm_mon-2.21.rng | 3 +
|
||||
xml/api/nodes-2.21.rng | 3 +
|
||||
9 files changed, 508 insertions(+), 125 deletions(-)
|
||||
create mode 100644 cts/cli/crm_mon-feature_set.xml
|
||||
create mode 100644 cts/cli/regression.feature_set.exp
|
||||
|
||||
diff --git a/xml/api/crm_mon-2.21.rng b/xml/api/crm_mon-2.21.rng
|
||||
index 37036d665..e99bcc3d7 100644
|
||||
--- a/xml/api/crm_mon-2.21.rng
|
||||
+++ b/xml/api/crm_mon-2.21.rng
|
||||
@@ -54,6 +54,9 @@
|
||||
<attribute name="with_quorum"> <data type="boolean" /> </attribute>
|
||||
</group>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <attribute name="mixed_version"> <data type="boolean" /> </attribute>
|
||||
+ </optional>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
diff --git a/xml/api/nodes-2.21.rng b/xml/api/nodes-2.21.rng
|
||||
index df4c77f37..7e236ba63 100644
|
||||
--- a/xml/api/nodes-2.21.rng
|
||||
+++ b/xml/api/nodes-2.21.rng
|
||||
@@ -25,6 +25,9 @@
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <attribute name="feature_set"> <text/> </attribute>
|
||||
+ </optional>
|
||||
<attribute name="shutdown"> <data type="boolean" /> </attribute>
|
||||
<attribute name="expected_up"> <data type="boolean" /> </attribute>
|
||||
<attribute name="is_dc"> <data type="boolean" /> </attribute>
|
||||
--
|
||||
2.31.1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,108 @@
|
||||
From d6294dd28b6d95ad3844824996717f9959d97ac6 Mon Sep 17 00:00:00 2001
|
||||
From: Reid Wahl <nrwahl@protonmail.com>
|
||||
Date: Thu, 30 Jun 2022 11:07:32 -0700
|
||||
Subject: [PATCH 1/2] Fix: Use correct boolean in stonith__validate_agent_xml
|
||||
|
||||
This fixes a regression introduced by 91a2b2e that flips the boolean
|
||||
values for "valid" in the XML output.
|
||||
|
||||
Resolves: RHBZ#2102292 (partial)
|
||||
|
||||
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
||||
---
|
||||
lib/fencing/st_output.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
|
||||
index e0ff848c2..eb10ad0c5 100644
|
||||
--- a/lib/fencing/st_output.c
|
||||
+++ b/lib/fencing/st_output.c
|
||||
@@ -528,10 +528,9 @@ validate_agent_xml(pcmk__output_t *out, va_list args) {
|
||||
char *error_output = va_arg(args, char *);
|
||||
int rc = va_arg(args, int);
|
||||
|
||||
- xmlNodePtr node = pcmk__output_create_xml_node(out, "validate",
|
||||
- "agent", agent,
|
||||
- "valid", pcmk__btoa(rc),
|
||||
- NULL);
|
||||
+ xmlNodePtr node = pcmk__output_create_xml_node(
|
||||
+ out, "validate", "agent", agent, "valid", pcmk__btoa(rc == pcmk_ok),
|
||||
+ NULL);
|
||||
|
||||
if (device != NULL) {
|
||||
crm_xml_add(node, "device", device);
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 81e83683e69b4f147f40f5353f8e68032758a104 Mon Sep 17 00:00:00 2001
|
||||
From: Reid Wahl <nrwahl@protonmail.com>
|
||||
Date: Wed, 29 Jun 2022 18:15:33 -0700
|
||||
Subject: [PATCH 2/2] Fix: Use failed action result in rhcs_validate and
|
||||
_get_metadata
|
||||
|
||||
If an action failed but has a non-NULL result, get the rc and other
|
||||
attributes from that result.
|
||||
|
||||
This fixes a regression introduced by b441925, in which failure XML
|
||||
output now contains a CRM_EX_CONNECTED rc instead of the correct one and
|
||||
does not contain stdout/stderr. That commit caused
|
||||
services__execute_file() to return a proper rc instead of TRUE. A
|
||||
non-pcmk_ok bubbled up the call chain causing
|
||||
internal_stonith_action_execute() to return -ECONNABORTED. Then
|
||||
rhcs_validate() and _get_metadata() would use this rc instead of the one
|
||||
attached to the result.
|
||||
|
||||
Resolves: RHBZ#2102292
|
||||
|
||||
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
||||
---
|
||||
lib/fencing/st_rhcs.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/fencing/st_rhcs.c b/lib/fencing/st_rhcs.c
|
||||
index 39485013e..029c97eea 100644
|
||||
--- a/lib/fencing/st_rhcs.c
|
||||
+++ b/lib/fencing/st_rhcs.c
|
||||
@@ -130,16 +130,15 @@ stonith__rhcs_get_metadata(const char *agent, int timeout, xmlNode **metadata)
|
||||
stonith_action_t *action = stonith_action_create(agent, "metadata", NULL, 0,
|
||||
5, NULL, NULL, NULL);
|
||||
int rc = stonith__execute(action);
|
||||
+ result = stonith__action_result(action);
|
||||
|
||||
- if (rc < 0) {
|
||||
+ if (rc < 0 && result == NULL) {
|
||||
crm_warn("Could not execute metadata action for %s: %s "
|
||||
CRM_XS " rc=%d", agent, pcmk_strerror(rc), rc);
|
||||
stonith__destroy_action(action);
|
||||
return rc;
|
||||
}
|
||||
|
||||
- result = stonith__action_result(action);
|
||||
-
|
||||
if (result->execution_status != PCMK_EXEC_DONE) {
|
||||
crm_warn("Could not execute metadata action for %s: %s",
|
||||
agent, pcmk_exec_status_str(result->execution_status));
|
||||
@@ -262,6 +261,7 @@ stonith__rhcs_validate(stonith_t *st, int call_options, const char *target,
|
||||
int remaining_timeout = timeout;
|
||||
xmlNode *metadata = NULL;
|
||||
stonith_action_t *action = NULL;
|
||||
+ pcmk__action_result_t *result = NULL;
|
||||
|
||||
if (host_arg == NULL) {
|
||||
time_t start_time = time(NULL);
|
||||
@@ -298,9 +298,9 @@ stonith__rhcs_validate(stonith_t *st, int call_options, const char *target,
|
||||
NULL, host_arg);
|
||||
|
||||
rc = stonith__execute(action);
|
||||
- if (rc == pcmk_ok) {
|
||||
- pcmk__action_result_t *result = stonith__action_result(action);
|
||||
+ result = stonith__action_result(action);
|
||||
|
||||
+ if (result != NULL) {
|
||||
rc = pcmk_rc2legacy(stonith__result2rc(result));
|
||||
|
||||
// Take ownership of output so stonith__destroy_action() doesn't free it
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,34 @@
|
||||
From e4d9c795dfe2d6737c777a265292864da98dae8f Mon Sep 17 00:00:00 2001
|
||||
From: Reid Wahl <nrwahl@protonmail.com>
|
||||
Date: Thu, 30 Jun 2022 14:40:31 -0700
|
||||
Subject: [PATCH] Low: Always null-check result in stonith__rhcs_get_metadata
|
||||
|
||||
Null-check result even if rc == 0.
|
||||
|
||||
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
||||
---
|
||||
lib/fencing/st_rhcs.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/fencing/st_rhcs.c b/lib/fencing/st_rhcs.c
|
||||
index 029c97eea..dfccff2cb 100644
|
||||
--- a/lib/fencing/st_rhcs.c
|
||||
+++ b/lib/fencing/st_rhcs.c
|
||||
@@ -132,9 +132,11 @@ stonith__rhcs_get_metadata(const char *agent, int timeout, xmlNode **metadata)
|
||||
int rc = stonith__execute(action);
|
||||
result = stonith__action_result(action);
|
||||
|
||||
- if (rc < 0 && result == NULL) {
|
||||
- crm_warn("Could not execute metadata action for %s: %s "
|
||||
- CRM_XS " rc=%d", agent, pcmk_strerror(rc), rc);
|
||||
+ if (result == NULL) {
|
||||
+ if (rc < 0) {
|
||||
+ crm_warn("Could not execute metadata action for %s: %s "
|
||||
+ CRM_XS " rc=%d", agent, pcmk_strerror(rc), rc);
|
||||
+ }
|
||||
stonith__destroy_action(action);
|
||||
return rc;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,94 @@
|
||||
From d00a6abde7e6a41f8bc6085c875cb8072aff499b Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 30 Jun 2022 09:25:05 -0400
|
||||
Subject: [PATCH 1/2] Fix: libstonithd: Add the "Agent not found..." message to
|
||||
formatted output.
|
||||
|
||||
---
|
||||
lib/fencing/st_client.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
|
||||
index 137642af7..971bbe9a5 100644
|
||||
--- a/lib/fencing/st_client.c
|
||||
+++ b/lib/fencing/st_client.c
|
||||
@@ -1763,9 +1763,14 @@ stonith_api_validate(stonith_t *st, int call_options, const char *rsc_id,
|
||||
default:
|
||||
rc = -EINVAL;
|
||||
errno = EINVAL;
|
||||
- crm_perror(LOG_ERR,
|
||||
- "Agent %s not found or does not support validation",
|
||||
- agent);
|
||||
+
|
||||
+ if (error_output) {
|
||||
+ *error_output = crm_strdup_printf("Agent %s not found or does not support validation",
|
||||
+ agent);
|
||||
+ } else {
|
||||
+ crm_err("Agent %s not found or does not support validation", agent);
|
||||
+ }
|
||||
+
|
||||
break;
|
||||
}
|
||||
g_hash_table_destroy(params_table);
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From f3a5fc961c30556b975011773e4cebf323bec38e Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Fri, 1 Jul 2022 10:38:45 -0400
|
||||
Subject: [PATCH 2/2] Refactor: libstonithd: Split apart error conditions when
|
||||
validating.
|
||||
|
||||
The "not found" and "can't validate" cases were previously jumbled
|
||||
together. Now, return ENOENT if the agent is not found and EOPNOTSUPP
|
||||
if it can't validate. The only caller appears to be handling both cases
|
||||
correctly already, so no changes are needed there.
|
||||
---
|
||||
lib/fencing/st_client.c | 21 +++++++++++++++++----
|
||||
1 file changed, 17 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
|
||||
index 971bbe9a5..192334812 100644
|
||||
--- a/lib/fencing/st_client.c
|
||||
+++ b/lib/fencing/st_client.c
|
||||
@@ -1760,19 +1760,32 @@ stonith_api_validate(stonith_t *st, int call_options, const char *rsc_id,
|
||||
break;
|
||||
#endif
|
||||
|
||||
+ case st_namespace_invalid:
|
||||
+ errno = ENOENT;
|
||||
+ rc = -errno;
|
||||
+
|
||||
+ if (error_output) {
|
||||
+ *error_output = crm_strdup_printf("Agent %s not found", agent);
|
||||
+ } else {
|
||||
+ crm_err("Agent %s not found", agent);
|
||||
+ }
|
||||
+
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
- rc = -EINVAL;
|
||||
- errno = EINVAL;
|
||||
+ errno = EOPNOTSUPP;
|
||||
+ rc = -errno;
|
||||
|
||||
if (error_output) {
|
||||
- *error_output = crm_strdup_printf("Agent %s not found or does not support validation",
|
||||
+ *error_output = crm_strdup_printf("Agent %s does not support validation",
|
||||
agent);
|
||||
} else {
|
||||
- crm_err("Agent %s not found or does not support validation", agent);
|
||||
+ crm_err("Agent %s does not support validation", agent);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
+
|
||||
g_hash_table_destroy(params_table);
|
||||
return rc;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,47 @@
|
||||
From e5f80059c7f1c0ad3264dc2a2a61e64cded0fe0f Mon Sep 17 00:00:00 2001
|
||||
From: Hideo Yamauchi <renayama19661014@ybb.ne.jp>
|
||||
Date: Tue, 12 Jul 2022 14:45:55 +0900
|
||||
Subject: [PATCH] High: scheduler: Resolves an issue where STONITH devices
|
||||
cannot be registered.
|
||||
|
||||
---
|
||||
lib/pacemaker/pcmk_sched_allocate.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/lib/pacemaker/pcmk_sched_allocate.c b/lib/pacemaker/pcmk_sched_allocate.c
|
||||
index 85df6ace8..a7fe9c8d6 100644
|
||||
--- a/lib/pacemaker/pcmk_sched_allocate.c
|
||||
+++ b/lib/pacemaker/pcmk_sched_allocate.c
|
||||
@@ -724,12 +724,18 @@ log_unrunnable_actions(pe_working_set_t *data_set)
|
||||
static void
|
||||
unpack_cib(xmlNode *cib, unsigned long long flags, pe_working_set_t *data_set)
|
||||
{
|
||||
+ const char* localhost_save = NULL;
|
||||
+
|
||||
if (pcmk_is_set(data_set->flags, pe_flag_have_status)) {
|
||||
crm_trace("Reusing previously calculated cluster status");
|
||||
pe__set_working_set_flags(data_set, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (data_set->localhost) {
|
||||
+ localhost_save = data_set->localhost;
|
||||
+ }
|
||||
+
|
||||
CRM_ASSERT(cib != NULL);
|
||||
crm_trace("Calculating cluster status");
|
||||
|
||||
@@ -740,6 +746,10 @@ unpack_cib(xmlNode *cib, unsigned long long flags, pe_working_set_t *data_set)
|
||||
*/
|
||||
set_working_set_defaults(data_set);
|
||||
|
||||
+ if (localhost_save) {
|
||||
+ data_set->localhost = localhost_save;
|
||||
+ }
|
||||
+
|
||||
pe__set_working_set_flags(data_set, flags);
|
||||
data_set->input = cib;
|
||||
cluster_status(data_set); // Sets pe_flag_have_status
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,178 @@
|
||||
From b1094468ab0f7c6d2f5b457b721f3a852a9cae2c Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Thu, 14 Jul 2022 13:09:51 +0200
|
||||
Subject: [PATCH 1/2] Fix: do unfencing equally for cluster-nodes & remotes
|
||||
|
||||
Fixes T28
|
||||
---
|
||||
lib/pengine/utils.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c
|
||||
index 0c2eb3c16..83f76cccf 100644
|
||||
--- a/lib/pengine/utils.c
|
||||
+++ b/lib/pengine/utils.c
|
||||
@@ -1201,12 +1201,8 @@ pe_fence_op(pe_node_t * node, const char *op, bool optional, const char *reason,
|
||||
add_hash_param(stonith_op->meta, XML_LRM_ATTR_TARGET_UUID, node->details->id);
|
||||
add_hash_param(stonith_op->meta, "stonith_action", op);
|
||||
|
||||
- if (pe__is_guest_or_remote_node(node)
|
||||
- && pcmk_is_set(data_set->flags, pe_flag_enable_unfencing)) {
|
||||
- /* Extra work to detect device changes on remotes
|
||||
- *
|
||||
- * We may do this for all nodes in the future, but for now
|
||||
- * the pcmk__check_action_config() based stuff works fine.
|
||||
+ if (pcmk_is_set(data_set->flags, pe_flag_enable_unfencing)) {
|
||||
+ /* Extra work to detect device changes
|
||||
*/
|
||||
long max = 1024;
|
||||
long digests_all_offset = 0;
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From f5db6e2c94273623a49f36f1bdb6c39315c53cab Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Thu, 14 Jul 2022 11:29:05 +0200
|
||||
Subject: [PATCH 2/2] Test: cts-scheduler: update expected output for changes
|
||||
in unfencing
|
||||
|
||||
---
|
||||
cts/scheduler/exp/start-then-stop-with-unfence.exp | 2 +-
|
||||
cts/scheduler/exp/unfence-definition.exp | 6 +++---
|
||||
cts/scheduler/exp/unfence-device.exp | 6 +++---
|
||||
cts/scheduler/exp/unfence-parameters.exp | 6 +++---
|
||||
cts/scheduler/exp/unfence-startup.exp | 4 ++--
|
||||
5 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/cts/scheduler/exp/start-then-stop-with-unfence.exp b/cts/scheduler/exp/start-then-stop-with-unfence.exp
|
||||
index b1868586f..69cfb63de 100644
|
||||
--- a/cts/scheduler/exp/start-then-stop-with-unfence.exp
|
||||
+++ b/cts/scheduler/exp/start-then-stop-with-unfence.exp
|
||||
@@ -151,7 +151,7 @@
|
||||
<synapse id="11">
|
||||
<action_set>
|
||||
<crm_event id="5" operation="stonith" operation_key="stonith-rhel7-node1.example.com-on" on_node="rhel7-node1.example.com" on_node_uuid="1">
|
||||
- <attributes CRM_meta_on_node="rhel7-node1.example.com" CRM_meta_on_node_uuid="1" CRM_meta_probe_complete="true" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="mpath-node1:fence_mpath:019ed48e26413030411da3ae8888a649,mpath-node2:fence_mpath:b97ef86afabe0426040d1bef247023ee," CRM_meta_digests_secure="mpath-node1:fence_mpath:21f9562fe6837f7357aab98ba69f71fb,mpath-node2:fence_mpath:563e5d6a67b7dcdb65d2f0325aed9fc1," CRM_meta_on_node="rhel7-node1.example.com" CRM_meta_on_node_uuid="1" CRM_meta_probe_complete="true" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs/>
|
||||
diff --git a/cts/scheduler/exp/unfence-definition.exp b/cts/scheduler/exp/unfence-definition.exp
|
||||
index 840a8d212..6a098ed3c 100644
|
||||
--- a/cts/scheduler/exp/unfence-definition.exp
|
||||
+++ b/cts/scheduler/exp/unfence-definition.exp
|
||||
@@ -373,7 +373,7 @@
|
||||
<synapse id="22">
|
||||
<action_set>
|
||||
<crm_event id="29" operation="stonith" operation_key="stonith-virt-4-reboot" on_node="virt-4" on_node_uuid="4">
|
||||
- <attributes CRM_meta_on_node="virt-4" CRM_meta_on_node_uuid="4" CRM_meta_stonith_action="reboot" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-4" CRM_meta_on_node_uuid="4" CRM_meta_stonith_action="reboot" />
|
||||
<downed>
|
||||
<node id="4"/>
|
||||
</downed>
|
||||
@@ -384,7 +384,7 @@
|
||||
<synapse id="23">
|
||||
<action_set>
|
||||
<crm_event id="3" operation="stonith" operation_key="stonith-virt-3-on" on_node="virt-3" on_node_uuid="3">
|
||||
- <attributes CRM_meta_on_node="virt-3" CRM_meta_on_node_uuid="3" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-3" CRM_meta_on_node_uuid="3" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs/>
|
||||
@@ -392,7 +392,7 @@
|
||||
<synapse id="24">
|
||||
<action_set>
|
||||
<crm_event id="1" operation="stonith" operation_key="stonith-virt-1-on" on_node="virt-1" on_node_uuid="1">
|
||||
- <attributes CRM_meta_on_node="virt-1" CRM_meta_on_node_uuid="1" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-1" CRM_meta_on_node_uuid="1" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs>
|
||||
diff --git a/cts/scheduler/exp/unfence-device.exp b/cts/scheduler/exp/unfence-device.exp
|
||||
index a39fc758f..452351d98 100644
|
||||
--- a/cts/scheduler/exp/unfence-device.exp
|
||||
+++ b/cts/scheduler/exp/unfence-device.exp
|
||||
@@ -76,7 +76,7 @@
|
||||
<synapse id="5">
|
||||
<action_set>
|
||||
<crm_event id="6" operation="stonith" operation_key="stonith-virt-013-on" on_node="virt-013" on_node_uuid="3">
|
||||
- <attributes CRM_meta_on_node="virt-013" CRM_meta_on_node_uuid="3" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fence_scsi:fence_scsi:5950f402238c1e5058a556fe39bb09de," CRM_meta_digests_secure="fence_scsi:fence_scsi:a911b9a554cdc5844d863a91b1ef283a," CRM_meta_on_node="virt-013" CRM_meta_on_node_uuid="3" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs/>
|
||||
@@ -84,7 +84,7 @@
|
||||
<synapse id="6">
|
||||
<action_set>
|
||||
<crm_event id="4" operation="stonith" operation_key="stonith-virt-009-on" on_node="virt-009" on_node_uuid="2">
|
||||
- <attributes CRM_meta_on_node="virt-009" CRM_meta_on_node_uuid="2" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fence_scsi:fence_scsi:5950f402238c1e5058a556fe39bb09de," CRM_meta_digests_secure="fence_scsi:fence_scsi:a911b9a554cdc5844d863a91b1ef283a," CRM_meta_on_node="virt-009" CRM_meta_on_node_uuid="2" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs/>
|
||||
@@ -92,7 +92,7 @@
|
||||
<synapse id="7">
|
||||
<action_set>
|
||||
<crm_event id="2" operation="stonith" operation_key="stonith-virt-008-on" on_node="virt-008" on_node_uuid="1">
|
||||
- <attributes CRM_meta_on_node="virt-008" CRM_meta_on_node_uuid="1" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fence_scsi:fence_scsi:5950f402238c1e5058a556fe39bb09de," CRM_meta_digests_secure="fence_scsi:fence_scsi:a911b9a554cdc5844d863a91b1ef283a," CRM_meta_on_node="virt-008" CRM_meta_on_node_uuid="1" CRM_meta_shutdown="0" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs/>
|
||||
diff --git a/cts/scheduler/exp/unfence-parameters.exp b/cts/scheduler/exp/unfence-parameters.exp
|
||||
index 3e70cb8e9..268bf008e 100644
|
||||
--- a/cts/scheduler/exp/unfence-parameters.exp
|
||||
+++ b/cts/scheduler/exp/unfence-parameters.exp
|
||||
@@ -357,7 +357,7 @@
|
||||
<synapse id="21">
|
||||
<action_set>
|
||||
<crm_event id="28" operation="stonith" operation_key="stonith-virt-4-reboot" on_node="virt-4" on_node_uuid="4">
|
||||
- <attributes CRM_meta_on_node="virt-4" CRM_meta_on_node_uuid="4" CRM_meta_stonith_action="reboot" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-4" CRM_meta_on_node_uuid="4" CRM_meta_stonith_action="reboot" />
|
||||
<downed>
|
||||
<node id="4"/>
|
||||
</downed>
|
||||
@@ -368,7 +368,7 @@
|
||||
<synapse id="22">
|
||||
<action_set>
|
||||
<crm_event id="3" operation="stonith" operation_key="stonith-virt-3-on" on_node="virt-3" on_node_uuid="3">
|
||||
- <attributes CRM_meta_on_node="virt-3" CRM_meta_on_node_uuid="3" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-3" CRM_meta_on_node_uuid="3" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs/>
|
||||
@@ -376,7 +376,7 @@
|
||||
<synapse id="23">
|
||||
<action_set>
|
||||
<crm_event id="1" operation="stonith" operation_key="stonith-virt-1-on" on_node="virt-1" on_node_uuid="1">
|
||||
- <attributes CRM_meta_on_node="virt-1" CRM_meta_on_node_uuid="1" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-1" CRM_meta_on_node_uuid="1" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs>
|
||||
diff --git a/cts/scheduler/exp/unfence-startup.exp b/cts/scheduler/exp/unfence-startup.exp
|
||||
index 6745bff4b..f2d38e80c 100644
|
||||
--- a/cts/scheduler/exp/unfence-startup.exp
|
||||
+++ b/cts/scheduler/exp/unfence-startup.exp
|
||||
@@ -173,7 +173,7 @@
|
||||
<synapse id="11">
|
||||
<action_set>
|
||||
<crm_event id="28" operation="stonith" operation_key="stonith-virt-4-reboot" on_node="virt-4" on_node_uuid="4">
|
||||
- <attributes CRM_meta_on_node="virt-4" CRM_meta_on_node_uuid="4" CRM_meta_stonith_action="reboot" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-4" CRM_meta_on_node_uuid="4" CRM_meta_stonith_action="reboot" />
|
||||
<downed>
|
||||
<node id="4"/>
|
||||
</downed>
|
||||
@@ -184,7 +184,7 @@
|
||||
<synapse id="12">
|
||||
<action_set>
|
||||
<crm_event id="3" operation="stonith" operation_key="stonith-virt-3-on" on_node="virt-3" on_node_uuid="3">
|
||||
- <attributes CRM_meta_on_node="virt-3" CRM_meta_on_node_uuid="3" CRM_meta_stonith_action="on" />
|
||||
+ <attributes CRM_meta_digests_all="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_digests_secure="fencing:fence_scsi:f2317cad3d54cec5d7d7aa7d0bf35cf8," CRM_meta_on_node="virt-3" CRM_meta_on_node_uuid="3" CRM_meta_stonith_action="on" />
|
||||
</crm_event>
|
||||
</action_set>
|
||||
<inputs/>
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,38 @@
|
||||
From fe9150bc4b740b3748fec34fe668df4f8c0d0e25 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Tue, 9 Aug 2022 15:38:03 -0500
|
||||
Subject: [PATCH] Fix: tools: correct minimum execution status shown by
|
||||
crm_resource -O
|
||||
|
||||
regression introduced in 2.1.0 by 5ef28b946
|
||||
|
||||
Fixes T533
|
||||
---
|
||||
lib/pengine/pe_output.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
|
||||
index 5d716fe6cb..dbb49637c9 100644
|
||||
--- a/lib/pengine/pe_output.c
|
||||
+++ b/lib/pengine/pe_output.c
|
||||
@@ -1878,7 +1878,7 @@ node_and_op(pcmk__output_t *out, va_list args) {
|
||||
time_t last_change = 0;
|
||||
|
||||
pcmk__scan_min_int(crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS),
|
||||
- &status, 0);
|
||||
+ &status, PCMK_EXEC_UNKNOWN);
|
||||
|
||||
rsc = pe_find_resource(data_set->resources, op_rsc);
|
||||
|
||||
@@ -1932,7 +1932,7 @@ node_and_op_xml(pcmk__output_t *out, va_list args) {
|
||||
xmlNode *node = NULL;
|
||||
|
||||
pcmk__scan_min_int(crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS),
|
||||
- &status, 0);
|
||||
+ &status, PCMK_EXEC_UNKNOWN);
|
||||
node = pcmk__output_create_xml_node(out, "operation",
|
||||
"op", op_key ? op_key : ID(xml_op),
|
||||
"node", crm_element_value(xml_op, XML_ATTR_UNAME),
|
||||
--
|
||||
2.31.1
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue