commit 328a55940b3e1f6b4b12247aa4006dd810f600f7 Author: MSVSphere Packaging Team Date: Fri Mar 17 16:11:13 2023 +0300 import pacemaker-2.1.4-5.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66cdb0e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz +SOURCES/pacemaker-dc6eb4362.tar.gz diff --git a/.pacemaker.metadata b/.pacemaker.metadata new file mode 100644 index 0000000..315149b --- /dev/null +++ b/.pacemaker.metadata @@ -0,0 +1,2 @@ +2cbec94ad67dfbeba75e38d2c3c5c44961b3cd16 SOURCES/nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz +24ccc9f234896595a1f7a8baec22652620fd609f SOURCES/pacemaker-dc6eb4362.tar.gz diff --git a/SOURCES/001-stonith-enabled.patch b/SOURCES/001-stonith-enabled.patch new file mode 100644 index 0000000..ebeb650 --- /dev/null +++ b/SOURCES/001-stonith-enabled.patch @@ -0,0 +1,127 @@ +From 243139b2ec0f6b17877a4e7f651fc3f70f76b11a Mon Sep 17 00:00:00 2001 +From: Christine Caulfield +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 +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 + diff --git a/SOURCES/002-acl_group.patch b/SOURCES/002-acl_group.patch new file mode 100644 index 0000000..3114887 --- /dev/null +++ b/SOURCES/002-acl_group.patch @@ -0,0 +1,425 @@ +From 80c64be80f2bffdcf5d2432e1e59d633fd68d516 Mon Sep 17 00:00:00 2001 +From: Grace Chin +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 + #include + #include ++#include + + #include + +@@ -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 +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 + #include + #include ++#include + + #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 + #include + #include ++#include + + /* 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 ++#include ++#include "../../crmcommon_private.h" ++ ++#include "mock_private.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++// 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 +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 +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 + diff --git a/SOURCES/003-regression.patch b/SOURCES/003-regression.patch new file mode 100644 index 0000000..0185c2d --- /dev/null +++ b/SOURCES/003-regression.patch @@ -0,0 +1,88 @@ +From 9853f4d05a376062d60f2e4c90938e587992237b Mon Sep 17 00:00:00 2001 +From: Chris Lumens +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 +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 + + =#=#=#= 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 =#=#=#= + +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 + diff --git a/SOURCES/004-schema.patch b/SOURCES/004-schema.patch new file mode 100644 index 0000000..2632a9d --- /dev/null +++ b/SOURCES/004-schema.patch @@ -0,0 +1,624 @@ +From e8f96dec79bb33c11d39c9037ac623f18a67b539 Mon Sep 17 00:00:00 2001 +From: Petr Pavlu +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 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ granted ++ revoked ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +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 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +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 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ red ++ yellow ++ green ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ unknown ++ member ++ remote ++ ping ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +-- +2.31.1 + diff --git a/SOURCES/005-schema.patch b/SOURCES/005-schema.patch new file mode 100644 index 0000000..57f6309 --- /dev/null +++ b/SOURCES/005-schema.patch @@ -0,0 +1,46 @@ +From 5b6280ac1a213e176aee6d61945b3283ea060a88 Mon Sep 17 00:00:00 2001 +From: Petr Pavlu +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 @@ + + + ++ ++ ++ + + + +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 @@ + + + ++ ++ ++ + + + +-- +2.31.1 + diff --git a/SOURCES/006-crm_resource.patch b/SOURCES/006-crm_resource.patch new file mode 100644 index 0000000..577264b --- /dev/null +++ b/SOURCES/006-crm_resource.patch @@ -0,0 +1,1686 @@ +From a467f0953c61bd56a9b34a98c71855d3cfbf6ba4 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 5 Apr 2022 16:26:30 -0500 +Subject: [PATCH 01/14] Refactor: tools: use a flag to indicate locked + resources in crm_resource + +... to make the handling consistent with other checks. This also allows some of +the code to be simplified. +--- + tools/crm_resource.h | 13 +++++++++---- + tools/crm_resource_print.c | 21 ++++++++------------- + tools/crm_resource_runtime.c | 7 +++---- + 3 files changed, 20 insertions(+), 21 deletions(-) + +diff --git a/tools/crm_resource.h b/tools/crm_resource.h +index 71a978893..b5fdd1bb5 100644 +--- a/tools/crm_resource.h ++++ b/tools/crm_resource.h +@@ -8,6 +8,10 @@ + */ + + #include ++ ++#include ++#include ++ + #include + + #include +@@ -31,13 +35,14 @@ typedef struct node_info_s { + enum resource_check_flags { + rsc_remain_stopped = (1 << 0), + rsc_unpromotable = (1 << 1), +- rsc_unmanaged = (1 << 2) ++ rsc_unmanaged = (1 << 2), ++ rsc_locked = (1 << 3), + }; + + typedef struct resource_checks_s { +- pe_resource_t *rsc; +- unsigned int flags; +- const char *lock_node; ++ pe_resource_t *rsc; // Resource being checked ++ uint32_t flags; // Group of enum resource_check_flags ++ const char *lock_node; // Node that resource is shutdown-locked to, if any + } resource_checks_t; + + resource_checks_t *cli_check_resource(pe_resource_t *rsc, char *role_s, char *managed); +diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c +index 5abf3df0c..f63fc952d 100644 +--- a/tools/crm_resource_print.c ++++ b/tools/crm_resource_print.c +@@ -450,14 +450,13 @@ resource_check_list_default(pcmk__output_t *out, va_list args) { + resource_checks_t *checks = va_arg(args, resource_checks_t *); + + pe_resource_t *parent = uber_parent(checks->rsc); +- int rc = pcmk_rc_no_output; +- bool printed = false; + +- if (checks->flags != 0 || checks->lock_node != NULL) { +- printed = true; +- out->begin_list(out, NULL, NULL, "Resource Checks"); ++ if (checks->flags == 0) { ++ return pcmk_rc_no_output; + } + ++ out->begin_list(out, NULL, NULL, "Resource Checks"); ++ + if (pcmk_is_set(checks->flags, rsc_remain_stopped)) { + out->list_item(out, "check", "Configuration specifies '%s' should remain stopped", + parent->id); +@@ -473,17 +472,13 @@ resource_check_list_default(pcmk__output_t *out, va_list args) { + parent->id); + } + +- if (checks->lock_node) { ++ if (pcmk_is_set(checks->flags, rsc_locked)) { + out->list_item(out, "check", "'%s' is locked to node %s due to shutdown", + parent->id, checks->lock_node); + } + +- if (printed) { +- out->end_list(out); +- rc = pcmk_rc_ok; +- } +- +- return rc; ++ out->end_list(out); ++ return pcmk_rc_ok; + } + + PCMK__OUTPUT_ARGS("resource-check-list", "resource_checks_t *") +@@ -509,7 +504,7 @@ resource_check_list_xml(pcmk__output_t *out, va_list args) { + pcmk__xe_set_bool_attr(node, "unmanaged", true); + } + +- if (checks->lock_node) { ++ if (pcmk_is_set(checks->flags, rsc_locked)) { + crm_xml_add(node, "locked-to", checks->lock_node); + } + +diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c +index 9e7e1fe74..b5bccadaf 100644 +--- a/tools/crm_resource_runtime.c ++++ b/tools/crm_resource_runtime.c +@@ -36,7 +36,8 @@ cli_check_resource(pe_resource_t *rsc, char *role_s, char *managed) + rc->flags |= rsc_unmanaged; + } + +- if (rsc->lock_node) { ++ if (rsc->lock_node != NULL) { ++ rc->flags |= rsc_locked; + rc->lock_node = rsc->lock_node->details->uname; + } + +@@ -914,9 +915,7 @@ cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc) + + checks = cli_check_resource(rsc, role_s, managed); + +- if (checks->flags != 0 || checks->lock_node != NULL) { +- rc = out->message(out, "resource-check-list", checks); +- } ++ rc = out->message(out, "resource-check-list", checks); + + free(role_s); + free(managed); +-- +2.31.1 + + +From 7f8f94d0a1086e592e39f3a1a812b1a65225c09b Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 5 Apr 2022 16:48:03 -0500 +Subject: [PATCH 02/14] Refactor: tools: functionize individual resource checks + in crm_resource + +... rather than have one check-everything function, to make the code simpler +and more readable. +--- + tools/crm_resource_runtime.c | 101 ++++++++++++++++++++--------------- + 1 file changed, 57 insertions(+), 44 deletions(-) + +diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c +index b5bccadaf..d47f959f5 100644 +--- a/tools/crm_resource_runtime.c ++++ b/tools/crm_resource_runtime.c +@@ -15,36 +15,6 @@ + #include + #include + +-resource_checks_t * +-cli_check_resource(pe_resource_t *rsc, char *role_s, char *managed) +-{ +- pe_resource_t *parent = uber_parent(rsc); +- resource_checks_t *rc = calloc(1, sizeof(resource_checks_t)); +- +- if (role_s) { +- enum rsc_role_e role = text2role(role_s); +- +- if (role == RSC_ROLE_STOPPED) { +- rc->flags |= rsc_remain_stopped; +- } else if (pcmk_is_set(parent->flags, pe_rsc_promotable) && +- (role == RSC_ROLE_UNPROMOTED)) { +- rc->flags |= rsc_unpromotable; +- } +- } +- +- if (managed && !crm_is_true(managed)) { +- rc->flags |= rsc_unmanaged; +- } +- +- if (rsc->lock_node != NULL) { +- rc->flags |= rsc_locked; +- rc->lock_node = rsc->lock_node->details->uname; +- } +- +- rc->rsc = rsc; +- return rc; +-} +- + static GList * + build_node_info_list(pe_resource_t *rsc) + { +@@ -898,29 +868,72 @@ cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name, + return rc; + } + +-int +-cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc) ++static void ++check_role(pcmk__output_t *out, cib_t *cib_conn, resource_checks_t *checks) + { + char *role_s = NULL; +- char *managed = NULL; +- pe_resource_t *parent = uber_parent(rsc); +- int rc = pcmk_rc_no_output; +- resource_checks_t *checks = NULL; +- +- find_resource_attr(out, cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, +- NULL, NULL, NULL, XML_RSC_ATTR_MANAGED, &managed); ++ pe_resource_t *parent = uber_parent(checks->rsc); + + find_resource_attr(out, cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, + NULL, NULL, NULL, XML_RSC_ATTR_TARGET_ROLE, &role_s); ++ if (role_s == NULL) { ++ return; ++ } + +- checks = cli_check_resource(rsc, role_s, managed); ++ switch (text2role(role_s)) { ++ case RSC_ROLE_STOPPED: ++ checks->flags |= rsc_remain_stopped; ++ break; + +- rc = out->message(out, "resource-check-list", checks); ++ case RSC_ROLE_UNPROMOTED: ++ if (pcmk_is_set(parent->flags, pe_rsc_promotable)) { ++ checks->flags |= rsc_unpromotable; ++ } ++ break; + ++ default: ++ break; ++ } + free(role_s); +- free(managed); +- free(checks); +- return rc; ++} ++ ++static void ++check_managed(pcmk__output_t *out, cib_t *cib_conn, resource_checks_t *checks) ++{ ++ char *managed_s = NULL; ++ pe_resource_t *parent = uber_parent(checks->rsc); ++ ++ find_resource_attr(out, cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, ++ NULL, NULL, NULL, XML_RSC_ATTR_MANAGED, &managed_s); ++ if (managed_s == NULL) { ++ return; ++ } ++ ++ if (!crm_is_true(managed_s)) { ++ checks->flags |= rsc_unmanaged; ++ } ++ free(managed_s); ++} ++ ++static void ++check_locked(resource_checks_t *checks) ++{ ++ if (checks->rsc->lock_node != NULL) { ++ checks->flags |= rsc_locked; ++ checks->lock_node = checks->rsc->lock_node->details->uname; ++ } ++} ++ ++int ++cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc) ++{ ++ resource_checks_t checks = { .rsc = rsc }; ++ ++ check_role(out, cib_conn, &checks); ++ check_managed(out, cib_conn, &checks); ++ check_locked(&checks); ++ ++ return out->message(out, "resource-check-list", &checks); + } + + // \return Standard Pacemaker return code +-- +2.31.1 + + +From 32414475281d909cd808f723a41d88a5e0d2b254 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 5 Apr 2022 17:11:07 -0500 +Subject: [PATCH 03/14] Fix: tools: crm_resource target-role check should use + meta-attribute table + +Previously, check_role() searched the CIB for the uber-parent's target-role +attribute. That could give incorrect results if target-role was set on a +different resource in the ancestry chain (e.g. the resource itself for a group +member, or the group for a cloned group), or if there were multiple target-role +settings (e.g. using rules). + +Now, target-role is checked in rsc->meta, which should be fully evaluated for +inheritance and rules. +--- + tools/crm_resource_runtime.c | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c +index d47f959f5..e9d05cb77 100644 +--- a/tools/crm_resource_runtime.c ++++ b/tools/crm_resource_runtime.c +@@ -869,24 +869,22 @@ cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name, + } + + static void +-check_role(pcmk__output_t *out, cib_t *cib_conn, resource_checks_t *checks) ++check_role(resource_checks_t *checks) + { +- char *role_s = NULL; +- pe_resource_t *parent = uber_parent(checks->rsc); ++ const char *role_s = g_hash_table_lookup(checks->rsc->meta, ++ XML_RSC_ATTR_TARGET_ROLE); + +- find_resource_attr(out, cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, +- NULL, NULL, NULL, XML_RSC_ATTR_TARGET_ROLE, &role_s); + if (role_s == NULL) { + return; + } +- + switch (text2role(role_s)) { + case RSC_ROLE_STOPPED: + checks->flags |= rsc_remain_stopped; + break; + + case RSC_ROLE_UNPROMOTED: +- if (pcmk_is_set(parent->flags, pe_rsc_promotable)) { ++ if (pcmk_is_set(uber_parent(checks->rsc)->flags, ++ pe_rsc_promotable)) { + checks->flags |= rsc_unpromotable; + } + break; +@@ -894,7 +892,6 @@ check_role(pcmk__output_t *out, cib_t *cib_conn, resource_checks_t *checks) + default: + break; + } +- free(role_s); + } + + static void +@@ -929,7 +926,7 @@ cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc) + { + resource_checks_t checks = { .rsc = rsc }; + +- check_role(out, cib_conn, &checks); ++ check_role(&checks); + check_managed(out, cib_conn, &checks); + check_locked(&checks); + +-- +2.31.1 + + +From 0fd133680f7b2c25a946cf3fb25f4ee9ffeeaf93 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 5 Apr 2022 17:15:43 -0500 +Subject: [PATCH 04/14] Fix: tools: crm_resource is-managed check should use + meta-attribute table + +Previously, check_managed() searched the CIB for the uber-parent's is-managed +attribute. That could give incorrect results if is-managed was set on a +different resource in the ancestry chain (e.g. the resource itself for a group +member, or the group for a cloned group), or if there were multiple is-managed +settings (e.g. using rules). + +Now, is-managed is checked in rsc->meta, which should be fully evaluated for +inheritance and rules. +--- + tools/crm_resource_runtime.c | 17 +++++------------ + 1 file changed, 5 insertions(+), 12 deletions(-) + +diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c +index e9d05cb77..4f62b4b2e 100644 +--- a/tools/crm_resource_runtime.c ++++ b/tools/crm_resource_runtime.c +@@ -895,21 +895,14 @@ check_role(resource_checks_t *checks) + } + + static void +-check_managed(pcmk__output_t *out, cib_t *cib_conn, resource_checks_t *checks) ++check_managed(resource_checks_t *checks) + { +- char *managed_s = NULL; +- pe_resource_t *parent = uber_parent(checks->rsc); ++ const char *managed_s = g_hash_table_lookup(checks->rsc->meta, ++ XML_RSC_ATTR_MANAGED); + +- find_resource_attr(out, cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, +- NULL, NULL, NULL, XML_RSC_ATTR_MANAGED, &managed_s); +- if (managed_s == NULL) { +- return; +- } +- +- if (!crm_is_true(managed_s)) { ++ if ((managed_s != NULL) && !crm_is_true(managed_s)) { + checks->flags |= rsc_unmanaged; + } +- free(managed_s); + } + + static void +@@ -927,7 +920,7 @@ cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc) + resource_checks_t checks = { .rsc = rsc }; + + check_role(&checks); +- check_managed(out, cib_conn, &checks); ++ check_managed(&checks); + check_locked(&checks); + + return out->message(out, "resource-check-list", &checks); +-- +2.31.1 + + +From e9523c1b238492c8cf8b453ba6710f13bf81cd28 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 5 Apr 2022 17:18:44 -0500 +Subject: [PATCH 05/14] Refactor: tools: drop unused argument from + cli_resource_check() + +--- + tools/crm_resource.c | 4 ++-- + tools/crm_resource.h | 2 +- + tools/crm_resource_print.c | 24 ++++++++++++------------ + tools/crm_resource_runtime.c | 2 +- + 4 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/tools/crm_resource.c b/tools/crm_resource.c +index 883563df9..bf5326b40 100644 +--- a/tools/crm_resource.c ++++ b/tools/crm_resource.c +@@ -1019,7 +1019,7 @@ cleanup(pcmk__output_t *out, pe_resource_t *rsc) + + if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) { + // Show any reasons why resource might stay stopped +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + } + + if (rc == pcmk_rc_ok) { +@@ -1326,7 +1326,7 @@ refresh_resource(pcmk__output_t *out, pe_resource_t *rsc) + + if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) { + // Show any reasons why resource might stay stopped +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + } + + if (rc == pcmk_rc_ok) { +diff --git a/tools/crm_resource.h b/tools/crm_resource.h +index b5fdd1bb5..bcff2b5f6 100644 +--- a/tools/crm_resource.h ++++ b/tools/crm_resource.h +@@ -68,7 +68,7 @@ int cli_resource_print_operations(const char *rsc_id, const char *host_uname, + bool active, pe_working_set_t * data_set); + + /* runtime */ +-int cli_resource_check(pcmk__output_t *out, cib_t * cib, pe_resource_t *rsc); ++int cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc); + int cli_resource_fail(pcmk_ipc_api_t *controld_api, const char *host_uname, + const char *rsc_id, pe_working_set_t *data_set); + GList *cli_resource_search(pe_resource_t *rsc, const char *requested_name, +diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c +index f63fc952d..f025cbddd 100644 +--- a/tools/crm_resource_print.c ++++ b/tools/crm_resource_print.c +@@ -587,7 +587,7 @@ PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t + static int + resource_reasons_list_default(pcmk__output_t *out, va_list args) + { +- cib_t *cib_conn = va_arg(args, cib_t *); ++ cib_t *cib_conn G_GNUC_UNUSED = va_arg(args, cib_t *); + GList *resources = va_arg(args, GList *); + pe_resource_t *rsc = va_arg(args, pe_resource_t *); + pe_node_t *node = va_arg(args, pe_node_t *); +@@ -610,7 +610,7 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + out->list_item(out, "reason", "Resource %s is running", rsc->id); + } + +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + g_list_free(hosts); + hosts = NULL; + } +@@ -624,7 +624,7 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + rsc->id, host_uname); + } + +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + + } else if ((rsc == NULL) && (host_uname != NULL)) { + const char* host_uname = node->details->uname; +@@ -637,14 +637,14 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + out->list_item(out, "reason", "Resource %s is running on host %s", + rsc->id, host_uname); +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + } + + for(lpc = unactiveResources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + out->list_item(out, "reason", "Resource %s is assigned to host %s but not running", + rsc->id, host_uname); +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + } + + g_list_free(allResources); +@@ -657,7 +657,7 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + rsc->fns->location(rsc, &hosts, TRUE); + out->list_item(out, "reason", "Resource %s is %srunning", + rsc->id, (hosts? "" : "not ")); +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + g_list_free(hosts); + } + +@@ -670,7 +670,7 @@ PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t + static int + resource_reasons_list_xml(pcmk__output_t *out, va_list args) + { +- cib_t *cib_conn = va_arg(args, cib_t *); ++ cib_t *cib_conn G_GNUC_UNUSED = va_arg(args, cib_t *); + GList *resources = va_arg(args, GList *); + pe_resource_t *rsc = va_arg(args, pe_resource_t *); + pe_node_t *node = va_arg(args, pe_node_t *); +@@ -695,7 +695,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + "running", pcmk__btoa(hosts != NULL), + NULL); + +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + pcmk__output_xml_pop_parent(out); + g_list_free(hosts); + hosts = NULL; +@@ -708,7 +708,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + crm_xml_add(xml_node, "running_on", host_uname); + } + +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + + } else if ((rsc == NULL) && (host_uname != NULL)) { + const char* host_uname = node->details->uname; +@@ -728,7 +728,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + "host", host_uname, + NULL); + +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + pcmk__output_xml_pop_parent(out); + } + +@@ -741,7 +741,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + "host", host_uname, + NULL); + +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + pcmk__output_xml_pop_parent(out); + } + +@@ -755,7 +755,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + + rsc->fns->location(rsc, &hosts, TRUE); + crm_xml_add(xml_node, "running", pcmk__btoa(hosts != NULL)); +- cli_resource_check(out, cib_conn, rsc); ++ cli_resource_check(out, rsc); + g_list_free(hosts); + } + +diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c +index 4f62b4b2e..47653a060 100644 +--- a/tools/crm_resource_runtime.c ++++ b/tools/crm_resource_runtime.c +@@ -915,7 +915,7 @@ check_locked(resource_checks_t *checks) + } + + int +-cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc) ++cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc) + { + resource_checks_t checks = { .rsc = rsc }; + +-- +2.31.1 + + +From b1a1a07f3e44bc74575eab325277ea8c1f3391b2 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 5 Apr 2022 17:20:06 -0500 +Subject: [PATCH 06/14] Refactor: tools: drop unused argument from + resource-reasons-list message + +--- + tools/crm_resource.c | 2 +- + tools/crm_resource_print.c | 6 ++---- + 2 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/tools/crm_resource.c b/tools/crm_resource.c +index bf5326b40..7f656a20d 100644 +--- a/tools/crm_resource.c ++++ b/tools/crm_resource.c +@@ -1941,7 +1941,7 @@ main(int argc, char **argv) + if ((options.host_uname != NULL) && (node == NULL)) { + rc = pcmk_rc_node_unknown; + } else { +- rc = out->message(out, "resource-reasons-list", cib_conn, ++ rc = out->message(out, "resource-reasons-list", + data_set->resources, rsc, node); + } + break; +diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c +index f025cbddd..580f9c71a 100644 +--- a/tools/crm_resource_print.c ++++ b/tools/crm_resource_print.c +@@ -582,12 +582,11 @@ resource_search_list_xml(pcmk__output_t *out, va_list args) + return pcmk_rc_ok; + } + +-PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t *", ++PCMK__OUTPUT_ARGS("resource-reasons-list", "GList *", "pe_resource_t *", + "pe_node_t *") + static int + resource_reasons_list_default(pcmk__output_t *out, va_list args) + { +- cib_t *cib_conn G_GNUC_UNUSED = va_arg(args, cib_t *); + GList *resources = va_arg(args, GList *); + pe_resource_t *rsc = va_arg(args, pe_resource_t *); + pe_node_t *node = va_arg(args, pe_node_t *); +@@ -665,12 +664,11 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + return pcmk_rc_ok; + } + +-PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t *", ++PCMK__OUTPUT_ARGS("resource-reasons-list", "GList *", "pe_resource_t *", + "pe_node_t *") + static int + resource_reasons_list_xml(pcmk__output_t *out, va_list args) + { +- cib_t *cib_conn G_GNUC_UNUSED = va_arg(args, cib_t *); + GList *resources = va_arg(args, GList *); + pe_resource_t *rsc = va_arg(args, pe_resource_t *); + pe_node_t *node = va_arg(args, pe_node_t *); +-- +2.31.1 + + +From 973eb2694b334b4e9e6967f6c7ceaebec10693db Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 10:08:37 -0500 +Subject: [PATCH 07/14] Refactor: tools: pass node to cli_resource_check() + +The node is not used yet +--- + tools/crm_resource.c | 12 ++++++------ + tools/crm_resource.h | 3 ++- + tools/crm_resource_print.c | 20 ++++++++++---------- + tools/crm_resource_runtime.c | 2 +- + 4 files changed, 19 insertions(+), 18 deletions(-) + +diff --git a/tools/crm_resource.c b/tools/crm_resource.c +index 7f656a20d..756a06268 100644 +--- a/tools/crm_resource.c ++++ b/tools/crm_resource.c +@@ -1004,7 +1004,7 @@ ban_or_move(pcmk__output_t *out, pe_resource_t *rsc, const char *move_lifetime) + } + + static void +-cleanup(pcmk__output_t *out, pe_resource_t *rsc) ++cleanup(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node) + { + int rc = pcmk_rc_ok; + +@@ -1019,7 +1019,7 @@ cleanup(pcmk__output_t *out, pe_resource_t *rsc) + + if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) { + // Show any reasons why resource might stay stopped +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + } + + if (rc == pcmk_rc_ok) { +@@ -1311,7 +1311,7 @@ refresh(pcmk__output_t *out) + } + + static void +-refresh_resource(pcmk__output_t *out, pe_resource_t *rsc) ++refresh_resource(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node) + { + int rc = pcmk_rc_ok; + +@@ -1326,7 +1326,7 @@ refresh_resource(pcmk__output_t *out, pe_resource_t *rsc) + + if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) { + // Show any reasons why resource might stay stopped +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + } + + if (rc == pcmk_rc_ok) { +@@ -2075,7 +2075,7 @@ main(int argc, char **argv) + start_mainloop(controld_api); + } + } else { +- cleanup(out, rsc); ++ cleanup(out, rsc, node); + } + break; + +@@ -2083,7 +2083,7 @@ main(int argc, char **argv) + if (rsc == NULL) { + rc = refresh(out); + } else { +- refresh_resource(out, rsc); ++ refresh_resource(out, rsc, node); + } + break; + +diff --git a/tools/crm_resource.h b/tools/crm_resource.h +index bcff2b5f6..f7e44476d 100644 +--- a/tools/crm_resource.h ++++ b/tools/crm_resource.h +@@ -68,7 +68,8 @@ int cli_resource_print_operations(const char *rsc_id, const char *host_uname, + bool active, pe_working_set_t * data_set); + + /* runtime */ +-int cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc); ++int cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc, ++ pe_node_t *node); + int cli_resource_fail(pcmk_ipc_api_t *controld_api, const char *host_uname, + const char *rsc_id, pe_working_set_t *data_set); + GList *cli_resource_search(pe_resource_t *rsc, const char *requested_name, +diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c +index 580f9c71a..087819601 100644 +--- a/tools/crm_resource_print.c ++++ b/tools/crm_resource_print.c +@@ -609,7 +609,7 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + out->list_item(out, "reason", "Resource %s is running", rsc->id); + } + +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, NULL); + g_list_free(hosts); + hosts = NULL; + } +@@ -623,7 +623,7 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + rsc->id, host_uname); + } + +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + + } else if ((rsc == NULL) && (host_uname != NULL)) { + const char* host_uname = node->details->uname; +@@ -636,14 +636,14 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + out->list_item(out, "reason", "Resource %s is running on host %s", + rsc->id, host_uname); +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + } + + for(lpc = unactiveResources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + out->list_item(out, "reason", "Resource %s is assigned to host %s but not running", + rsc->id, host_uname); +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + } + + g_list_free(allResources); +@@ -656,7 +656,7 @@ resource_reasons_list_default(pcmk__output_t *out, va_list args) + rsc->fns->location(rsc, &hosts, TRUE); + out->list_item(out, "reason", "Resource %s is %srunning", + rsc->id, (hosts? "" : "not ")); +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, NULL); + g_list_free(hosts); + } + +@@ -693,7 +693,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + "running", pcmk__btoa(hosts != NULL), + NULL); + +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, NULL); + pcmk__output_xml_pop_parent(out); + g_list_free(hosts); + hosts = NULL; +@@ -706,7 +706,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + crm_xml_add(xml_node, "running_on", host_uname); + } + +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + + } else if ((rsc == NULL) && (host_uname != NULL)) { + const char* host_uname = node->details->uname; +@@ -726,7 +726,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + "host", host_uname, + NULL); + +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + pcmk__output_xml_pop_parent(out); + } + +@@ -739,7 +739,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + "host", host_uname, + NULL); + +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, node); + pcmk__output_xml_pop_parent(out); + } + +@@ -753,7 +753,7 @@ resource_reasons_list_xml(pcmk__output_t *out, va_list args) + + rsc->fns->location(rsc, &hosts, TRUE); + crm_xml_add(xml_node, "running", pcmk__btoa(hosts != NULL)); +- cli_resource_check(out, rsc); ++ cli_resource_check(out, rsc, NULL); + g_list_free(hosts); + } + +diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c +index 47653a060..68e899c45 100644 +--- a/tools/crm_resource_runtime.c ++++ b/tools/crm_resource_runtime.c +@@ -915,7 +915,7 @@ check_locked(resource_checks_t *checks) + } + + int +-cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc) ++cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node) + { + resource_checks_t checks = { .rsc = rsc }; + +-- +2.31.1 + + +From c3bfde0536f2eb51c81bf34fa957c38dc88f9cc3 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 09:49:03 -0500 +Subject: [PATCH 08/14] Feature: tools: crm_resource --why now checks node + health status + +Closes T65 +--- + tools/crm_resource.h | 1 + + tools/crm_resource_print.c | 13 +++++++++ + tools/crm_resource_runtime.c | 56 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 70 insertions(+) + +diff --git a/tools/crm_resource.h b/tools/crm_resource.h +index f7e44476d..ae4b02a98 100644 +--- a/tools/crm_resource.h ++++ b/tools/crm_resource.h +@@ -37,6 +37,7 @@ enum resource_check_flags { + rsc_unpromotable = (1 << 1), + rsc_unmanaged = (1 << 2), + rsc_locked = (1 << 3), ++ rsc_node_health = (1 << 4), + }; + + typedef struct resource_checks_s { +diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c +index 087819601..27fd76aaf 100644 +--- a/tools/crm_resource_print.c ++++ b/tools/crm_resource_print.c +@@ -477,6 +477,15 @@ resource_check_list_default(pcmk__output_t *out, va_list args) { + parent->id, checks->lock_node); + } + ++ if (pcmk_is_set(checks->flags, rsc_node_health)) { ++ out->list_item(out, "check", ++ "'%s' cannot run on unhealthy nodes due to " ++ PCMK__OPT_NODE_HEALTH_STRATEGY "='%s'", ++ parent->id, ++ pe_pref(checks->rsc->cluster->config_hash, ++ PCMK__OPT_NODE_HEALTH_STRATEGY)); ++ } ++ + out->end_list(out); + return pcmk_rc_ok; + } +@@ -508,6 +517,10 @@ resource_check_list_xml(pcmk__output_t *out, va_list args) { + crm_xml_add(node, "locked-to", checks->lock_node); + } + ++ if (pcmk_is_set(checks->flags, rsc_node_health)) { ++ pcmk__xe_set_bool_attr(node, "unhealthy", true); ++ } ++ + return pcmk_rc_ok; + } + +diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c +index 68e899c45..2aa3efe38 100644 +--- a/tools/crm_resource_runtime.c ++++ b/tools/crm_resource_runtime.c +@@ -914,6 +914,61 @@ check_locked(resource_checks_t *checks) + } + } + ++static bool ++node_is_unhealthy(pe_node_t *node) ++{ ++ switch (pe__health_strategy(node->details->data_set)) { ++ case pcmk__health_strategy_none: ++ break; ++ ++ case pcmk__health_strategy_no_red: ++ if (pe__node_health(node) < 0) { ++ return true; ++ } ++ break; ++ ++ case pcmk__health_strategy_only_green: ++ if (pe__node_health(node) <= 0) { ++ return true; ++ } ++ break; ++ ++ case pcmk__health_strategy_progressive: ++ case pcmk__health_strategy_custom: ++ /* @TODO These are finite scores, possibly with rules, and possibly ++ * combining with other scores, so attributing these as a cause is ++ * nontrivial. ++ */ ++ break; ++ } ++ return false; ++} ++ ++static void ++check_node_health(resource_checks_t *checks, pe_node_t *node) ++{ ++ if (node == NULL) { ++ GHashTableIter iter; ++ bool allowed = false; ++ bool all_nodes_unhealthy = true; ++ ++ g_hash_table_iter_init(&iter, checks->rsc->allowed_nodes); ++ while (g_hash_table_iter_next(&iter, NULL, (void **) &node)) { ++ allowed = true; ++ if (!node_is_unhealthy(node)) { ++ all_nodes_unhealthy = false; ++ break; ++ } ++ } ++ if (allowed && all_nodes_unhealthy) { ++ checks->flags |= rsc_node_health; ++ } ++ ++ } else if (node_is_unhealthy(node)) { ++ checks->flags |= rsc_node_health; ++ } ++} ++ + int + cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node) + { +@@ -922,6 +977,7 @@ cli_resource_check(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node) + check_role(&checks); + check_managed(&checks); + check_locked(&checks); ++ check_node_health(&checks, node); + + return out->message(out, "resource-check-list", &checks); + } +-- +2.31.1 + + +From 48730fd51a22e109514764a039e5c89fd204ad4c Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 10:41:48 -0500 +Subject: [PATCH 09/14] Low: schemas: copy crm_resource API schema in + preparation for changes + +--- + include/crm/common/output_internal.h | 2 +- + xml/api/crm_resource-2.22.rng | 303 +++++++++++++++++++++++++++ + 2 files changed, 304 insertions(+), 1 deletion(-) + create mode 100644 xml/api/crm_resource-2.22.rng + +diff --git a/include/crm/common/output_internal.h b/include/crm/common/output_internal.h +index ca16227fe..bdcae8ad6 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.21" ++# define PCMK__API_VERSION "2.22" + + #if defined(PCMK__WITH_ATTRIBUTE_OUTPUT_ARGS) + # define PCMK__OUTPUT_ARGS(ARGS...) __attribute__((output_args(ARGS))) +diff --git a/xml/api/crm_resource-2.22.rng b/xml/api/crm_resource-2.22.rng +new file mode 100644 +index 000000000..cd74da0d8 +--- /dev/null ++++ b/xml/api/crm_resource-2.22.rng +@@ -0,0 +1,303 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ promoted ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ocf ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ true ++ false ++ ++ ++ ++ true ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Stopped ++ Started ++ Promoted ++ Unpromoted ++ ++ ++ Master ++ Slave ++ ++ ++ +-- +2.31.1 + + +From 75a885d9da92c84038e3abf732c11cf3fb6a79a7 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 11:33:50 -0500 +Subject: [PATCH 10/14] Fix: tools: correct crm_resource --why schema to match + actual output + +If both a resource and node name are specified, "running_on" is optional +--- + xml/api/crm_resource-2.22.rng | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/xml/api/crm_resource-2.22.rng b/xml/api/crm_resource-2.22.rng +index cd74da0d8..e89d850da 100644 +--- a/xml/api/crm_resource-2.22.rng ++++ b/xml/api/crm_resource-2.22.rng +@@ -126,7 +126,9 @@ + + + +- ++ ++ ++ + + + +-- +2.31.1 + + +From 5e4f993859dd68a3f88cb0648ace7b3837316288 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 11:20:03 -0500 +Subject: [PATCH 11/14] Low: schemas: simplify crm_resource --why schema + +--- + xml/api/crm_resource-2.22.rng | 64 ++++++++++++----------------------- + 1 file changed, 22 insertions(+), 42 deletions(-) + +diff --git a/xml/api/crm_resource-2.22.rng b/xml/api/crm_resource-2.22.rng +index e89d850da..2d2ba839f 100644 +--- a/xml/api/crm_resource-2.22.rng ++++ b/xml/api/crm_resource-2.22.rng +@@ -102,56 +102,36 @@ + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- + ++ + + + +- +- +- + +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +-- +2.31.1 + + +From 79bdbbde27ad340c2054089aaecf5e0b49296e59 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 11:28:11 -0500 +Subject: [PATCH 12/14] Test: cts-cli: use validated XML output for + crm_resource --why test + +--- + cts/cli/regression.tools.exp | 8 ++++++-- + cts/cts-cli.in | 4 ++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/cts/cli/regression.tools.exp b/cts/cli/regression.tools.exp +index 0d1cfa2ab..4237a3ec5 100644 +--- a/cts/cli/regression.tools.exp ++++ b/cts/cli/regression.tools.exp +@@ -888,8 +888,12 @@ Deleted 'dummy' option: id=dummy-meta_attributes-is-managed name=is-managed + =#=#=#= End test: Create another resource meta attribute - OK (0) =#=#=#= + * Passed: crm_resource - Create another resource meta attribute + =#=#=#= Begin test: Show why a resource is not running =#=#=#= +-Resource dummy is not running +-Configuration specifies 'dummy' should remain stopped ++ ++ ++ ++ ++ ++ + =#=#=#= End test: Show why a resource is not running - OK (0) =#=#=#= + * Passed: crm_resource - Show why a resource is not running + =#=#=#= Begin test: Remove another resource meta attribute =#=#=#= +diff --git a/cts/cts-cli.in b/cts/cts-cli.in +index 8565c485a..289ac966f 100755 +--- a/cts/cts-cli.in ++++ b/cts/cts-cli.in +@@ -657,8 +657,8 @@ function test_tools() { + test_assert_validate $CRM_EX_OK 0 + + desc="Show why a resource is not running" +- cmd="crm_resource -Y -r dummy" +- test_assert $CRM_EX_OK 0 ++ cmd="crm_resource -Y -r dummy --output-as=xml" ++ test_assert_validate $CRM_EX_OK 0 + + desc="Remove another resource meta attribute" + cmd="crm_resource -r dummy --meta -d target-role --output-as=xml" +-- +2.31.1 + + +From 929d1b40e82f186e7e31e380db2620e7e23968f1 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 10:43:22 -0500 +Subject: [PATCH 13/14] Low: schemas: update crm_resource --why schema for new + health check + +--- + xml/api/crm_resource-2.22.rng | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/xml/api/crm_resource-2.22.rng b/xml/api/crm_resource-2.22.rng +index 2d2ba839f..8a4667559 100644 +--- a/xml/api/crm_resource-2.22.rng ++++ b/xml/api/crm_resource-2.22.rng +@@ -157,6 +157,9 @@ + + + ++ ++ true ++ + + + +-- +2.31.1 + + +From 6630e55abc7b26be294ab6d42f12cdb7e2c69b55 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Thu, 23 Jun 2022 11:07:20 -0500 +Subject: [PATCH 14/14] Test: cts-cli: add tests for checking resource status + on unhealthy node + +--- + cts/cli/regression.tools.exp | 112 ++++++++++++++++++++++++++++++++++- + cts/cts-cli.in | 12 ++++ + 2 files changed, 122 insertions(+), 2 deletions(-) + +diff --git a/cts/cli/regression.tools.exp b/cts/cli/regression.tools.exp +index 4237a3ec5..89ae4e97d 100644 +--- a/cts/cli/regression.tools.exp ++++ b/cts/cli/regression.tools.exp +@@ -3406,13 +3406,14 @@ Removing constraint: cli-prefer-dummy + + =#=#=#= End test: Clear all implicit constraints for dummy - OK (0) =#=#=#= + * Passed: crm_resource - Clear all implicit constraints for dummy +-=#=#=#= Begin test: Delete a resource =#=#=#= +-=#=#=#= Current cib after: Delete a resource =#=#=#= ++=#=#=#= Begin test: Set a node health strategy =#=#=#= ++=#=#=#= Current cib after: Set a node health strategy =#=#=#= + + + + + ++ + + + +@@ -3427,6 +3428,113 @@ Removing constraint: cli-prefer-dummy + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++=#=#=#= End test: Set a node health strategy - OK (0) =#=#=#= ++* Passed: crm_attribute - Set a node health strategy ++=#=#=#= Begin test: Set a node health attribute =#=#=#= ++=#=#=#= Current cib after: Set a node health attribute =#=#=#= ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++=#=#=#= End test: Set a node health attribute - OK (0) =#=#=#= ++* Passed: crm_attribute - Set a node health attribute ++=#=#=#= Begin test: Show why a resource is not running on an unhealthy node =#=#=#= ++ ++ ++ ++ ++ ++ ++=#=#=#= End test: Show why a resource is not running on an unhealthy node - OK (0) =#=#=#= ++* Passed: crm_resource - Show why a resource is not running on an unhealthy node ++=#=#=#= Begin test: Delete a resource =#=#=#= ++=#=#=#= Current cib after: Delete a resource =#=#=#= ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/cts/cts-cli.in b/cts/cts-cli.in +index 289ac966f..990d37cf7 100755 +--- a/cts/cts-cli.in ++++ b/cts/cts-cli.in +@@ -883,6 +883,18 @@ function test_tools() { + cmd="crm_resource -r dummy -U" + test_assert $CRM_EX_OK + ++ desc="Set a node health strategy" ++ cmd="crm_attribute -n node-health-strategy -v migrate-on-red" ++ test_assert $CRM_EX_OK ++ ++ desc="Set a node health attribute" ++ cmd="crm_attribute -N node3 -n '#health-cts-cli' -v red" ++ test_assert $CRM_EX_OK ++ ++ desc="Show why a resource is not running on an unhealthy node" ++ cmd="crm_resource -N node3 -Y -r dummy --output-as=xml" ++ test_assert_validate $CRM_EX_OK 0 ++ + desc="Delete a resource" + cmd="crm_resource -D -r dummy -t primitive" + test_assert $CRM_EX_OK +-- +2.31.1 + diff --git a/SOURCES/007-stonith_admin.patch b/SOURCES/007-stonith_admin.patch new file mode 100644 index 0000000..bddba16 --- /dev/null +++ b/SOURCES/007-stonith_admin.patch @@ -0,0 +1,108 @@ +From d6294dd28b6d95ad3844824996717f9959d97ac6 Mon Sep 17 00:00:00 2001 +From: Reid Wahl +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 +--- + 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 +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 +--- + 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 + diff --git a/SOURCES/008-metadata.patch b/SOURCES/008-metadata.patch new file mode 100644 index 0000000..5dc9e27 --- /dev/null +++ b/SOURCES/008-metadata.patch @@ -0,0 +1,34 @@ +From e4d9c795dfe2d6737c777a265292864da98dae8f Mon Sep 17 00:00:00 2001 +From: Reid Wahl +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 +--- + 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 + diff --git a/SOURCES/009-validate.patch b/SOURCES/009-validate.patch new file mode 100644 index 0000000..a5d01f5 --- /dev/null +++ b/SOURCES/009-validate.patch @@ -0,0 +1,94 @@ +From d00a6abde7e6a41f8bc6085c875cb8072aff499b Mon Sep 17 00:00:00 2001 +From: Chris Lumens +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 +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 + diff --git a/SOURCES/010-regression.patch b/SOURCES/010-regression.patch new file mode 100644 index 0000000..e40ff0e --- /dev/null +++ b/SOURCES/010-regression.patch @@ -0,0 +1,47 @@ +From e5f80059c7f1c0ad3264dc2a2a61e64cded0fe0f Mon Sep 17 00:00:00 2001 +From: Hideo Yamauchi +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 + diff --git a/SOURCES/011-unfencing.patch b/SOURCES/011-unfencing.patch new file mode 100644 index 0000000..01255df --- /dev/null +++ b/SOURCES/011-unfencing.patch @@ -0,0 +1,178 @@ +From b1094468ab0f7c6d2f5b457b721f3a852a9cae2c Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +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 +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 @@ + + + +- ++ + + + +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 @@ + + + +- ++ + + + +@@ -384,7 +384,7 @@ + + + +- ++ + + + +@@ -392,7 +392,7 @@ + + + +- ++ + + + +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 @@ + + + +- ++ + + + +@@ -84,7 +84,7 @@ + + + +- ++ + + + +@@ -92,7 +92,7 @@ + + + +- ++ + + + +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 @@ + + + +- ++ + + + +@@ -368,7 +368,7 @@ + + + +- ++ + + + +@@ -376,7 +376,7 @@ + + + +- ++ + + + +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 @@ + + + +- ++ + + + +@@ -184,7 +184,7 @@ + + + +- ++ + + + +-- +2.31.1 + diff --git a/SOURCES/012-crm_resource.patch b/SOURCES/012-crm_resource.patch new file mode 100644 index 0000000..a087b3f --- /dev/null +++ b/SOURCES/012-crm_resource.patch @@ -0,0 +1,38 @@ +From fe9150bc4b740b3748fec34fe668df4f8c0d0e25 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +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 + diff --git a/SPECS/pacemaker.spec b/SPECS/pacemaker.spec new file mode 100644 index 0000000..bd2e734 --- /dev/null +++ b/SPECS/pacemaker.spec @@ -0,0 +1,1507 @@ +# User-configurable globals and defines to control package behavior +# (these should not test {with X} values, which are declared later) + +## User and group to use for nonprivileged services +%global uname hacluster +%global gname haclient + +## Where to install Pacemaker documentation +%if 0%{?suse_version} > 0 +%global pcmk_docdir %{_docdir}/%{name}-%{version} +%else +%if 0%{?rhel} > 7 +%global pcmk_docdir %{_docdir}/%{name}-doc +%else +%global pcmk_docdir %{_docdir}/%{name} +%endif +%endif + +## GitHub entity that distributes source (for ease of using a fork) +%global github_owner ClusterLabs + +## Where bug reports should be submitted +## Leave bug_url undefined to use ClusterLabs default, others define it here +%if 0%{?rhel} +%global bug_url https://bugzilla.redhat.com/ +%else +%if 0%{?fedora} +%global bug_url https://bugz.fedoraproject.org/%{name} +%endif +%endif + +## What to use as the OCF resource agent root directory +%global ocf_root %{_prefix}/lib/ocf + +## Upstream pacemaker version, and its package version (specversion +## can be incremented to build packages reliably considered "newer" +## than previously built packages with the same pcmkversion) +%global pcmkversion 2.1.4 +%global specversion 5 + +## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build +%global commit dc6eb4362e67c1497a413434eba097063bf1ef83 + +## Since git v2.11, the extent of abbreviation is autoscaled by default +## (used to be constant of 7), so we need to convey it for non-tags, too. +%global commit_abbrev 9 + + +# Define conditionals so that "rpmbuild --with " and +# "rpmbuild --without " can enable and disable specific features + +## Add option to enable support for stonith/external fencing agents +%bcond_with stonithd + +## Add option for whether to support storing sensitive information outside CIB +%if (0%{?fedora} && 0%{?fedora} <= 33) || (0%{?rhel} && 0%{?rhel} <= 8) +%bcond_with cibsecrets +%else +%bcond_without cibsecrets +%endif + +## Add option to enable Native Language Support (experimental) +%bcond_with nls + +## Add option to create binaries suitable for use with profiling tools +%bcond_with profiling + +## Add option to create binaries with coverage analysis +%bcond_with coverage + +## Allow deprecated option to skip (or enable, on RHEL) documentation +%if 0%{?rhel} +%bcond_with doc +%else +%bcond_without doc +%endif + +## Add option to default to start-up synchronization with SBD. +## +## If enabled, SBD *MUST* be built to default similarly, otherwise data +## corruption could occur. Building both Pacemaker and SBD to default +## to synchronization improves safety, without requiring higher-level tools +## to be aware of the setting or requiring users to modify configurations +## after upgrading to versions that support synchronization. +%if 0%{?rhel} && 0%{?rhel} > 8 +%bcond_without sbd_sync +%else +%bcond_with sbd_sync +%endif + +## Add option to prefix package version with "0." +## (so later "official" packages will be considered updates) +%bcond_with pre_release + +## NOTE: skip --with upstart_job + +## Add option to turn off hardening of libraries and daemon executables +%bcond_without hardening + +## Add option to enable (or disable, on RHEL 8) links for legacy daemon names +%if 0%{?rhel} && 0%{?rhel} <= 8 +%bcond_without legacy_links +%else +%bcond_with legacy_links +%endif + +## Nagios source control identifiers +%global nagios_name nagios-agents-metadata +%global nagios_hash 105ab8a7b2c16b9a29cf1c1596b80136eeef332b +%global nagios_archive_github_url %{nagios_hash}#/%{nagios_name}-%{nagios_hash}.tar.gz + +# Define globals for convenient use later + +## Workaround to use parentheses in other globals +%global lparen ( +%global rparen ) + +## Whether this is a tagged release (final or release candidate) +%define tag_release %(c=%{commit}; case ${c} in Pacemaker-*%{rparen} echo 1 ;; + *%{rparen} echo 0 ;; esac) + +## Portion of export/dist tarball name after "pacemaker-", and release version +%if 0%{tag_release} +%define archive_version %(c=%{commit}; echo ${c:10}) +%define archive_github_url %{commit}#/%{name}-%{archive_version}.tar.gz +%else +%define archive_version %(c=%{commit}; echo ${c:0:%{commit_abbrev}}) +%define archive_github_url %{archive_version}#/%{name}-%{archive_version}.tar.gz +%endif +### Always use a simple release number +%define pcmk_release %{specversion} + +%if 0%{?fedora} > 20 || 0%{?rhel} > 7 +## Base GnuTLS cipher priorities (presumably only the initial, required keyword) +## overridable with "rpmbuild --define 'pcmk_gnutls_priorities PRIORITY-SPEC'" +%define gnutls_priorities %{?pcmk_gnutls_priorities}%{!?pcmk_gnutls_priorities:@SYSTEM} +%endif + +%if 0%{?fedora} > 22 || 0%{?rhel} > 7 +%global supports_recommends 1 +%endif + +## Different distros name certain packages differently +## (note: corosync libraries also differ, but all provide corosync-devel) +%if 0%{?suse_version} > 0 +%global pkgname_bzip2_devel libbz2-devel +%global pkgname_docbook_xsl docbook-xsl-stylesheets +%global pkgname_gettext gettext-tools +%global pkgname_gnutls_devel libgnutls-devel +%global pkgname_shadow_utils shadow +%global pkgname_procps procps +%global pkgname_glue_libs libglue +%global pkgname_pcmk_libs lib%{name}3 +%global hacluster_id 90 +%else +%global pkgname_libtool_devel libtool-ltdl-devel +%global pkgname_libtool_devel_arch libtool-ltdl-devel%{?_isa} +%global pkgname_bzip2_devel bzip2-devel +%global pkgname_docbook_xsl docbook-style-xsl +%global pkgname_gettext gettext-devel +%global pkgname_gnutls_devel gnutls-devel +%global pkgname_shadow_utils shadow-utils +%global pkgname_procps procps-ng +%global pkgname_glue_libs cluster-glue-libs +%global pkgname_pcmk_libs %{name}-libs +%global hacluster_id 189 +%endif + +## Distro-specific configuration choices + +### Use 2.0-style output when other distro packages don't support current output +%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} <= 8 ) +%global compat20 --enable-compat-2.0 +%endif + +### Default concurrent-fencing to true when distro prefers that +%if 0%{?rhel} >= 7 +%global concurrent_fencing --with-concurrent-fencing-default=true +%endif + +### Default resource-stickiness to 1 when distro prefers that +%if 0%{?fedora} >= 35 || 0%{?rhel} >= 9 +%global resource_stickiness --with-resource-stickiness-default=1 +%endif + + +# Python-related definitions + +## Turn off auto-compilation of Python files outside Python specific paths, +## so there's no risk that unexpected "__python" macro gets picked to do the +## RPM-native byte-compiling there (only "{_datadir}/pacemaker/tests" affected) +## -- distro-dependent tricks or automake's fallback to be applied there +%if %{defined _python_bytecompile_extra} +%global _python_bytecompile_extra 0 +%else +### the statement effectively means no RPM-native byte-compiling will occur at +### all, so distro-dependent tricks for Python-specific packages to be applied +%global __os_install_post %(echo '%{__os_install_post}' | { + sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g'; }) +%endif + +## Prefer Python 3 definitions explicitly, in case 2 is also available +%if %{defined __python3} +%global python_name python3 +%global python_path %{__python3} +%define python_site %{?python3_sitelib}%{!?python3_sitelib:%( + %{python_path} -c 'from distutils.sysconfig import get_python_lib as gpl; print(gpl(1))' 2>/dev/null)} +%else +%if %{defined python_version} +%global python_name python%(echo %{python_version} | cut -d'.' -f1) +%define python_path %{?__python}%{!?__python:/usr/bin/%{python_name}} +%else +%global python_name python +%global python_path %{?__python}%{!?__python:/usr/bin/python%{?python_pkgversion}} +%endif +%define python_site %{?python_sitelib}%{!?python_sitelib:%( + %{python_name} -c 'from distutils.sysconfig import get_python_lib as gpl; print(gpl(1))' 2>/dev/null)} +%endif + + +# Keep sane profiling data if requested +%if %{with profiling} + +## Disable -debuginfo package and stripping binaries/libraries +%define debug_package %{nil} + +%endif + + +Name: pacemaker +Summary: Scalable High-Availability cluster resource manager +Version: %{pcmkversion} +Release: %{pcmk_release}%{?dist} +License: GPLv2+ and LGPLv2+ +Url: https://www.clusterlabs.org/ + +# Example: https://codeload.github.com/ClusterLabs/pacemaker/tar.gz/e91769e +# will download pacemaker-e91769e.tar.gz +# +# The ending part starting with '#' is ignored by github but necessary for +# rpmbuild to know what the tar archive name is. (The downloaded file will be +# named correctly only for commit IDs, not tagged releases.) +# +# You can use "spectool -s 0 pacemaker.spec" (rpmdevtools) to show final URL. +Source0: https://codeload.github.com/%{github_owner}/%{name}/tar.gz/%{archive_github_url} +Source1: https://codeload.github.com/%{github_owner}/%{nagios_name}/tar.gz/%{nagios_archive_github_url} + +# upstream commits +Patch001: 001-stonith-enabled.patch +Patch002: 002-acl_group.patch +Patch003: 003-regression.patch +Patch004: 004-schema.patch +Patch005: 005-schema.patch +Patch006: 006-crm_resource.patch +Patch007: 007-stonith_admin.patch +Patch008: 008-metadata.patch +Patch009: 009-validate.patch +Patch010: 010-regression.patch +Patch011: 011-unfencing.patch +Patch012: 012-crm_resource.patch + +Requires: resource-agents +Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-cluster-libs%{?_isa} = %{version}-%{release} +Requires: %{name}-cli = %{version}-%{release} +%{?systemd_requires} + +%if %{defined centos} +ExclusiveArch: aarch64 i686 ppc64le s390x x86_64 %{arm} +%else +%if 0%{?rhel} +ExclusiveArch: aarch64 i686 ppc64le s390x x86_64 +%endif +%endif + +Requires: %{python_path} +BuildRequires: %{python_name}-devel + +# Pacemaker requires a minimum libqb functionality +# RHEL requires a higher version than upstream, for qb_ipcc_connect_async() +Requires: libqb >= 2.0.3-7 +BuildRequires: libqb-devel >= 2.0.3-7 + +# Required basic build tools +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: coreutils +BuildRequires: findutils +BuildRequires: gcc +BuildRequires: grep +BuildRequires: libtool +%if %{defined pkgname_libtool_devel} +BuildRequires: %{?pkgname_libtool_devel} +%endif +BuildRequires: make +BuildRequires: pkgconfig +BuildRequires: sed + +# Required for core functionality +BuildRequires: pkgconfig(glib-2.0) >= 2.42 +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel +BuildRequires: libuuid-devel +BuildRequires: %{pkgname_bzip2_devel} + +# Enables optional functionality +BuildRequires: pkgconfig(dbus-1) +BuildRequires: %{pkgname_docbook_xsl} +BuildRequires: %{pkgname_gnutls_devel} +BuildRequires: help2man +BuildRequires: ncurses-devel +BuildRequires: pam-devel +BuildRequires: %{pkgname_gettext} >= 0.18 + +# Required for "make check" +BuildRequires: libcmocka-devel + +BuildRequires: pkgconfig(systemd) + +# RH patches are created by git, so we need git to apply them +BuildRequires: git + +# The RHEL 9 build root has corosync_cfg_trackstart() available, so +# Pacemaker's configure script will build support for it. Add a hard dependency +# to ensure users have compatible Corosync libraries if they upgrade Pacemaker. +Requires: corosync >= 3.1.1 +BuildRequires: corosync-devel >= 3.1.1 + +%if %{with stonithd} +BuildRequires: %{pkgname_glue_libs}-devel +%endif + +%if %{with doc} +BuildRequires: asciidoc +BuildRequires: inkscape +BuildRequires: %{python_name}-sphinx +%endif + +Provides: pcmk-cluster-manager = %{version}-%{release} +Provides: pcmk-cluster-manager%{?_isa} = %{version}-%{release} + +# Bundled bits +## Pacemaker uses the crypto/md5-buffer module from gnulib +%if 0%{?fedora} || 0%{?rhel} +Provides: bundled(gnulib) = 20200404 +%endif + +%description +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +It supports more than 16 node clusters with significant capabilities +for managing resources and dependencies. + +It will run scripts at initialization, when machines go up or down, +when related resources fail and can be configured to periodically check +resource health. + +Available rpmbuild rebuild options: + --with(out) : cibsecrets doc hardening nls pre_release profiling stonithd + +%package cli +License: GPLv2+ and LGPLv2+ +Summary: Command line tools for controlling Pacemaker clusters +Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +%if 0%{?supports_recommends} +Recommends: pcmk-cluster-manager = %{version}-%{release} +# For crm_report +Requires: tar +Requires: bzip2 +%endif +Requires: perl-TimeDate +Requires: %{pkgname_procps} +Requires: psmisc +Requires(post):coreutils + +%description cli +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +The %{name}-cli package contains command line tools that can be used +to query and control the cluster from machines that may, or may not, +be part of the cluster. + +%package -n %{pkgname_pcmk_libs} +License: GPLv2+ and LGPLv2+ +Summary: Core Pacemaker libraries +Requires(pre): %{pkgname_shadow_utils} +Requires: %{name}-schemas = %{version}-%{release} +# sbd 1.4.0+ supports the libpe_status API for pe_working_set_t +# sbd 1.4.2+ supports startup/shutdown handshake via pacemakerd-api +# sbd 1.5.0+ supports handshake defaults to enabled in this spec +Conflicts: sbd < 1.5.0 + +%description -n %{pkgname_pcmk_libs} +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +The %{pkgname_pcmk_libs} package contains shared libraries needed for cluster +nodes and those just running the CLI tools. + +%package cluster-libs +License: GPLv2+ and LGPLv2+ +Summary: Cluster Libraries used by Pacemaker +Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} + +%description cluster-libs +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +The %{name}-cluster-libs package contains cluster-aware shared +libraries needed for nodes that will form part of the cluster nodes. + +%package remote +License: GPLv2+ and LGPLv2+ +Summary: Pacemaker remote executor daemon for non-cluster nodes +Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-cli = %{version}-%{release} +Requires: resource-agents +# -remote can be fully independent of systemd +%{?systemd_ordering}%{!?systemd_ordering:%{?systemd_requires}} +Provides: pcmk-cluster-manager = %{version}-%{release} +Provides: pcmk-cluster-manager%{?_isa} = %{version}-%{release} + +%description remote +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +The %{name}-remote package contains the Pacemaker Remote daemon +which is capable of extending pacemaker functionality to remote +nodes not running the full corosync/cluster stack. + +%package -n %{pkgname_pcmk_libs}-devel +License: GPLv2+ and LGPLv2+ +Summary: Pacemaker development package +Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-cluster-libs%{?_isa} = %{version}-%{release} +Requires: %{pkgname_bzip2_devel}%{?_isa} +Requires: corosync-devel%{?_isa} >= 2.0.0 +Requires: glib2-devel%{?_isa} +Requires: libqb-devel%{?_isa} +%if %{defined pkgname_libtool_devel_arch} +Requires: %{?pkgname_libtool_devel_arch} +%endif +Requires: libuuid-devel%{?_isa} +Requires: libxml2-devel%{?_isa} +Requires: libxslt-devel%{?_isa} + +%description -n %{pkgname_pcmk_libs}-devel +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +The %{pkgname_pcmk_libs}-devel package contains headers and shared libraries +for developing tools for Pacemaker. + +%package cts +License: GPLv2+ and LGPLv2+ +Summary: Test framework for cluster-related technologies like Pacemaker +Requires: %{python_path} +Requires: %{pkgname_pcmk_libs} = %{version}-%{release} +Requires: %{name}-cli = %{version}-%{release} +Requires: %{pkgname_procps} +Requires: psmisc +BuildArch: noarch + +# systemd Python bindings are a separate package in some distros +%if %{defined systemd_requires} +%if 0%{?fedora} > 22 || 0%{?rhel} > 7 +Requires: %{python_name}-systemd +%endif +%endif + +%description cts +Test framework for cluster-related technologies like Pacemaker + +%package doc +License: CC-BY-SA-4.0 +Summary: Documentation for Pacemaker +BuildArch: noarch + +%description doc +Documentation for Pacemaker. + +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +%package schemas +License: GPLv2+ +Summary: Schemas and upgrade stylesheets for Pacemaker +BuildArch: noarch + +%description schemas +Schemas and upgrade stylesheets for Pacemaker + +Pacemaker is an advanced, scalable High-Availability cluster resource +manager. + +%package nagios-plugins-metadata +License: GPLv3 +Summary: Pacemaker Nagios Metadata +BuildArch: noarch +# NOTE below are the plugins this metadata uses. +# Requires: nagios-plugins-http +# Requires: nagios-plugins-ldap +# Requires: nagios-plugins-mysql +# Requires: nagios-plugins-pgsql +# Requires: nagios-plugins-tcp +Requires: pcmk-cluster-manager + +%description nagios-plugins-metadata +The metadata files required for Pacemaker to execute the nagios plugin +monitor resources. + +%prep +%autosetup -a 1 -n %{name}-%{archive_version} -S git_am -p 1 + +%build + +export systemdsystemunitdir=%{?_unitdir}%{!?_unitdir:no} + +%if %{with hardening} +# prefer distro-provided hardening flags in case they are defined +# through _hardening_{c,ld}flags macros, configure script will +# use its own defaults otherwise; if such hardenings are completely +# undesired, rpmbuild using "--without hardening" +# (or "--define '_without_hardening 1'") +export CFLAGS_HARDENED_EXE="%{?_hardening_cflags}" +export CFLAGS_HARDENED_LIB="%{?_hardening_cflags}" +export LDFLAGS_HARDENED_EXE="%{?_hardening_ldflags}" +export LDFLAGS_HARDENED_LIB="%{?_hardening_ldflags}" +%endif + +./autogen.sh + +%{configure} \ + PYTHON=%{python_path} \ + %{!?with_hardening: --disable-hardening} \ + %{?with_legacy_links: --enable-legacy-links} \ + %{?with_profiling: --with-profiling} \ + %{?with_cibsecrets: --with-cibsecrets} \ + %{?with_nls: --enable-nls} \ + %{?with_sbd_sync: --with-sbd-sync-default="true"} \ + %{?gnutls_priorities: --with-gnutls-priorities="%{gnutls_priorities}"} \ + %{?bug_url: --with-bug-url=%{bug_url}} \ + %{?ocf_root: --with-ocfdir=%{ocf_root}} \ + %{?concurrent_fencing} \ + %{?resource_stickiness} \ + %{?compat20} \ + --disable-static \ + --with-initdir=%{_initrddir} \ + --with-runstatedir=%{_rundir} \ + --localstatedir=%{_var} \ + --with-nagios \ + --with-nagios-metadata-dir=%{_datadir}/pacemaker/nagios/plugins-metadata/ \ + --with-nagios-plugin-dir=%{_libdir}/nagios/plugins/ \ + --with-version=%{version}-%{release} + +make %{_smp_mflags} V=1 + +%check +make %{_smp_mflags} check +{ cts/cts-scheduler --run load-stopped-loop \ + && cts/cts-cli \ + && touch .CHECKED +} 2>&1 | sed 's/[fF]ail/faiil/g' # prevent false positives in rpmlint +[ -f .CHECKED ] && rm -f -- .CHECKED + +%install +# skip automake-native Python byte-compilation, since RPM-native one (possibly +# distro-confined to Python-specific directories, which is currently the only +# relevant place, anyway) assures proper intrinsic alignment with wider system +# (such as with py_byte_compile macro, which is concurrent Fedora/EL specific) +make install \ + DESTDIR=%{buildroot} V=1 docdir=%{pcmk_docdir} \ + %{?_python_bytecompile_extra:%{?py_byte_compile:am__py_compile=true}} + +mkdir -p %{buildroot}%{_datadir}/pacemaker/nagios/plugins-metadata +for file in $(find %{nagios_name}-%{nagios_hash}/metadata -type f); do + install -m 644 $file %{buildroot}%{_datadir}/pacemaker/nagios/plugins-metadata +done + + +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/rpm-state/%{name} + +%if %{with nls} +%find_lang %{name} +%endif + +# Don't package libtool archives +find %{buildroot} -name '*.la' -type f -print0 | xargs -0 rm -f + +# Do not package these either on CentOS Stream +rm -f %{buildroot}/%{_sbindir}/fence_legacy +rm -f %{buildroot}/%{_mandir}/man8/fence_legacy.* + +# For now, don't package the servicelog-related binaries built only for +# ppc64le when certain dependencies are installed. If they get more exercise by +# advanced users, we can reconsider. +rm -f %{buildroot}/%{_sbindir}/notifyServicelogEvent +rm -f %{buildroot}/%{_sbindir}/ipmiservicelogd + +# Byte-compile Python sources where suitable and the distro procedures known +%if %{defined py_byte_compile} +%{py_byte_compile %{python_path} %{buildroot}%{_datadir}/pacemaker/tests} +%if !%{defined _python_bytecompile_extra} +%{py_byte_compile %{python_path} %{buildroot}%{python_site}/cts} +%endif +%endif + +%post +%systemd_post pacemaker.service + +%preun +%systemd_preun pacemaker.service + +%postun +%systemd_postun_with_restart pacemaker.service + +%pre remote +# Stop the service before anything is touched, and remember to restart +# it as one of the last actions (compared to using systemd_postun_with_restart, +# this avoids suicide when sbd is in use) +systemctl --quiet is-active pacemaker_remote +if [ $? -eq 0 ] ; then + mkdir -p %{_localstatedir}/lib/rpm-state/%{name} + touch %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote + systemctl stop pacemaker_remote >/dev/null 2>&1 +else + rm -f %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote +fi + +%post remote +%systemd_post pacemaker_remote.service + +%preun remote +%systemd_preun pacemaker_remote.service + +%postun remote +# This next line is a no-op, because we stopped the service earlier, but +# we leave it here because it allows us to revert to the standard behavior +# in the future if desired +%systemd_postun_with_restart pacemaker_remote.service +# Explicitly take care of removing the flag-file(s) upon final removal +if [ "$1" -eq 0 ] ; then + rm -f %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote +fi + +%posttrans remote +if [ -e %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote ] ; then + systemctl start pacemaker_remote >/dev/null 2>&1 + rm -f %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote +fi + +%post cli +%systemd_post crm_mon.service +if [ "$1" -eq 2 ]; then + # Package upgrade, not initial install: + # Move any pre-2.0 logs to new location to ensure they get rotated + { mv -fbS.rpmsave %{_var}/log/pacemaker.log* %{_var}/log/pacemaker \ + || mv -f %{_var}/log/pacemaker.log* %{_var}/log/pacemaker + } >/dev/null 2>/dev/null || : +fi + +%preun cli +%systemd_preun crm_mon.service + +%postun cli +%systemd_postun_with_restart crm_mon.service + +%pre -n %{pkgname_pcmk_libs} +# @TODO Use sysusers.d: +# https://fedoraproject.org/wiki/Changes/Adopting_sysusers.d_format +getent group %{gname} >/dev/null || groupadd -r %{gname} -g %{hacluster_id} +getent passwd %{uname} >/dev/null || useradd -r -g %{gname} -u %{hacluster_id} -s /sbin/nologin -c "cluster user" %{uname} +exit 0 + +%ldconfig_scriptlets -n %{pkgname_pcmk_libs} +%ldconfig_scriptlets cluster-libs + +%files +########################################################### +%config(noreplace) %{_sysconfdir}/sysconfig/pacemaker +%{_sbindir}/pacemakerd + +%{_unitdir}/pacemaker.service + +%exclude %{_datadir}/pacemaker/nagios/plugins-metadata/* + +%exclude %{_libexecdir}/pacemaker/cts-log-watcher +%exclude %{_libexecdir}/pacemaker/cts-support +%exclude %{_sbindir}/pacemaker-remoted +%exclude %{_sbindir}/pacemaker_remoted +%{_libexecdir}/pacemaker/* + +%{_sbindir}/crm_master +%{_sbindir}/fence_watchdog + +%doc %{_mandir}/man7/pacemaker-controld.* +%doc %{_mandir}/man7/pacemaker-schedulerd.* +%doc %{_mandir}/man7/pacemaker-fenced.* +%doc %{_mandir}/man7/ocf_pacemaker_controld.* +%doc %{_mandir}/man7/ocf_pacemaker_remote.* +%doc %{_mandir}/man8/crm_master.* +%doc %{_mandir}/man8/fence_watchdog.* +%doc %{_mandir}/man8/pacemakerd.* + +%doc %{_datadir}/pacemaker/alerts + +%license licenses/GPLv2 +%doc COPYING +%doc ChangeLog + +%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/cib +%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/pengine +%{ocf_root}/resource.d/pacemaker/controld +%{ocf_root}/resource.d/pacemaker/remote + +%files cli +%dir %attr (750, root, %{gname}) %{_sysconfdir}/pacemaker +%config(noreplace) %{_sysconfdir}/logrotate.d/pacemaker +%config(noreplace) %{_sysconfdir}/sysconfig/crm_mon + +%{_unitdir}/crm_mon.service + +%{_sbindir}/attrd_updater +%{_sbindir}/cibadmin +%if %{with cibsecrets} +%{_sbindir}/cibsecret +%endif +%{_sbindir}/crm_attribute +%{_sbindir}/crm_diff +%{_sbindir}/crm_error +%{_sbindir}/crm_failcount +%{_sbindir}/crm_mon +%{_sbindir}/crm_node +%{_sbindir}/crm_resource +%{_sbindir}/crm_rule +%{_sbindir}/crm_standby +%{_sbindir}/crm_verify +%{_sbindir}/crmadmin +%{_sbindir}/iso8601 +%{_sbindir}/crm_shadow +%{_sbindir}/crm_simulate +%{_sbindir}/crm_report +%{_sbindir}/crm_ticket +%{_sbindir}/stonith_admin +# "dirname" is owned by -schemas, which is a prerequisite +%{_datadir}/pacemaker/report.collector +%{_datadir}/pacemaker/report.common +# XXX "dirname" is not owned by any prerequisite +%{_datadir}/snmp/mibs/PCMK-MIB.txt + +%exclude %{ocf_root}/resource.d/pacemaker/controld +%exclude %{ocf_root}/resource.d/pacemaker/o2cb +%exclude %{ocf_root}/resource.d/pacemaker/remote + +%dir %{ocf_root} +%dir %{ocf_root}/resource.d +%{ocf_root}/resource.d/pacemaker + +%doc %{_mandir}/man7/* +%exclude %{_mandir}/man7/pacemaker-controld.* +%exclude %{_mandir}/man7/pacemaker-schedulerd.* +%exclude %{_mandir}/man7/pacemaker-fenced.* +%exclude %{_mandir}/man7/ocf_pacemaker_controld.* +%exclude %{_mandir}/man7/ocf_pacemaker_o2cb.* +%exclude %{_mandir}/man7/ocf_pacemaker_remote.* +%doc %{_mandir}/man8/* +%exclude %{_mandir}/man8/crm_master.* +%exclude %{_mandir}/man8/fence_legacy.* +%exclude %{_mandir}/man8/fence_watchdog.* +%exclude %{_mandir}/man8/pacemakerd.* +%exclude %{_mandir}/man8/pacemaker-remoted.* + +%license licenses/GPLv2 +%doc COPYING +%doc ChangeLog + +%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker +%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/blackbox +%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/cores +%dir %attr (770, %{uname}, %{gname}) %{_var}/log/pacemaker +%dir %attr (770, %{uname}, %{gname}) %{_var}/log/pacemaker/bundles + +%files -n %{pkgname_pcmk_libs} %{?with_nls:-f %{name}.lang} +%{_libdir}/libcib.so.* +%{_libdir}/liblrmd.so.* +%{_libdir}/libcrmservice.so.* +%{_libdir}/libcrmcommon.so.* +%{_libdir}/libpe_status.so.* +%{_libdir}/libpe_rules.so.* +%{_libdir}/libpacemaker.so.* +%{_libdir}/libstonithd.so.* +%license licenses/LGPLv2.1 +%doc COPYING +%doc ChangeLog + +%files cluster-libs +%{_libdir}/libcrmcluster.so.* +%license licenses/LGPLv2.1 +%doc COPYING +%doc ChangeLog + +%files remote +%config(noreplace) %{_sysconfdir}/sysconfig/pacemaker +# state directory is shared between the subpackets +# let rpm take care of removing it once it isn't +# referenced anymore and empty +%ghost %dir %{_localstatedir}/lib/rpm-state/%{name} +%{_unitdir}/pacemaker_remote.service + +%{_sbindir}/pacemaker-remoted +%{_sbindir}/pacemaker_remoted +%{_mandir}/man8/pacemaker-remoted.* +%license licenses/GPLv2 +%doc COPYING +%doc ChangeLog + +%files doc +%doc %{pcmk_docdir} +%license licenses/CC-BY-SA-4.0 + +%files cts +%{python_site}/cts +%{_datadir}/pacemaker/tests + +%{_libexecdir}/pacemaker/cts-log-watcher +%{_libexecdir}/pacemaker/cts-support + +%license licenses/GPLv2 +%doc COPYING +%doc ChangeLog + +%files -n %{pkgname_pcmk_libs}-devel +%{_includedir}/pacemaker +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%license licenses/LGPLv2.1 +%doc COPYING +%doc ChangeLog + +%files schemas +%license licenses/GPLv2 +%dir %{_datadir}/pacemaker +%{_datadir}/pacemaker/*.rng +%{_datadir}/pacemaker/*.xsl +%{_datadir}/pacemaker/api +%{_datadir}/pacemaker/base +%{_datadir}/pkgconfig/pacemaker-schemas.pc + +%files nagios-plugins-metadata +%dir %{_datadir}/pacemaker/nagios +%dir %{_datadir}/pacemaker/nagios/plugins-metadata +%attr(0644,root,root) %{_datadir}/pacemaker/nagios/plugins-metadata/* +%license %{nagios_name}-%{nagios_hash}/COPYING + +%changelog +* Fri Mar 17 2023 MSVSphere Packaging Team - 2.1.4-5 +- Rebuilt for MSVSphere 9.1. + +* Wed Aug 10 2022 Ken Gaillot - 2.1.4-5 +- Fix regression in crm_resource -O +- Resolves: rhbz2089353 + +* Wed Jul 20 2022 Ken Gaillot - 2.1.4-3 +- stonith_admin --validate works again +- Resolves: rhbz2102292 + +* Tue Jun 28 2022 Ken Gaillot - 2.1.4-2 +- Restore crm_attribute query behavior when attribute does not exist +- Resolves: rhbz2099331 + +* Wed Jun 15 2022 Ken Gaillot - 2.1.4-1 +- Rebase pacemaker on upstream 2.1.4 final release +- Resolves: rhbz2072108 + +* Thu Jun 2 2022 Ken Gaillot - 2.1.3-2 +- Rebase pacemaker on upstream 2.1.3 final release +- Resolves: rhbz2072108 + +* Thu May 19 2022 Ken Gaillot - 2.1.3-1 +- Unable to show metadata for "service" agents with "@" and "." in the name +- Resource ocf:pacemaker:attribute does not comply with the OCF 1.1 standard +- Pacemaker does not convert & to & when generating metadata for non-ocf agents +- Rebase pacemaker on upstream 2.1.3 release +- Resolves: rhbz2045110 +- Resolves: rhbz2049720 +- Resolves: rhbz2050259 +- Resolves: rhbz2072108 + +* Wed Jan 26 2022 Ken Gaillot - 2.1.2-4 +- Fix regression in down event detection that affects remote nodes +- Resolves: rhbz2039399 + +* Mon Jan 24 2022 Ken Gaillot - 2.1.2-3 +- Detect an unresponsive subdaemon +- Handle certain probe failures as stopped instead of failed +- Update pcmk_delay_base option meta-data +- Avoid crash when using clone notifications +- Retry Corosync shutdown tracking if first attempt fails +- Improve display of failed actions +- Resolves: rhbz1707851 +- Resolves: rhbz2039982 +- Resolves: rhbz2032032 +- Resolves: rhbz2040443 +- Resolves: rhbz2042367 +- Resolves: rhbz2042546 + +* Thu Dec 16 2021 Ken Gaillot - 2.1.2-2 +- Correctly get metadata for systemd agent names that end in '@' +- Use correct OCF 1.1 syntax in ocf:pacemaker:Stateful meta-data +- Fix regression in displayed times in crm_mon's fence history +- Resolves: rhbz2032031 +- Resolves: rhbz2032032 +- Resolves: rhbz2031765 + +* Tue Nov 30 2021 Ken Gaillot - 2.1.2-1 +- Rebase on upstream 2.1.2 +- Resolves: rhbz2011974 + +* Fri Aug 20 2021 Ken Gaillot - 2.1.0-11 +- Fix XML issue with fence_watchdog meta-data +- Resolves: rhbz1988568 + +* Thu Aug 12 2021 Ken Gaillot - 2.1.0-10 +- Fix minor issue with crm_resource error message change +- Resolves: rhbz1983196 + +* Wed Aug 11 2021 Ken Gaillot - 2.1.0-9 +- Fix watchdog agent version information +- Ensure transient attributes are cleared when multiple nodes are lost +- Resolves: rhbz1988568 +- Resolves: rhbz1989292 + +* Mon Aug 09 2021 Mohan Boddu - 2.1.0-7.1 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Aug 06 2021 Ken Gaillot - 2.1.0-7 +- Allow configuring specific nodes to use watchdog-only sbd for fencing +- Resolves: rhbz1988568 + +* Fri Jul 30 2021 Ken Gaillot - 2.1.0-6 +- Avoid selecting wrong device when dynamic-list fencing is used with host map +- Show better error messages in crm_resource with invalid resource types +- Do not schedule probes of unmanaged resources on pending nodes +- Fix argument handling regressions in crm_attribute and wrappers +- Resolves: rhbz1978013 +- Resolves: rhbz1983196 +- Resolves: rhbz1983197 +- Resolves: rhbz1984130 + +* Wed Jun 30 2021 Ken Gaillot - 2.1.0-5 +- crm_resource now supports XML output from resource agent actions +- Correct output for crm_simulate --show-failcounts +- Avoid remote node unfencing loop +- Resolves: rhbz1975380 +- Resolves: rhbz1975386 +- Resolves: rhbz1975388 + +* Thu Jun 10 2021 Ken Gaillot - 2.1.0-4 +- Rebase on upstream 2.1.0 final release +- Resolves: rhbz1936023 + +* Tue Jun 1 2021 Ken Gaillot - 2.1.0-3 +- Rebase on upstream 2.1.0-rc3 release +- Resolves: rhbz1936023 + +* Wed May 26 2021 Ken Gaillot - 2.1.0-2 +- Include recent post-rc2 fixes with rebase +- Resolves: rhbz1936023 + +* Wed May 12 2021 Ken Gaillot - 2.1.0-1 +- Default resource-stickiness to 1 in newly created clusters +- Rebase on upstream 2.1.0-rc2 release +- Resolves: rhbz1850145 +- Resolves: rhbz1936023 + +* Fri Apr 16 2021 Mohan Boddu - 2.0.5-10.2 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 2.0.5-10.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Dec 7 2020 Klaus Wenninger - 2.0.5-10 +- Conflicts of doc package introduced to fix upgrade/downgrade + issues needs to be independent from arch + +* Fri Dec 4 2020 Klaus Wenninger - 2.0.5-9 +- Make doc-package conflict with wrong version of libs + to fix upgrade/downgrade issues + +* Fri Dec 4 2020 Klaus Wenninger - 2.0.5-8 +- Update for new upstream release tarball: Pacemaker-2.0.5 + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.5 + +* Wed Nov 18 2020 Klaus Wenninger - 2.0.5-0.7.rc3 +- a little more syncing with upstream spec-file + +* Tue Nov 17 2020 Klaus Wenninger - 2.0.5-0.6.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.5-rc3 + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.5-rc3 +- Corosync in Fedora now provides corosync-devel as well in isa-flavor + +* Sun Nov 1 2020 Klaus Wenninger - 2.0.5-0.5.rc2 +- remove no more working dist.rpmdeplint from gating + +* Fri Oct 30 2020 Klaus Wenninger - 2.0.5-0.4.rc2 +- never use spec-variables in changelog +- replace dist.depcheck by dist.rpmdeplint +- do gate stable as well to be effective on rawhide + +* Fri Oct 30 2020 Klaus Wenninger - 2.0.5-0.3.rc2 +- revert dependency corosync-devel back to corosynclib-devel as long + as corosynclib-devel-package doesn't provide corosync-devel(isa) + we would need for pacemaker-libs-devel to require +- enable some basic gating-tests +- re-add building documentation using publican to everything but ELN +- rename doc-dir for ELN + +* Wed Oct 28 2020 Klaus Wenninger - 2.0.5-0.2.rc2 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.5-rc2, + includes fix for CVE-2020-25654 + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.5-rc2 + +* Thu Oct 22 2020 Klaus Wenninger - 2.0.5-0.1.rc1 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.5-rc1, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.5-rc1 +- Disable building of documentation - as not to pull in publican +- Remove dependencies to nagios-plugins from metadata-package +- some sync with structure of upstream spec-file +- removed some legacy conditionals +- added with-cibsecrets + +* Tue Jul 28 2020 Fedora Release Engineering - 2.0.4-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jun 16 2020 Chris Lumens - 2.0.4-1 +- Update for new upstream tarball: Pacemaker-2.0.4 + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.4 + +* Thu Jun 04 2020 Chris Lumens - 2.0.4-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.4-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.4-rc3 + +* Tue May 26 2020 Miro Hrončok - 2.0.4-0.2.rc1.1 +- Rebuilt for Python 3.9 + +* Wed May 13 2020 Chris Lumens - 2.0.4-0.2.rc1 +- Rebuilt for libqb 2.0. + +* Mon May 04 2020 Chris Lumens - 2.0.4-0.1.rc1 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.4-rc1, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.4-rc1 + +* Fri Mar 06 2020 Jan Pokorný - 2.0.3-4 +- return back to building also for s390x architecture, previous obstacle + was identified and interim fix (way to build along with one actual bugfix + as raised along) applied (RHBZ#1799842) + +* Wed Mar 04 2020 Jan Pokorný - 2.0.3-3 +- include upstream fix for buildability with GCC 10 (PR #1968) +- omit s390x architecture for now, compilation would fail at this time + +* Wed Jan 29 2020 Fedora Release Engineering - 2.0.3-2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Nov 26 2019 Jan Pokorný - 2.0.3-1 +- Update for new upstream tarball: Pacemaker-2.0.3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.3 + (functionally identical to 2.0.3-rc3, new build mostly to fix a memory + leak & allow for easy glibc ~2.31+ friendly switch away from ftime(3)) +- Fix unability to build with Inkscape 1.0 beta (and possibly beyond) + +* Thu Nov 14 2019 Jan Pokorný - 2.0.3-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.3-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.3-rc3 +- Fix failure to build due to using obsolete ftime(3) + +* Wed Nov 06 2019 Jan Pokorný - 2.0.3-0.1.rc2 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.3-rc2, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.3-rc2 + +* Thu Oct 03 2019 Miro Hrončok - 2.0.2-1.3 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 2.0.2-1.2 +- Rebuilt for Python 3.8 + +* Thu Jul 25 2019 Fedora Release Engineering - 2.0.2-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Jun 07 2019 Jan Pokorný - 2.0.2-1 +- Update for new upstream tarball: Pacemaker-2.0.2, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.2 + (functionally identical to 2.0.2-rc3, new build mostly to match expectations) + +* Fri May 31 2019 Jan Pokorný - 2.0.2-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.2-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.2-rc3 +- Adapt spec file more akin to upstream version including: + . /usr/share/pacemaker now owned by -schemas, its "api" subdirectory + is not carried redundantly in -cli anymore (f05eb7eec) + +* Tue May 28 2019 Jan Pokorný - 2.0.2-0.1.rc2 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.2-rc2, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.2-rc2 + +* Thu Apr 25 2019 Jan Pokorný - 2.0.2-0.1.rc1 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.2-rc1, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.2-rc1 +- Customize (as allowed now) exhibited downstream-specific bug reporting URL +- Adapt spec file more akin to upstream version including: + . sbd ABI compatible version enforcement (37ad2bea1) + +* Wed Apr 17 2019 Jan Pokorný - 2.0.1-2 +- Apply fixes for security issues: + . CVE-2019-3885 (use-after-free with potential information disclosure) + . CVE-2018-16877 (insufficient local IPC client-server authentication) + . CVE-2018-16878 (insufficient verification inflicted preference of + uncontrolled processes) + +* Tue Mar 05 2019 Jan Pokorný - 2.0.1-1 +- Update for new upstream tarball: Pacemaker-2.0.1, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.1 + +* Thu Feb 28 2019 Jan Pokorný - 2.0.1-0.4.rc5 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.1-rc5, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.1-rc5 +- Reflect that cts-scheduler tests are fully compatible with whatever recent + glib version that gets to be used in run-time (incl. buildroot tests) again + +* Mon Feb 04 2019 Jan Pokorný - 2.0.1-0.3.rc4 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.1-rc4, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.1-rc4 +- Conditionally disable "hash affected tests" in cts-scheduler (-cts package), + since it is unlikely glib v2.59.0+ present in the buildroot will be + artificially downgraded post-deployment + +* Fri Feb 01 2019 Fedora Release Engineering - 2.0.1-0.2.rc3.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Jan 22 2019 Jan Pokorný - 2.0.1-0.2.rc3 +- Fix buildability with GCC 9 (PR #1681) +- Apply minor crm_mon XML output fix (PR #1678) + +* Sun Jan 20 2019 Jan Pokorný - 2.0.1-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.1-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.1-rc3 +- Adapt spec file more akin to upstream version including: + . split a dedicated, noarch -schemas package (c6a87bd86) + . make static dependencies on inner libraries arch-specific (14bfff68e) + . weak co-dependence of -cli with -remote & pacemaker proper (73e2c94a3) + . declare bundled gnulib (d57aa84c1) +- Move stonith_admin to -cli where it belongs, since it doesn't require + -cluster-libs (considered by upstream) +- Apply patches to restore basic buildability (still without much run-time + reproducibility guarantees compared to what's been customary prior to glib + v2.59.0+ that may now get run-time linked upon its fresh installation/update, + but this applies also to whatever older version of pacemaker, and wasn't + discovered until now; cf. https://github.com/ClusterLabs/pacemaker/pull/1677) + +* Thu Aug 23 2018 Jan Pokorný - 2.0.0-4 +- Sanitize/generalize approach to Python byte-compilation, so that also + out-of-Python-path *.py files (%%{_datadir}/pacemaker/tests/cts/CTSlab.py + in particular) get the expected treatment now + +* Wed Aug 15 2018 Jan Pokorný - 2.0.0-3 +- Fix Python 3.7 incompatibility (otherwise missed in bytecompilation phase, + see rhbz#1616219) + +* Thu Aug 09 2018 Jan Pokorný - 2.0.0-2 +- Include fix for "cibadmin --upgrade" related issues (rhbz#1611631) +- Adapt spec file more akin to upstream version including: + . assuredly skip servicelog-related binaries even when build-time + prerequisites are present on suitable systems (9f24448d8) + +* Mon Jul 09 2018 Jan Pokorný - 2.0.0-1 +- Update for new upstream tarball: Pacemaker-2.0.0, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.0 + +* Mon Jul 02 2018 Miro Hrončok - 2.0.0-0.1.rc6.1 +- Rebuilt for Python 3.7 + +* Thu Jun 28 2018 Jan Pokorný - 2.0.0-0.1.rc6 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.0-rc6, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.0-rc6 +- Adapt spec file more akin to upstream version including: + . new procps-ng and psmisc dependencies with -cli and -cts, for e.g. + "ps/sysctl/uptime" and "killall" invocations, respectively (a4ad8183a) + . move crm_node to -cli (a94a1ed58) + +* Tue Jun 19 2018 Miro Hrončok - 2.0.0-0.1.rc5.1 +- Rebuilt for Python 3.7 + +* Fri Jun 01 2018 Jan Pokorný - 2.0.0-0.1.rc5 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.0-rc5, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.0-rc5 +- Adapt spec file more akin to upstream version including: + . new coreutils dependency for "post" scriptlet of -cli, + for "mv" invocation (c2b16165d) + +* Wed May 16 2018 Jan Pokorný - 2.0.0-0.1.rc4 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.0-rc4, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.0-rc4 + . as a special note, previous release candidate, rc3, had rolling upgrades + broken, and if that is required, that particular release shall be + skipped in the upgrade path altogether +- Adapt spec file more akin to upstream version including: + . as part of the update process, possibly move old log files as implicitly + used prior to 2.0 so there's a (limited) continuity with the new implicit + location, preventing clutter and confusion (ce2e74c99, c2b16165d) + . move cts-exec-helper from -cli under main package (a2dc2a67e) + . -cts backed with new helpers and, tangentially, dummy systemd service + file transiently generated on-demand again (fa2d43445, d52b001b1) + +* Wed May 02 2018 Jan Pokorný - 2.0.0-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.0-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.0-rc3 + . IMPORTANT: this release candidate, rc3, has rolling upgrades broken, + and if that is required, this particular release shall be + skipped in the upgrade path altogether +- Adapt spec file more akin to upstream version including: + . new --without legacy_links conditional (c8a7e5225) + . reflect name change of the auxiliary daemons + (e4f4a0d64, db5536e40, e2fdc2bac + 9ecbfea1c, 038c465e2 + ed8ce4055a) + . new dummy systemd service for -cts (bf0a22812) + . honor system-wide crypto policies once for all, via package-build-time + configurable "pcmk_gnutls_priorities" defaulting to @SYSTEM as prescribed + in https://fedoraproject.org/wiki/Packaging:CryptoPolicies + (based on b3dfce1d3) +- Adapt spec file akin to current packaging guidelines including: + . make -nagios-plugins-metadata package noarch + +* Mon Apr 09 2018 Jan Pokorný - 2.0.0-0.1.rc2 +- Update for new upstream tarball for release candidate: Pacemaker-2.0.0-rc2, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.0-rc2 +- Adapt spec file more akin to upstream version including: + . out-of-tree change from 1.1.18-2 build got subsumed (508ad52e7) + . %%{_sysconfdir}/pacemaker path got properly owned + (-cli package; f6e3ab98d) + . -libs package started to properly declare Requires(pre): shadow-utils + (293fcc1e8 + b3d49d210) + . some build conditionals and dependencies dropped for no longer + (snmp, esmtp; f24bdc6f2 and 1f7374884, respectively) or never + being relevant (~bison, byacc, flex; 61aef8af4) + . some dependencies were constrained with new or higher lower bounds: + corosync needs to be of version 2+ unconditionally (ccd58fe29), + ditto some others components (~GLib, 1ac2e7cbb), plus both 2 and 3 + versions of Python are now (comprehensively for the auxiliary + functionality where used) supported upstream with the latter being + a better fit (453355f8f) + . package descriptions got to reflect the drop of legacy low-level + cluster infrastructures (55ab749bf) +- Adapt spec file akin to current packaging guidelines including: + . drop some redundant/futile expressions (defattr, "-n %%{name}-libs" + instead of plain "libs", "timezone hack"), add some notes for future + . make -cts and -doc packages noarch (former enabled with 088a5e7d4) + . simplify "systemd_requires" macro invocation, and relax it to + "systemd_ordering" for -remote package where possible so as not + to drag systemd into a lightweight system setup (e.g. container) + needlessly + . adjust, in a compatible way, common ldconfig invocation with + post{,un} scriptlets + (https://fedoraproject.org/wiki/Changes/Removing_ldconfig_scriptlets) + . drop some more unuseful conditionals (upstart_job) +- Apply some regression fixes on top as patches (PR #1457, #1459) + +* Wed Feb 21 2018 Iryna Shcherbina - 1.1.18-2.2 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Thu Feb 08 2018 Fedora Release Engineering - 1.1.18-2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Nov 16 2017 Jan Pokorný - 1.1.18-2 +- Make sure neither of pacemaker{,_remoted} is process-limited + +* Wed Nov 15 2017 Jan Pokorný - 1.1.18-1 +- Update for new upstream tarball: Pacemaker-1.1.18, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.18 +- Make -libs-devel package dependencies arch-qualified + (-cts hasn't been switched at this time, pending further cleanup) + +* Fri Nov 03 2017 Jan Pokorný - 1.1.18-0.1.rc4 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.18-rc4, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.18-rc4 + +* Thu Oct 26 2017 Jan Pokorný - 1.1.18-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.18-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.18-rc3 + +* Mon Oct 16 2017 Jan Pokorný - 1.1.18-0.1.rc2 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.18-rc2, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.18-rc2 +- Fix check scriptlet so as to work properly also with rpm<4.14 (not strictly + required since: https://github.com/rpm-software-management/rpm/pull/249, + but pragmatically follow the upstream) + +* Thu Aug 03 2017 Fedora Release Engineering - 1.1.17-1.2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 1.1.17-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Jul 07 2017 Jan Pokorný - 1.1.17-1 +- Update for new upstream tarball: Pacemaker-1.1.17, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.17 + +* Thu Jun 22 2017 Jan Pokorný - 1.1.17-0.1.rc4 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.17-rc4, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.17-rc4 +- Add an imposed lower bound for glib2 BuildRequires + +* Thu Jun 01 2017 Jan Pokorný - 1.1.17-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.17-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.17-rc3 + +* Wed May 24 2017 Jan Pokorný - 1.1.17-0.1.rc2 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.17-rc2, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.17-rc2 + +* Tue May 09 2017 Jan Pokorný - 1.1.17-0.1.rc1 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.17-rc1, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.17-rc1 + +* Mon Feb 06 2017 Jan Pokorný - 1.1.16-2.a39ea6491.git +- Update for (slightly stabilized) snapshot beyond Pacemaker-1.1.16 + (commit a39ea6491), including: + . prevent FTBFS with new GCC 7 (a7476dd96) +- Adapt spec file more akin to upstream version including: + . better pre-release vs. tags logic (4581d4366) + +* Fri Dec 02 2016 Jan Pokorný - 1.1.16-1 +- Update for new upstream tarball: Pacemaker-1.1.16, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.16 +- Adapt spec file more akin to upstream version including: + . clarify licensing, especially for -doc (f01f734) + . fix pacemaker-remote upgrade (779e0e3) + . require python >= 2.6 (31ef7f0) + . older libqb is sufficient (based on 30fe1ce) + . remove openssl-devel and libselinux-devel as BRs (2e05c17) + . make systemd BR pkgconfig-driven (6285924) + . defines instead of some globals + error suppression (625d427) +- Rectify -nagios-plugins-metadata declared license and install + also respective license text + +* Thu Nov 03 2016 Jan Pokorný - 1.1.15-3 +- Apply fix for CVE-2016-7035 (improper IPC guarding) + +* Tue Jul 19 2016 Fedora Release Engineering - 1.1.15-2.1 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Jul 07 2016 Jan Pokorný - 1.1.15-2 +- Stop building with -fstack-protector-all using the upstream patches + overhauling toolchain hardening (Fedora natively uses + -fstack-protector-strong so this effectively relaxed stack protection + is the only effect as hardened flags are already used by default: + https://fedoraproject.org/wiki/Changes/Harden_All_Packages) + +* Wed Jun 22 2016 Jan Pokorný - 1.1.15-1 +- Update for new upstream tarball: Pacemaker-1.1.15, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.15 +- Adapt spec file more akin to upstream version: + . move xml schema files + PCMK-MIB.txt (81ef956), logrotate configuration + file (ce576cf; drop it from -remote package as well), attrd_updater + (aff80ae), the normal resource agents (1fc7287), and common directories + under /var/lib/pacemaker (3492794) from main package under -cli + . simplify docdir build parameter passing and drop as of now + redundant chmod invocations (e91769e) + +* Fri May 27 2016 Jan Pokorný - 1.1.15-0.1.rc3 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.15-rc3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.15-rc3 +- Drop fence_pcmk (incl. man page) from the package (no use where no CMAN) +- Drop license macro emulation for cases when not supported natively + (several recent Fedora releases do not need that) + +* Mon May 16 2016 Jan Pokorný - 1.1.15-0.1.rc2 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.15-rc2, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.15-rc2 + +* Tue Apr 26 2016 Jan Pokorný - 1.1.15-0.1.rc1 +- Update for new upstream tarball for release candidate: Pacemaker-1.1.15-rc1, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.15-rc1 +- Adapt spec file more akin to upstream version (also to reflect recent + changes like ability to built explicitly without Publican-based docs) + +* Thu Mar 31 2016 Jan Pokorný - 1.1.14-2.5a6cdd1.git +- Update for currently stabilized snapshot beyond Pacemaker-1.1.14 + (commit 5a6cdd1), but restore old-style notifications to the state at + Pacemaker-1.1.14 point release (disabled) +- Definitely get rid of Corosync v1 (Flatiron) hypothetical support +- Remove some of the spec file cruft, not required for years + (BuildRoot, AutoReqProv, "clean" scriptlet, etc.) and adapt the file + per https://github.com/ClusterLabs/pacemaker/pull/965 + +* Thu Feb 04 2016 Fedora Release Engineering - 1.1.14-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Mon Jan 18 2016 Jan Pokorný - 1.1.14-1 +- Update for new upstream tarball: Pacemaker-1.1.14, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.14 +- Disable Fedora crypto policies conformance patch for now (rhbz#1179335) +- Better align specfile with the upstream version (also fix issue with + crm_mon sysconfig file not being installed) +- Further specfile modifications: + - drop unused gcc-c++ and repeatedly mentioned pkgconfig packages + from BuildRequires + - refer to python_sitearch macro first, if defined + - tolerate license macro not being defined (e.g., for EPEL rebuilds) +- Prevent console mode not available in crm_mon due to curses library test + fragility of configure script in hardened build environment (rhbz#1297985) + +* Tue Oct 20 2015 Jan Pokorný - 1.1.13-4 +- Adapt to follow Fedora crypto policies (rhbz#1179335) + +* Wed Oct 14 2015 Jan Pokorný - 1.1.13-3 +- Update to Pacemaker-1.1.13 post-release + patches (sync) +- Add nagios-plugins-metadata subpackage enabling support of selected + Nagios plugins as resources recognized by Pacemaker +- Several specfile improvements: drop irrelevant stuff, rehash the + included/excluded files + dependencies, add check scriptlet, + reflect current packaging practice, do minor cleanups + (mostly adopted from another spec) + +* Thu Aug 20 2015 Andrew Beekhof - 1.1.13-2 +- Update for new upstream tarball: Pacemaker-1.1.13 +- See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/main/ChangeLog for full details + +* Thu Jun 18 2015 Fedora Release Engineering - 1.1.12-2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Nov 05 2014 Andrew Beekhof - 1.1.12-2 +- Address incorrect use of the dbus API for interacting with systemd + +* Tue Oct 28 2014 Andrew Beekhof - 1.1.12-1 +- Update for new upstream tarball: Pacemaker-1.1.12+ (a9c8177) +- See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/main/ChangeLog for full details + +* Sun Aug 17 2014 Fedora Release Engineering - 1.1.11-1.2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Fri Jun 06 2014 Fedora Release Engineering - 1.1.11-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue Feb 18 2014 Andrew Beekhof - 1.1.11-1 +- Update for new upstream tarball: Pacemaker-1.1.11 (9d39a6b) +- See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/main/ChangeLog for full details + +* Thu Jun 20 2013 Andrew Beekhof - 1.1.9-3 +- Update to upstream 7d8acec +- See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/main/ChangeLog for full details + + + Feature: Turn off auto-respawning of systemd services when the cluster starts them + + Fix: crmd: Ensure operations for cleaned up resources don't block recovery + + Fix: logging: If SIGTRAP is sent before tracing is turned on, turn it on instead of crashing + +* Mon Jun 17 2013 Andrew Beekhof - 1.1.9-2 +- Update for new upstream tarball: 781a388 +- See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/main/ChangeLog for full details + +* Wed May 12 2010 Andrew Beekhof - 1.1.2-1 +- Update the tarball from the upstream 1.1.2 release +- See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/main/ChangeLog for full details + +* Tue Jul 14 2009 Andrew Beekhof - 1.0.4-1 +- Initial checkin