import pacemaker-2.0.5-8.el8
This commit is contained in:
parent
e0f6d5b090
commit
513d314720
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
SOURCES/nagios-agents-metadata-105ab8a.tar.gz
|
||||
SOURCES/pacemaker-2deceaa.tar.gz
|
||||
SOURCES/pacemaker-ba59be7.tar.gz
|
||||
|
@ -1,2 +1,2 @@
|
||||
ea6c0a27fd0ae8ce02f84a11f08a0d79377041c3 SOURCES/nagios-agents-metadata-105ab8a.tar.gz
|
||||
78c94fdcf59cfb064d4433e1b8f71fd856eeec5f SOURCES/pacemaker-2deceaa.tar.gz
|
||||
268769bcd0d6c2ea2d50db92aaea0f31637775d0 SOURCES/pacemaker-ba59be7.tar.gz
|
||||
|
704
SOURCES/001-feature-set.patch
Normal file
704
SOURCES/001-feature-set.patch
Normal file
@ -0,0 +1,704 @@
|
||||
From d81282f1ac5e1226fbf6cfa1bd239d317e106def Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Tue, 13 Oct 2020 10:08:21 +0200
|
||||
Subject: [PATCH 1/3] Feature: crmadmin: implement formatted output
|
||||
|
||||
---
|
||||
include/crm/crm.h | 2 +-
|
||||
tools/crmadmin.c | 312 ++++++++++++++++++++++++++++++++++++++++--------------
|
||||
2 files changed, 232 insertions(+), 82 deletions(-)
|
||||
|
||||
diff --git a/include/crm/crm.h b/include/crm/crm.h
|
||||
index 389b6aa..4eca278 100644
|
||||
--- a/include/crm/crm.h
|
||||
+++ b/include/crm/crm.h
|
||||
@@ -51,7 +51,7 @@ extern "C" {
|
||||
* >=3.0.13: Fail counts include operation name and interval
|
||||
* >=3.2.0: DC supports PCMK_LRM_OP_INVALID and PCMK_LRM_OP_NOT_CONNECTED
|
||||
*/
|
||||
-# define CRM_FEATURE_SET "3.6.1"
|
||||
+# define CRM_FEATURE_SET "3.6.2"
|
||||
|
||||
# define EOS '\0'
|
||||
# define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) )
|
||||
diff --git a/tools/crmadmin.c b/tools/crmadmin.c
|
||||
index 0b87d01..14078e6 100644
|
||||
--- a/tools/crmadmin.c
|
||||
+++ b/tools/crmadmin.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <crm/cib.h>
|
||||
#include <crm/msg_xml.h>
|
||||
#include <crm/common/cmdline_internal.h>
|
||||
+#include <crm/common/output_internal.h>
|
||||
#include <crm/common/xml.h>
|
||||
#include <crm/common/iso8601.h>
|
||||
#include <crm/common/ipc_controld.h>
|
||||
@@ -38,7 +39,6 @@ bool need_controld_api = true;
|
||||
bool need_pacemakerd_api = false;
|
||||
|
||||
bool do_work(pcmk_ipc_api_t *api);
|
||||
-void do_find_node_list(xmlNode *xml_node);
|
||||
static char *ipc_name = NULL;
|
||||
|
||||
gboolean admin_message_timeout(gpointer data);
|
||||
@@ -55,13 +55,12 @@ static enum {
|
||||
|
||||
static gboolean BE_VERBOSE = FALSE;
|
||||
static gboolean BASH_EXPORT = FALSE;
|
||||
-static gboolean BE_SILENT = FALSE;
|
||||
static char *dest_node = NULL;
|
||||
static crm_exit_t exit_code = CRM_EX_OK;
|
||||
+pcmk__output_t *out = NULL;
|
||||
|
||||
|
||||
struct {
|
||||
- gboolean quiet;
|
||||
gboolean health;
|
||||
gint timeout;
|
||||
} options;
|
||||
@@ -168,6 +167,191 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+PCMK__OUTPUT_ARGS("health", "char *", "char *", "char *", "char *")
|
||||
+static int
|
||||
+health_text(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *sys_from = va_arg(args, char *);
|
||||
+ char *host_from = va_arg(args, char *);
|
||||
+ char *fsa_state = va_arg(args, char *);
|
||||
+ char *result = va_arg(args, char *);
|
||||
+
|
||||
+ if (!out->is_quiet(out)) {
|
||||
+ out->info(out, "Status of %s@%s: %s (%s)", crm_str(sys_from),
|
||||
+ crm_str(host_from), crm_str(fsa_state), crm_str(result));
|
||||
+ } else if (fsa_state != NULL) {
|
||||
+ out->info(out, "%s", fsa_state);
|
||||
+ }
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("health", "char *", "char *", "char *", "char *")
|
||||
+static int
|
||||
+health_xml(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *sys_from = va_arg(args, char *);
|
||||
+ char *host_from = va_arg(args, char *);
|
||||
+ char *fsa_state = va_arg(args, char *);
|
||||
+ char *result = va_arg(args, char *);
|
||||
+
|
||||
+ xmlNodePtr node = pcmk__output_create_xml_node(out, crm_str(sys_from));
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "node_name", (pcmkXmlStr) crm_str(host_from));
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "state", (pcmkXmlStr) crm_str(fsa_state));
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "result", (pcmkXmlStr) crm_str(result));
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("pacemakerd-health", "char *", "char *", "char *")
|
||||
+static int
|
||||
+pacemakerd_health_text(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *sys_from = va_arg(args, char *);
|
||||
+ char *state = va_arg(args, char *);
|
||||
+ char *last_updated = va_arg(args, char *);
|
||||
+
|
||||
+ if (!out->is_quiet(out)) {
|
||||
+ out->info(out, "Status of %s: '%s' %s %s", crm_str(sys_from),
|
||||
+ crm_str(state), (!pcmk__str_empty(last_updated))?
|
||||
+ "last updated":"", crm_str(last_updated));
|
||||
+ } else {
|
||||
+ out->info(out, "%s", crm_str(state));
|
||||
+ }
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("pacemakerd-health", "char *", "char *", "char *")
|
||||
+static int
|
||||
+pacemakerd_health_xml(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *sys_from = va_arg(args, char *);
|
||||
+ char *state = va_arg(args, char *);
|
||||
+ char *last_updated = va_arg(args, char *);
|
||||
+
|
||||
+
|
||||
+ xmlNodePtr node = pcmk__output_create_xml_node(out, crm_str(sys_from));
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "state", (pcmkXmlStr) crm_str(state));
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "last_updated", (pcmkXmlStr) crm_str(last_updated));
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("dc", "char *")
|
||||
+static int
|
||||
+dc_text(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *dc = va_arg(args, char *);
|
||||
+
|
||||
+ if (!out->is_quiet(out)) {
|
||||
+ out->info(out, "Designated Controller is: %s", crm_str(dc));
|
||||
+ } else if (dc != NULL) {
|
||||
+ out->info(out, "%s", dc);
|
||||
+ }
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("dc", "char *")
|
||||
+static int
|
||||
+dc_xml(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *dc = va_arg(args, char *);
|
||||
+
|
||||
+ xmlNodePtr node = pcmk__output_create_xml_node(out, "dc");
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "node_name", (pcmkXmlStr) crm_str(dc));
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("crmadmin-node-list", "xmlNode *")
|
||||
+static int
|
||||
+crmadmin_node_list(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ xmlNode *xml_node = va_arg(args, xmlNode *);
|
||||
+ int found = 0;
|
||||
+ xmlNode *node = NULL;
|
||||
+ xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node);
|
||||
+
|
||||
+ out->begin_list(out, NULL, NULL, "Nodes");
|
||||
+
|
||||
+ for (node = first_named_child(nodes, XML_CIB_TAG_NODE); node != NULL;
|
||||
+ node = crm_next_same_xml(node)) {
|
||||
+ const char *node_type = BASH_EXPORT ? NULL :
|
||||
+ crm_element_value(node, XML_ATTR_TYPE);
|
||||
+ out->message(out, "crmadmin-node", node_type,
|
||||
+ crm_str(crm_element_value(node, XML_ATTR_UNAME)),
|
||||
+ crm_str(crm_element_value(node, XML_ATTR_ID)));
|
||||
+
|
||||
+ found++;
|
||||
+ }
|
||||
+ // @TODO List Pacemaker Remote nodes that don't have a <node> entry
|
||||
+
|
||||
+ out->end_list(out);
|
||||
+
|
||||
+ if (found == 0) {
|
||||
+ out->info(out, "No nodes configured");
|
||||
+ }
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("crmadmin-node", "char *", "char *", "char *")
|
||||
+static int
|
||||
+crmadmin_node_text(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *type = va_arg(args, char *);
|
||||
+ char *name = va_arg(args, char *);
|
||||
+ char *id = va_arg(args, char *);
|
||||
+
|
||||
+ if (BASH_EXPORT) {
|
||||
+ out->info(out, "export %s=%s", crm_str(name), crm_str(id));
|
||||
+ } else {
|
||||
+ out->info(out, "%s node: %s (%s)", type ? type : "member",
|
||||
+ crm_str(name), crm_str(id));
|
||||
+ }
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+PCMK__OUTPUT_ARGS("crmadmin-node", "char *", "char *", "char *")
|
||||
+static int
|
||||
+crmadmin_node_xml(pcmk__output_t *out, va_list args)
|
||||
+{
|
||||
+ char *type = va_arg(args, char *);
|
||||
+ char *name = va_arg(args, char *);
|
||||
+ char *id = va_arg(args, char *);
|
||||
+
|
||||
+ xmlNodePtr node = pcmk__output_create_xml_node(out, "crmadmin-node");
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "type", (pcmkXmlStr) (type ? type : "member"));
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "name", (pcmkXmlStr) crm_str(name));
|
||||
+ xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) crm_str(id));
|
||||
+
|
||||
+ return pcmk_rc_ok;
|
||||
+}
|
||||
+
|
||||
+static pcmk__message_entry_t fmt_functions[] = {
|
||||
+ {"health", "default", health_text },
|
||||
+ {"health", "xml", health_xml },
|
||||
+ {"pacemakerd-health", "default", pacemakerd_health_text },
|
||||
+ {"pacemakerd-health", "xml", pacemakerd_health_xml },
|
||||
+ {"dc", "default", dc_text },
|
||||
+ {"dc", "xml", dc_xml },
|
||||
+ {"crmadmin-node-list", "default", crmadmin_node_list },
|
||||
+ {"crmadmin-node", "default", crmadmin_node_text },
|
||||
+ {"crmadmin-node", "xml", crmadmin_node_xml },
|
||||
+
|
||||
+ { NULL, NULL, NULL }
|
||||
+};
|
||||
+
|
||||
+static pcmk__supported_format_t formats[] = {
|
||||
+ PCMK__SUPPORTED_FORMAT_TEXT,
|
||||
+ PCMK__SUPPORTED_FORMAT_XML,
|
||||
+ { NULL, NULL, NULL }
|
||||
+};
|
||||
+
|
||||
static void
|
||||
quit_main_loop(crm_exit_t ec)
|
||||
{
|
||||
@@ -191,7 +375,7 @@ controller_event_cb(pcmk_ipc_api_t *controld_api,
|
||||
switch (event_type) {
|
||||
case pcmk_ipc_event_disconnect:
|
||||
if (exit_code == CRM_EX_DISCONNECT) { // Unexpected
|
||||
- fprintf(stderr, "error: Lost connection to controller\n");
|
||||
+ out->err(out, "error: Lost connection to controller");
|
||||
}
|
||||
goto done;
|
||||
break;
|
||||
@@ -209,14 +393,14 @@ controller_event_cb(pcmk_ipc_api_t *controld_api,
|
||||
}
|
||||
|
||||
if (status != CRM_EX_OK) {
|
||||
- fprintf(stderr, "error: Bad reply from controller: %s",
|
||||
+ out->err(out, "error: Bad reply from controller: %s",
|
||||
crm_exit_str(status));
|
||||
exit_code = status;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (reply->reply_type != pcmk_controld_reply_ping) {
|
||||
- fprintf(stderr, "error: Unknown reply type %d from controller\n",
|
||||
+ out->err(out, "error: Unknown reply type %d from controller",
|
||||
reply->reply_type);
|
||||
goto done;
|
||||
}
|
||||
@@ -224,22 +408,16 @@ controller_event_cb(pcmk_ipc_api_t *controld_api,
|
||||
// Parse desired information from reply
|
||||
switch (command) {
|
||||
case cmd_health:
|
||||
- printf("Status of %s@%s: %s (%s)\n",
|
||||
+ out->message(out, "health",
|
||||
reply->data.ping.sys_from,
|
||||
reply->host_from,
|
||||
reply->data.ping.fsa_state,
|
||||
reply->data.ping.result);
|
||||
- if (BE_SILENT && (reply->data.ping.fsa_state != NULL)) {
|
||||
- fprintf(stderr, "%s\n", reply->data.ping.fsa_state);
|
||||
- }
|
||||
exit_code = CRM_EX_OK;
|
||||
break;
|
||||
|
||||
case cmd_whois_dc:
|
||||
- printf("Designated Controller is: %s\n", reply->host_from);
|
||||
- if (BE_SILENT && (reply->host_from != NULL)) {
|
||||
- fprintf(stderr, "%s\n", reply->host_from);
|
||||
- }
|
||||
+ out->message(out, "dc", reply->host_from);
|
||||
exit_code = CRM_EX_OK;
|
||||
break;
|
||||
|
||||
@@ -263,7 +441,7 @@ pacemakerd_event_cb(pcmk_ipc_api_t *pacemakerd_api,
|
||||
switch (event_type) {
|
||||
case pcmk_ipc_event_disconnect:
|
||||
if (exit_code == CRM_EX_DISCONNECT) { // Unexpected
|
||||
- fprintf(stderr, "error: Lost connection to pacemakerd\n");
|
||||
+ out->err(out, "error: Lost connection to pacemakerd");
|
||||
}
|
||||
goto done;
|
||||
break;
|
||||
@@ -281,14 +459,14 @@ pacemakerd_event_cb(pcmk_ipc_api_t *pacemakerd_api,
|
||||
}
|
||||
|
||||
if (status != CRM_EX_OK) {
|
||||
- fprintf(stderr, "error: Bad reply from pacemakerd: %s",
|
||||
+ out->err(out, "error: Bad reply from pacemakerd: %s",
|
||||
crm_exit_str(status));
|
||||
exit_code = status;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (reply->reply_type != pcmk_pacemakerd_reply_ping) {
|
||||
- fprintf(stderr, "error: Unknown reply type %d from pacemakerd\n",
|
||||
+ out->err(out, "error: Unknown reply type %d from pacemakerd",
|
||||
reply->reply_type);
|
||||
goto done;
|
||||
}
|
||||
@@ -305,21 +483,12 @@ pacemakerd_event_cb(pcmk_ipc_api_t *pacemakerd_api,
|
||||
crm_time_log_date | crm_time_log_timeofday |
|
||||
crm_time_log_with_timezone);
|
||||
|
||||
- printf("Status of %s: '%s' %s %s\n",
|
||||
+ out->message(out, "pacemakerd-health",
|
||||
reply->data.ping.sys_from,
|
||||
(reply->data.ping.status == pcmk_rc_ok)?
|
||||
pcmk_pacemakerd_api_daemon_state_enum2text(
|
||||
reply->data.ping.state):"query failed",
|
||||
- (reply->data.ping.status == pcmk_rc_ok)?"last updated":"",
|
||||
(reply->data.ping.status == pcmk_rc_ok)?pinged_buf:"");
|
||||
- if (BE_SILENT &&
|
||||
- (reply->data.ping.state != pcmk_pacemakerd_state_invalid)) {
|
||||
- fprintf(stderr, "%s\n",
|
||||
- (reply->data.ping.status == pcmk_rc_ok)?
|
||||
- pcmk_pacemakerd_api_daemon_state_enum2text(
|
||||
- reply->data.ping.state):
|
||||
- "query failed");
|
||||
- }
|
||||
exit_code = CRM_EX_OK;
|
||||
free(pinged_buf);
|
||||
}
|
||||
@@ -354,7 +523,7 @@ list_nodes()
|
||||
rc = the_cib->cmds->query(the_cib, NULL, &output,
|
||||
cib_scope_local | cib_sync_call);
|
||||
if (rc == pcmk_ok) {
|
||||
- do_find_node_list(output);
|
||||
+ out->message(out, "crmadmin-node-list", output);
|
||||
free_xml(output);
|
||||
}
|
||||
the_cib->cmds->signoff(the_cib);
|
||||
@@ -362,20 +531,20 @@ list_nodes()
|
||||
}
|
||||
|
||||
static GOptionContext *
|
||||
-build_arg_context(pcmk__common_args_t *args) {
|
||||
+build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) {
|
||||
GOptionContext *context = NULL;
|
||||
|
||||
const char *description = "Report bugs to users@clusterlabs.org";
|
||||
|
||||
GOptionEntry extra_prog_entries[] = {
|
||||
- { "quiet", 'q', 0, G_OPTION_ARG_NONE, &options.quiet,
|
||||
+ { "quiet", 'q', 0, G_OPTION_ARG_NONE, &(args->quiet),
|
||||
"Display only the essential query information",
|
||||
NULL },
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
- context = pcmk__build_arg_context(args, NULL, NULL, NULL);
|
||||
+ context = pcmk__build_arg_context(args, "text (default), xml", group, NULL);
|
||||
g_option_context_set_description(context, description);
|
||||
|
||||
/* Add the -q option, which cannot be part of the globally supported options
|
||||
@@ -402,9 +571,11 @@ main(int argc, char **argv)
|
||||
|
||||
GError *error = NULL;
|
||||
GOptionContext *context = NULL;
|
||||
+ GOptionGroup *output_group = NULL;
|
||||
gchar **processed_args = NULL;
|
||||
|
||||
- context = build_arg_context(args);
|
||||
+ context = build_arg_context(args, &output_group);
|
||||
+ pcmk__register_formats(output_group, formats);
|
||||
|
||||
crm_log_cli_init("crmadmin");
|
||||
|
||||
@@ -421,9 +592,21 @@ main(int argc, char **argv)
|
||||
crm_bump_log_level(argc, argv);
|
||||
}
|
||||
|
||||
+ rc = pcmk__output_new(&out, args->output_ty, args->output_dest, argv);
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
+ fprintf(stderr, "Error creating output format %s: %s\n",
|
||||
+ args->output_ty, pcmk_rc_str(rc));
|
||||
+ exit_code = CRM_EX_ERROR;
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ out->quiet = args->quiet;
|
||||
+
|
||||
+ pcmk__register_messages(out, fmt_functions);
|
||||
+
|
||||
if (args->version) {
|
||||
- /* FIXME: When crmadmin is converted to use formatted output, this can go. */
|
||||
- pcmk__cli_help('v', CRM_EX_USAGE);
|
||||
+ out->version(out, false);
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (options.timeout) {
|
||||
@@ -433,12 +616,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
- if (options.quiet) {
|
||||
- BE_SILENT = TRUE;
|
||||
- }
|
||||
-
|
||||
if (options.health) {
|
||||
- fprintf(stderr, "Cluster-wide health option not supported\n");
|
||||
+ out->err(out, "Cluster-wide health option not supported");
|
||||
++argerr;
|
||||
}
|
||||
|
||||
@@ -447,14 +626,14 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (command == cmd_none) {
|
||||
- fprintf(stderr, "error: Must specify a command option\n\n");
|
||||
+ out->err(out, "error: Must specify a command option");
|
||||
++argerr;
|
||||
}
|
||||
|
||||
if (argerr) {
|
||||
char *help = g_option_context_get_help(context, TRUE, NULL);
|
||||
|
||||
- fprintf(stderr, "%s", help);
|
||||
+ out->err(out, "%s", help);
|
||||
g_free(help);
|
||||
exit_code = CRM_EX_USAGE;
|
||||
goto done;
|
||||
@@ -464,7 +643,7 @@ main(int argc, char **argv)
|
||||
if (need_controld_api) {
|
||||
rc = pcmk_new_ipc_api(&controld_api, pcmk_ipc_controld);
|
||||
if (controld_api == NULL) {
|
||||
- fprintf(stderr, "error: Could not connect to controller: %s\n",
|
||||
+ out->err(out, "error: Could not connect to controller: %s",
|
||||
pcmk_rc_str(rc));
|
||||
exit_code = pcmk_rc2exitc(rc);
|
||||
goto done;
|
||||
@@ -472,7 +651,7 @@ main(int argc, char **argv)
|
||||
pcmk_register_ipc_callback(controld_api, controller_event_cb, NULL);
|
||||
rc = pcmk_connect_ipc(controld_api, pcmk_ipc_dispatch_main);
|
||||
if (rc != pcmk_rc_ok) {
|
||||
- fprintf(stderr, "error: Could not connect to controller: %s\n",
|
||||
+ out->err(out, "error: Could not connect to controller: %s",
|
||||
pcmk_rc_str(rc));
|
||||
exit_code = pcmk_rc2exitc(rc);
|
||||
goto done;
|
||||
@@ -483,7 +662,7 @@ main(int argc, char **argv)
|
||||
if (need_pacemakerd_api) {
|
||||
rc = pcmk_new_ipc_api(&pacemakerd_api, pcmk_ipc_pacemakerd);
|
||||
if (pacemakerd_api == NULL) {
|
||||
- fprintf(stderr, "error: Could not connect to pacemakerd: %s\n",
|
||||
+ out->err(out, "error: Could not connect to pacemakerd: %s",
|
||||
pcmk_rc_str(rc));
|
||||
exit_code = pcmk_rc2exitc(rc);
|
||||
goto done;
|
||||
@@ -491,7 +670,7 @@ main(int argc, char **argv)
|
||||
pcmk_register_ipc_callback(pacemakerd_api, pacemakerd_event_cb, NULL);
|
||||
rc = pcmk_connect_ipc(pacemakerd_api, pcmk_ipc_dispatch_main);
|
||||
if (rc != pcmk_rc_ok) {
|
||||
- fprintf(stderr, "error: Could not connect to pacemakerd: %s\n",
|
||||
+ out->err(out, "error: Could not connect to pacemakerd: %s",
|
||||
pcmk_rc_str(rc));
|
||||
exit_code = pcmk_rc2exitc(rc);
|
||||
goto done;
|
||||
@@ -528,6 +707,10 @@ done:
|
||||
g_strfreev(processed_args);
|
||||
g_clear_error(&error);
|
||||
pcmk__free_arg_context(context);
|
||||
+ if (out != NULL) {
|
||||
+ out->finish(out, exit_code, true, NULL);
|
||||
+ pcmk__output_free(out);
|
||||
+ }
|
||||
return crm_exit(exit_code);
|
||||
|
||||
}
|
||||
@@ -567,7 +750,7 @@ do_work(pcmk_ipc_api_t *api)
|
||||
break;
|
||||
}
|
||||
if (rc != pcmk_rc_ok) {
|
||||
- fprintf(stderr, "error: Command failed: %s", pcmk_rc_str(rc));
|
||||
+ out->err(out, "error: Command failed: %s", pcmk_rc_str(rc));
|
||||
exit_code = pcmk_rc2exitc(rc);
|
||||
}
|
||||
return need_reply;
|
||||
@@ -576,43 +759,10 @@ do_work(pcmk_ipc_api_t *api)
|
||||
gboolean
|
||||
admin_message_timeout(gpointer data)
|
||||
{
|
||||
- fprintf(stderr,
|
||||
- "error: No reply received from controller before timeout (%dms)\n",
|
||||
+ out->err(out,
|
||||
+ "error: No reply received from controller before timeout (%dms)",
|
||||
message_timeout_ms);
|
||||
message_timer_id = 0;
|
||||
quit_main_loop(CRM_EX_TIMEOUT);
|
||||
return FALSE; // Tells glib to remove source
|
||||
}
|
||||
-
|
||||
-void
|
||||
-do_find_node_list(xmlNode * xml_node)
|
||||
-{
|
||||
- int found = 0;
|
||||
- xmlNode *node = NULL;
|
||||
- xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node);
|
||||
-
|
||||
- for (node = first_named_child(nodes, XML_CIB_TAG_NODE); node != NULL;
|
||||
- node = crm_next_same_xml(node)) {
|
||||
-
|
||||
- if (BASH_EXPORT) {
|
||||
- printf("export %s=%s\n",
|
||||
- crm_element_value(node, XML_ATTR_UNAME),
|
||||
- crm_element_value(node, XML_ATTR_ID));
|
||||
- } else {
|
||||
- const char *node_type = crm_element_value(node, XML_ATTR_TYPE);
|
||||
-
|
||||
- if (node_type == NULL) {
|
||||
- node_type = "member";
|
||||
- }
|
||||
- printf("%s node: %s (%s)\n", node_type,
|
||||
- crm_element_value(node, XML_ATTR_UNAME),
|
||||
- crm_element_value(node, XML_ATTR_ID));
|
||||
- }
|
||||
- found++;
|
||||
- }
|
||||
- // @TODO List Pacemaker Remote nodes that don't have a <node> entry
|
||||
-
|
||||
- if (found == 0) {
|
||||
- printf("No nodes configured\n");
|
||||
- }
|
||||
-}
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 2b121066c8eead96e85dc3bf6ecc1c2674cbdf32 Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Tue, 20 Oct 2020 16:19:03 +0200
|
||||
Subject: [PATCH 2/3] Refactor: crmadmin: use simple XML lists
|
||||
|
||||
---
|
||||
tools/crmadmin.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/crmadmin.c b/tools/crmadmin.c
|
||||
index 14078e6..b80a31a 100644
|
||||
--- a/tools/crmadmin.c
|
||||
+++ b/tools/crmadmin.c
|
||||
@@ -275,7 +275,7 @@ crmadmin_node_list(pcmk__output_t *out, va_list args)
|
||||
xmlNode *node = NULL;
|
||||
xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node);
|
||||
|
||||
- out->begin_list(out, NULL, NULL, "Nodes");
|
||||
+ out->begin_list(out, NULL, NULL, "nodes");
|
||||
|
||||
for (node = first_named_child(nodes, XML_CIB_TAG_NODE); node != NULL;
|
||||
node = crm_next_same_xml(node)) {
|
||||
@@ -324,7 +324,7 @@ crmadmin_node_xml(pcmk__output_t *out, va_list args)
|
||||
char *name = va_arg(args, char *);
|
||||
char *id = va_arg(args, char *);
|
||||
|
||||
- xmlNodePtr node = pcmk__output_create_xml_node(out, "crmadmin-node");
|
||||
+ xmlNodePtr node = pcmk__output_create_xml_node(out, "node");
|
||||
xmlSetProp(node, (pcmkXmlStr) "type", (pcmkXmlStr) (type ? type : "member"));
|
||||
xmlSetProp(node, (pcmkXmlStr) "name", (pcmkXmlStr) crm_str(name));
|
||||
xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) crm_str(id));
|
||||
@@ -604,6 +604,10 @@ main(int argc, char **argv)
|
||||
|
||||
pcmk__register_messages(out, fmt_functions);
|
||||
|
||||
+ if (!pcmk__force_args(context, &error, "%s --xml-simple-list --xml-substitute", g_get_prgname())) {
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
if (args->version) {
|
||||
out->version(out, false);
|
||||
goto done;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 9b53a7eda078db736be5212aeb77daf8117e2f17 Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Tue, 20 Oct 2020 16:21:12 +0200
|
||||
Subject: [PATCH 3/3] Feature: xml: add schema for new crmadmin output
|
||||
|
||||
---
|
||||
xml/Makefile.am | 2 +-
|
||||
xml/api/crmadmin-2.4.rng | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 69 insertions(+), 1 deletion(-)
|
||||
create mode 100644 xml/api/crmadmin-2.4.rng
|
||||
|
||||
diff --git a/xml/Makefile.am b/xml/Makefile.am
|
||||
index c045522..892c811 100644
|
||||
--- a/xml/Makefile.am
|
||||
+++ b/xml/Makefile.am
|
||||
@@ -45,7 +45,7 @@ version_pairs_last = $(wordlist \
|
||||
)
|
||||
|
||||
# Names of API schemas that form the choices for pacemaker-result content
|
||||
-API_request_base = command-output crm_mon stonith_admin version
|
||||
+API_request_base = command-output crm_mon crmadmin stonith_admin version
|
||||
|
||||
# Names of CIB schemas that form the choices for cib/configuration content
|
||||
CIB_cfg_base = options nodes resources constraints fencing acls tags alerts
|
||||
diff --git a/xml/api/crmadmin-2.4.rng b/xml/api/crmadmin-2.4.rng
|
||||
new file mode 100644
|
||||
index 0000000..34c9ca4
|
||||
--- /dev/null
|
||||
+++ b/xml/api/crmadmin-2.4.rng
|
||||
@@ -0,0 +1,68 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="element-crmadmin"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="element-crmadmin">
|
||||
+ <optional>
|
||||
+ <ref name="element-status" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="element-pacemakerd" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="element-dc" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="crmadmin-nodes-list" />
|
||||
+ </optional>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-status">
|
||||
+ <element name="crmd">
|
||||
+ <attribute name="node_name"> <text /> </attribute>
|
||||
+ <attribute name="state"> <text /> </attribute>
|
||||
+ <attribute name="result"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-pacemakerd">
|
||||
+ <element name="pacemakerd">
|
||||
+ <attribute name="state"> <text /> </attribute>
|
||||
+ <attribute name="last_updated"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-dc">
|
||||
+ <element name="dc">
|
||||
+ <attribute name="node_name"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="crmadmin-nodes-list">
|
||||
+ <element name="nodes">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-crmadmin-node" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-crmadmin-node">
|
||||
+ <element name="node">
|
||||
+ <attribute name="type">
|
||||
+ <choice>
|
||||
+ <value>unknown</value>
|
||||
+ <value>member</value>
|
||||
+ <value>remote</value>
|
||||
+ <value>ping</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+
|
||||
+ <attribute name="name"> <text/> </attribute>
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
--
|
||||
1.8.3.1
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
165
SOURCES/002-feature-set.patch
Normal file
165
SOURCES/002-feature-set.patch
Normal file
@ -0,0 +1,165 @@
|
||||
From 12e59f337f838d647deb8f84850324f785e58824 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Tue, 20 Oct 2020 10:53:26 -0400
|
||||
Subject: [PATCH] Feature: libcrmcommon: Add a spacer formatted output message.
|
||||
|
||||
---
|
||||
include/crm/common/output_internal.h | 10 +++++++++-
|
||||
lib/common/output_html.c | 6 ++++++
|
||||
lib/common/output_log.c | 6 ++++++
|
||||
lib/common/output_text.c | 6 ++++++
|
||||
lib/common/output_xml.c | 6 ++++++
|
||||
tools/crm_mon_curses.c | 6 ++++++
|
||||
6 files changed, 39 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/crm/common/output_internal.h b/include/crm/common/output_internal.h
|
||||
index 2874259..e1bd295 100644
|
||||
--- a/include/crm/common/output_internal.h
|
||||
+++ b/include/crm/common/output_internal.h
|
||||
@@ -460,6 +460,14 @@ struct pcmk__output_s {
|
||||
* \return true if output should be supressed, false otherwise.
|
||||
*/
|
||||
bool (*is_quiet) (pcmk__output_t *out);
|
||||
+
|
||||
+ /*!
|
||||
+ * \internal
|
||||
+ * \brief Output a spacer. Not all formatter will do this.
|
||||
+ *
|
||||
+ * \param[in] out The output functions structure.
|
||||
+ */
|
||||
+ void (*spacer) (pcmk__output_t *out);
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -745,7 +753,7 @@ G_GNUC_NULL_TERMINATED;
|
||||
|
||||
#define PCMK__OUTPUT_SPACER_IF(out_obj, cond) \
|
||||
if (cond) { \
|
||||
- out_obj->info(out_obj, "%s", ""); \
|
||||
+ out->spacer(out); \
|
||||
}
|
||||
|
||||
#define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...) \
|
||||
diff --git a/lib/common/output_html.c b/lib/common/output_html.c
|
||||
index 156887d..e354b5d 100644
|
||||
--- a/lib/common/output_html.c
|
||||
+++ b/lib/common/output_html.c
|
||||
@@ -368,6 +368,11 @@ html_is_quiet(pcmk__output_t *out) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+static void
|
||||
+html_spacer(pcmk__output_t *out) {
|
||||
+ pcmk__output_create_xml_node(out, "br");
|
||||
+}
|
||||
+
|
||||
pcmk__output_t *
|
||||
pcmk__mk_html_output(char **argv) {
|
||||
pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));
|
||||
@@ -399,6 +404,7 @@ pcmk__mk_html_output(char **argv) {
|
||||
retval->end_list = html_end_list;
|
||||
|
||||
retval->is_quiet = html_is_quiet;
|
||||
+ retval->spacer = html_spacer;
|
||||
|
||||
return retval;
|
||||
}
|
||||
diff --git a/lib/common/output_log.c b/lib/common/output_log.c
|
||||
index fd13c89..6336fa2 100644
|
||||
--- a/lib/common/output_log.c
|
||||
+++ b/lib/common/output_log.c
|
||||
@@ -226,6 +226,11 @@ log_is_quiet(pcmk__output_t *out) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+static void
|
||||
+log_spacer(pcmk__output_t *out) {
|
||||
+ /* This function intentionally left blank */
|
||||
+}
|
||||
+
|
||||
pcmk__output_t *
|
||||
pcmk__mk_log_output(char **argv) {
|
||||
pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));
|
||||
@@ -256,6 +261,7 @@ pcmk__mk_log_output(char **argv) {
|
||||
retval->end_list = log_end_list;
|
||||
|
||||
retval->is_quiet = log_is_quiet;
|
||||
+ retval->spacer = log_spacer;
|
||||
|
||||
return retval;
|
||||
}
|
||||
diff --git a/lib/common/output_text.c b/lib/common/output_text.c
|
||||
index 9b3c09a..3432505 100644
|
||||
--- a/lib/common/output_text.c
|
||||
+++ b/lib/common/output_text.c
|
||||
@@ -244,6 +244,11 @@ text_is_quiet(pcmk__output_t *out) {
|
||||
return out->quiet;
|
||||
}
|
||||
|
||||
+static void
|
||||
+text_spacer(pcmk__output_t *out) {
|
||||
+ fprintf(out->dest, "\n");
|
||||
+}
|
||||
+
|
||||
pcmk__output_t *
|
||||
pcmk__mk_text_output(char **argv) {
|
||||
pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));
|
||||
@@ -275,6 +280,7 @@ pcmk__mk_text_output(char **argv) {
|
||||
retval->end_list = text_end_list;
|
||||
|
||||
retval->is_quiet = text_is_quiet;
|
||||
+ retval->spacer = text_spacer;
|
||||
|
||||
return retval;
|
||||
}
|
||||
diff --git a/lib/common/output_xml.c b/lib/common/output_xml.c
|
||||
index 9a08d20..1710fac 100644
|
||||
--- a/lib/common/output_xml.c
|
||||
+++ b/lib/common/output_xml.c
|
||||
@@ -376,6 +376,11 @@ xml_is_quiet(pcmk__output_t *out) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+static void
|
||||
+xml_spacer(pcmk__output_t *out) {
|
||||
+ /* This function intentionally left blank */
|
||||
+}
|
||||
+
|
||||
pcmk__output_t *
|
||||
pcmk__mk_xml_output(char **argv) {
|
||||
pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));
|
||||
@@ -407,6 +412,7 @@ pcmk__mk_xml_output(char **argv) {
|
||||
retval->end_list = xml_end_list;
|
||||
|
||||
retval->is_quiet = xml_is_quiet;
|
||||
+ retval->spacer = xml_spacer;
|
||||
|
||||
return retval;
|
||||
}
|
||||
diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c
|
||||
index 2c092df..8a08578 100644
|
||||
--- a/tools/crm_mon_curses.c
|
||||
+++ b/tools/crm_mon_curses.c
|
||||
@@ -247,6 +247,11 @@ curses_is_quiet(pcmk__output_t *out) {
|
||||
return out->quiet;
|
||||
}
|
||||
|
||||
+static void
|
||||
+curses_spacer(pcmk__output_t *out) {
|
||||
+ addch('\n');
|
||||
+}
|
||||
+
|
||||
pcmk__output_t *
|
||||
crm_mon_mk_curses_output(char **argv) {
|
||||
pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));
|
||||
@@ -278,6 +283,7 @@ crm_mon_mk_curses_output(char **argv) {
|
||||
retval->end_list = curses_end_list;
|
||||
|
||||
retval->is_quiet = curses_is_quiet;
|
||||
+ retval->spacer = curses_spacer;
|
||||
|
||||
return retval;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
208
SOURCES/003-feature-set.patch
Normal file
208
SOURCES/003-feature-set.patch
Normal file
@ -0,0 +1,208 @@
|
||||
From 0deb5145c336bc4b32766c6f7af259d643af9143 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Wed, 28 Oct 2020 13:56:09 -0400
|
||||
Subject: [PATCH 1/2] Fix: scheduler, tools: Update typing on maint-mode args.
|
||||
|
||||
---
|
||||
lib/pengine/pe_output.c | 2 +-
|
||||
tools/crm_mon_curses.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
|
||||
index 186be33..d0f96f4 100644
|
||||
--- a/lib/pengine/pe_output.c
|
||||
+++ b/lib/pengine/pe_output.c
|
||||
@@ -686,7 +686,7 @@ pe__cluster_dc_xml(pcmk__output_t *out, va_list args) {
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long")
|
||||
+PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long int")
|
||||
int
|
||||
pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args) {
|
||||
unsigned long long flags = va_arg(args, unsigned long long);
|
||||
diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c
|
||||
index 8a08578..9cf28dc 100644
|
||||
--- a/tools/crm_mon_curses.c
|
||||
+++ b/tools/crm_mon_curses.c
|
||||
@@ -365,7 +365,7 @@ stonith_event_console(pcmk__output_t *out, va_list args) {
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long")
|
||||
+PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long int")
|
||||
static int
|
||||
cluster_maint_mode_console(pcmk__output_t *out, va_list args) {
|
||||
unsigned long long flags = va_arg(args, unsigned long long);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 7a61ae2384b0a1653b4a06926b4ec23099ccf292 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Wed, 28 Oct 2020 13:57:51 -0400
|
||||
Subject: [PATCH 2/2] Fix: tools: Update typing on formatted output args in
|
||||
crmadmin.
|
||||
|
||||
A lot of these are actually taking const char * as an argument, not
|
||||
regular char *.
|
||||
---
|
||||
tools/crmadmin.c | 62 ++++++++++++++++++++++++++++----------------------------
|
||||
1 file changed, 31 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/tools/crmadmin.c b/tools/crmadmin.c
|
||||
index b80a31a..e61dbf4 100644
|
||||
--- a/tools/crmadmin.c
|
||||
+++ b/tools/crmadmin.c
|
||||
@@ -167,14 +167,14 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("health", "char *", "char *", "char *", "char *")
|
||||
+PCMK__OUTPUT_ARGS("health", "const char *", "const char *", "const char *", "const char *")
|
||||
static int
|
||||
health_text(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *sys_from = va_arg(args, char *);
|
||||
- char *host_from = va_arg(args, char *);
|
||||
- char *fsa_state = va_arg(args, char *);
|
||||
- char *result = va_arg(args, char *);
|
||||
+ const char *sys_from = va_arg(args, const char *);
|
||||
+ const char *host_from = va_arg(args, const char *);
|
||||
+ const char *fsa_state = va_arg(args, const char *);
|
||||
+ const char *result = va_arg(args, const char *);
|
||||
|
||||
if (!out->is_quiet(out)) {
|
||||
out->info(out, "Status of %s@%s: %s (%s)", crm_str(sys_from),
|
||||
@@ -186,14 +186,14 @@ health_text(pcmk__output_t *out, va_list args)
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("health", "char *", "char *", "char *", "char *")
|
||||
+PCMK__OUTPUT_ARGS("health", "const char *", "const char *", "const char *", "const char *")
|
||||
static int
|
||||
health_xml(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *sys_from = va_arg(args, char *);
|
||||
- char *host_from = va_arg(args, char *);
|
||||
- char *fsa_state = va_arg(args, char *);
|
||||
- char *result = va_arg(args, char *);
|
||||
+ const char *sys_from = va_arg(args, const char *);
|
||||
+ const char *host_from = va_arg(args, const char *);
|
||||
+ const char *fsa_state = va_arg(args, const char *);
|
||||
+ const char *result = va_arg(args, const char *);
|
||||
|
||||
xmlNodePtr node = pcmk__output_create_xml_node(out, crm_str(sys_from));
|
||||
xmlSetProp(node, (pcmkXmlStr) "node_name", (pcmkXmlStr) crm_str(host_from));
|
||||
@@ -203,13 +203,13 @@ health_xml(pcmk__output_t *out, va_list args)
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("pacemakerd-health", "char *", "char *", "char *")
|
||||
+PCMK__OUTPUT_ARGS("pacemakerd-health", "const char *", "const char *", "const char *")
|
||||
static int
|
||||
pacemakerd_health_text(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *sys_from = va_arg(args, char *);
|
||||
- char *state = va_arg(args, char *);
|
||||
- char *last_updated = va_arg(args, char *);
|
||||
+ const char *sys_from = va_arg(args, const char *);
|
||||
+ const char *state = va_arg(args, const char *);
|
||||
+ const char *last_updated = va_arg(args, const char *);
|
||||
|
||||
if (!out->is_quiet(out)) {
|
||||
out->info(out, "Status of %s: '%s' %s %s", crm_str(sys_from),
|
||||
@@ -222,13 +222,13 @@ pacemakerd_health_text(pcmk__output_t *out, va_list args)
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("pacemakerd-health", "char *", "char *", "char *")
|
||||
+PCMK__OUTPUT_ARGS("pacemakerd-health", "const char *", "const char *", "const char *")
|
||||
static int
|
||||
pacemakerd_health_xml(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *sys_from = va_arg(args, char *);
|
||||
- char *state = va_arg(args, char *);
|
||||
- char *last_updated = va_arg(args, char *);
|
||||
+ const char *sys_from = va_arg(args, const char *);
|
||||
+ const char *state = va_arg(args, const char *);
|
||||
+ const char *last_updated = va_arg(args, const char *);
|
||||
|
||||
|
||||
xmlNodePtr node = pcmk__output_create_xml_node(out, crm_str(sys_from));
|
||||
@@ -238,11 +238,11 @@ pacemakerd_health_xml(pcmk__output_t *out, va_list args)
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("dc", "char *")
|
||||
+PCMK__OUTPUT_ARGS("dc", "const char *")
|
||||
static int
|
||||
dc_text(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *dc = va_arg(args, char *);
|
||||
+ const char *dc = va_arg(args, const char *);
|
||||
|
||||
if (!out->is_quiet(out)) {
|
||||
out->info(out, "Designated Controller is: %s", crm_str(dc));
|
||||
@@ -253,11 +253,11 @@ dc_text(pcmk__output_t *out, va_list args)
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("dc", "char *")
|
||||
+PCMK__OUTPUT_ARGS("dc", "const char *")
|
||||
static int
|
||||
dc_xml(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *dc = va_arg(args, char *);
|
||||
+ const char *dc = va_arg(args, const char *);
|
||||
|
||||
xmlNodePtr node = pcmk__output_create_xml_node(out, "dc");
|
||||
xmlSetProp(node, (pcmkXmlStr) "node_name", (pcmkXmlStr) crm_str(dc));
|
||||
@@ -266,7 +266,7 @@ dc_xml(pcmk__output_t *out, va_list args)
|
||||
}
|
||||
|
||||
|
||||
-PCMK__OUTPUT_ARGS("crmadmin-node-list", "xmlNode *")
|
||||
+PCMK__OUTPUT_ARGS("crmadmin-node-list", "struct xmlNode *")
|
||||
static int
|
||||
crmadmin_node_list(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
@@ -298,13 +298,13 @@ crmadmin_node_list(pcmk__output_t *out, va_list args)
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("crmadmin-node", "char *", "char *", "char *")
|
||||
+PCMK__OUTPUT_ARGS("crmadmin-node", "const char *", "const char *", "const char *")
|
||||
static int
|
||||
crmadmin_node_text(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *type = va_arg(args, char *);
|
||||
- char *name = va_arg(args, char *);
|
||||
- char *id = va_arg(args, char *);
|
||||
+ const char *type = va_arg(args, const char *);
|
||||
+ const char *name = va_arg(args, const char *);
|
||||
+ const char *id = va_arg(args, const char *);
|
||||
|
||||
if (BASH_EXPORT) {
|
||||
out->info(out, "export %s=%s", crm_str(name), crm_str(id));
|
||||
@@ -316,13 +316,13 @@ crmadmin_node_text(pcmk__output_t *out, va_list args)
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
-PCMK__OUTPUT_ARGS("crmadmin-node", "char *", "char *", "char *")
|
||||
+PCMK__OUTPUT_ARGS("crmadmin-node", "const char *", "const char *", "const char *")
|
||||
static int
|
||||
crmadmin_node_xml(pcmk__output_t *out, va_list args)
|
||||
{
|
||||
- char *type = va_arg(args, char *);
|
||||
- char *name = va_arg(args, char *);
|
||||
- char *id = va_arg(args, char *);
|
||||
+ const char *type = va_arg(args, const char *);
|
||||
+ const char *name = va_arg(args, const char *);
|
||||
+ const char *id = va_arg(args, const char *);
|
||||
|
||||
xmlNodePtr node = pcmk__output_create_xml_node(out, "node");
|
||||
xmlSetProp(node, (pcmkXmlStr) "type", (pcmkXmlStr) (type ? type : "member"));
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 47c3e06b098c7e148c54675588d03b4d2bea40b5 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 22 Jun 2020 16:20:01 -0400
|
||||
Subject: [PATCH] Fix: libpacemaker: Don't allow a potential NULL in a format
|
||||
string.
|
||||
|
||||
This is only tripping up F32 s390x builds, but I don't suppose there's
|
||||
any reason it couldn't come up elsewhere later.
|
||||
---
|
||||
lib/pacemaker/pcmk_sched_constraints.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/pacemaker/pcmk_sched_constraints.c b/lib/pacemaker/pcmk_sched_constraints.c
|
||||
index 9c3a88d..d8c3e69 100644
|
||||
--- a/lib/pacemaker/pcmk_sched_constraints.c
|
||||
+++ b/lib/pacemaker/pcmk_sched_constraints.c
|
||||
@@ -1595,8 +1595,8 @@ custom_action_order(pe_resource_t * lh_rsc, char *lh_action_task, pe_action_t *
|
||||
order = calloc(1, sizeof(pe__ordering_t));
|
||||
|
||||
crm_trace("Creating[%d] %s %s %s - %s %s %s", data_set->order_id,
|
||||
- lh_rsc?lh_rsc->id:"NA", lh_action_task, lh_action?lh_action->uuid:"NA",
|
||||
- rh_rsc?rh_rsc->id:"NA", rh_action_task, rh_action?rh_action->uuid:"NA");
|
||||
+ lh_rsc?lh_rsc->id:"NA", lh_action_task?lh_action_task:"NA", lh_action?lh_action->uuid:"NA",
|
||||
+ rh_rsc?rh_rsc->id:"NA", rh_action_task?rh_action_task:"NA", rh_action?rh_action->uuid:"NA");
|
||||
|
||||
/* CRM_ASSERT(data_set->order_id != 291); */
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
771
SOURCES/004-feature-set.patch
Normal file
771
SOURCES/004-feature-set.patch
Normal file
@ -0,0 +1,771 @@
|
||||
From 9faa62f0701801f1d420462025e863d8ca3d6a06 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 21 Sep 2020 14:19:19 -0400
|
||||
Subject: [PATCH 1/6] Fix: libcrmcommon: Automatically lower case XML list
|
||||
names.
|
||||
|
||||
---
|
||||
lib/common/output_xml.c | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/common/output_xml.c b/lib/common/output_xml.c
|
||||
index 1710fac..6a6ed6e 100644
|
||||
--- a/lib/common/output_xml.c
|
||||
+++ b/lib/common/output_xml.c
|
||||
@@ -50,7 +50,6 @@ typedef struct subst_s {
|
||||
} subst_t;
|
||||
|
||||
static subst_t substitutions[] = {
|
||||
- { "Attributes", "attributes" },
|
||||
{ "Active Resources", "resources" },
|
||||
{ "Full List of Resources", "resources" },
|
||||
{ "Inactive Resources", "resources" },
|
||||
@@ -61,8 +60,6 @@ static subst_t substitutions[] = {
|
||||
{ "Operations", "node_history" },
|
||||
{ "Negative Location Constraints", "bans" },
|
||||
{ "Node Attributes", "node_attributes" },
|
||||
- { "Resources", "resources" },
|
||||
- { "Tickets", "tickets" },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
@@ -288,7 +285,7 @@ static void
|
||||
xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plural_noun,
|
||||
const char *format, ...) {
|
||||
va_list ap;
|
||||
- const char *name = NULL;
|
||||
+ char *name = NULL;
|
||||
char *buf = NULL;
|
||||
int len;
|
||||
|
||||
@@ -300,14 +297,14 @@ xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plura
|
||||
if (substitute) {
|
||||
for (subst_t *s = substitutions; s->from != NULL; s++) {
|
||||
if (!strcmp(s->from, buf)) {
|
||||
- name = s->to;
|
||||
+ name = g_strdup(s->to);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (name == NULL) {
|
||||
- name = buf;
|
||||
+ name = g_ascii_strdown(buf, -1);
|
||||
}
|
||||
|
||||
if (legacy_xml || simple_list) {
|
||||
@@ -319,6 +316,7 @@ xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plura
|
||||
xmlSetProp(list_node, (pcmkXmlStr) "name", (pcmkXmlStr) name);
|
||||
}
|
||||
|
||||
+ g_free(name);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 7a77441ae8d3ab943dfafebfc06b63402be323e1 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Tue, 27 Oct 2020 12:49:45 -0400
|
||||
Subject: [PATCH 2/6] Feature: xml: Move resource-related XML schema into its
|
||||
own file.
|
||||
|
||||
This allows it to be shared between the crm_mon and crm_resource
|
||||
schemas. Also, this adds support for resource XML to crm_mon given that
|
||||
this is now technically possible as part of the library output.
|
||||
---
|
||||
xml/Makefile.am | 2 +-
|
||||
xml/api/crm_mon-2.4.rng | 311 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
xml/api/resources-2.4.rng | 109 ++++++++++++++++
|
||||
3 files changed, 421 insertions(+), 1 deletion(-)
|
||||
create mode 100644 xml/api/crm_mon-2.4.rng
|
||||
create mode 100644 xml/api/resources-2.4.rng
|
||||
|
||||
diff --git a/xml/Makefile.am b/xml/Makefile.am
|
||||
index 892c811..79ce900 100644
|
||||
--- a/xml/Makefile.am
|
||||
+++ b/xml/Makefile.am
|
||||
@@ -51,7 +51,7 @@ API_request_base = command-output crm_mon crmadmin stonith_admin version
|
||||
CIB_cfg_base = options nodes resources constraints fencing acls tags alerts
|
||||
|
||||
# Names of all schemas (including top level and those included by others)
|
||||
-API_base = $(API_request_base) fence-event item status
|
||||
+API_base = $(API_request_base) fence-event item resources status
|
||||
CIB_base = cib $(CIB_cfg_base) status score rule nvset
|
||||
|
||||
# Static schema files and transforms (only CIB has transforms)
|
||||
diff --git a/xml/api/crm_mon-2.4.rng b/xml/api/crm_mon-2.4.rng
|
||||
new file mode 100644
|
||||
index 0000000..88973a4
|
||||
--- /dev/null
|
||||
+++ b/xml/api/crm_mon-2.4.rng
|
||||
@@ -0,0 +1,311 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="element-crm-mon"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="element-crm-mon">
|
||||
+ <optional>
|
||||
+ <ref name="element-summary" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="nodes-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="resources-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="node-attributes-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="node-history-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="failures-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="fence-event-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="tickets-list" />
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <ref name="bans-list" />
|
||||
+ </optional>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-summary">
|
||||
+ <element name="summary">
|
||||
+ <optional>
|
||||
+ <element name="stack">
|
||||
+ <attribute name="type"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="current_dc">
|
||||
+ <attribute name="present"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <group>
|
||||
+ <attribute name="version"> <text /> </attribute>
|
||||
+ <attribute name="name"> <text /> </attribute>
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <attribute name="with_quorum"> <data type="boolean" /> </attribute>
|
||||
+ </group>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="last_update">
|
||||
+ <attribute name="time"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ <element name="last_change">
|
||||
+ <attribute name="time"> <text /> </attribute>
|
||||
+ <attribute name="user"> <text /> </attribute>
|
||||
+ <attribute name="client"> <text /> </attribute>
|
||||
+ <attribute name="origin"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="nodes_configured">
|
||||
+ <attribute name="number"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ </element>
|
||||
+ <element name="resources_configured">
|
||||
+ <attribute name="number"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="disabled"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="blocked"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <element name="cluster_options">
|
||||
+ <attribute name="stonith-enabled"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="symmetric-cluster"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="no-quorum-policy"> <text /> </attribute>
|
||||
+ <attribute name="maintenance-mode"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="stop-all-resources"> <data type="boolean" /> </attribute>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resources-list">
|
||||
+ <element name="resources">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="resources-2.4.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="nodes-list">
|
||||
+ <element name="nodes">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-full-node" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="node-attributes-list">
|
||||
+ <element name="node_attributes">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-node-with-attributes" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="node-history-list">
|
||||
+ <element name="node_history">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-node-history" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="failures-list">
|
||||
+ <element name="failures">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-failure" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="fence-event-list">
|
||||
+ <element name="fence_history">
|
||||
+ <optional>
|
||||
+ <attribute name="status"> <data type="integer" /> </attribute>
|
||||
+ </optional>
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="fence-event-2.0.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="tickets-list">
|
||||
+ <element name="tickets">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-ticket" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="bans-list">
|
||||
+ <element name="bans">
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-ban" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-full-node">
|
||||
+ <element name="node">
|
||||
+ <attribute name="name"> <text/> </attribute>
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="online"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="standby"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="standby_onfail"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="maintenance"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="pending"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="unclean"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="shutdown"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="expected_up"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="is_dc"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="resources_running"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="type">
|
||||
+ <choice>
|
||||
+ <value>unknown</value>
|
||||
+ <value>member</value>
|
||||
+ <value>remote</value>
|
||||
+ <value>ping</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ <optional>
|
||||
+ <!-- for virtualized pacemaker_remote nodes, crm_mon 1.1.13 uses
|
||||
+ "container_id" while later versions use "id_as_resource" -->
|
||||
+ <choice>
|
||||
+ <attribute name="container_id"> <text/> </attribute>
|
||||
+ <attribute name="id_as_resource"> <text/> </attribute>
|
||||
+ </choice>
|
||||
+ </optional>
|
||||
+ <externalRef href="resources-2.4.rng" />
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-node-with-attributes">
|
||||
+ <element name="node">
|
||||
+ <attribute name="name"> <text /> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <element name="attribute">
|
||||
+ <attribute name="name"> <text /> </attribute>
|
||||
+ <attribute name="value"> <text /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="expected"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-node-history">
|
||||
+ <element name="node">
|
||||
+ <attribute name="name"> <text /> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-resource-history" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-resource-history">
|
||||
+ <element name="resource_history">
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <attribute name="orphan"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <group>
|
||||
+ <attribute name="migration-threshold"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="fail-count"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="last-failure"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </group>
|
||||
+ </optional>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-operation-history" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-operation-history">
|
||||
+ <element name="operation_history">
|
||||
+ <attribute name="call"> <text /> </attribute>
|
||||
+ <attribute name="task"> <text /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="interval"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="last-rc-change"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="last-run"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="exec-time"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="queue-time"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ <attribute name="rc"> <data type="integer" /> </attribute>
|
||||
+ <attribute name="rc_text"> <text /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-failure">
|
||||
+ <element name="failure">
|
||||
+ <choice>
|
||||
+ <attribute name="op_key"> <text/> </attribute>
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ </choice>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <attribute name="exitstatus"> <text /> </attribute>
|
||||
+ <attribute name="exitreason"> <text /> </attribute>
|
||||
+ <attribute name="exitcode"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="call"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="status"> <text /> </attribute>
|
||||
+ <optional>
|
||||
+ <group>
|
||||
+ <attribute name="last-rc-change"> <text /> </attribute>
|
||||
+ <attribute name="queued"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="exec"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="interval"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="task"> <text /> </attribute>
|
||||
+ </group>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-ticket">
|
||||
+ <element name="ticket">
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <attribute name="status">
|
||||
+ <choice>
|
||||
+ <value>granted</value>
|
||||
+ <value>revoked</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ <attribute name="standby"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="last-granted"> <text /> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-ban">
|
||||
+ <element name="ban">
|
||||
+ <attribute name="id"> <text /> </attribute>
|
||||
+ <attribute name="resource"> <text /> </attribute>
|
||||
+ <attribute name="node"> <text /> </attribute>
|
||||
+ <attribute name="weight"> <data type="integer" /> </attribute>
|
||||
+ <attribute name="master_only"> <data type="boolean" /> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
diff --git a/xml/api/resources-2.4.rng b/xml/api/resources-2.4.rng
|
||||
new file mode 100644
|
||||
index 0000000..e279583
|
||||
--- /dev/null
|
||||
+++ b/xml/api/resources-2.4.rng
|
||||
@@ -0,0 +1,109 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="element-resource-list"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="element-resource-list">
|
||||
+ <interleave>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-bundle" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-clone" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-group" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-resource" />
|
||||
+ </zeroOrMore>
|
||||
+ </interleave>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-bundle">
|
||||
+ <element name="bundle">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="type">
|
||||
+ <choice>
|
||||
+ <value>docker</value>
|
||||
+ <value>rkt</value>
|
||||
+ <value>podman</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ <attribute name="image"> <text/> </attribute>
|
||||
+ <attribute name="unique"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="managed"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="failed"> <data type="boolean" /> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <element name="replica">
|
||||
+ <attribute name="id"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="element-resource" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-clone">
|
||||
+ <element name="clone">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="multi_state"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="unique"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="managed"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="disabled"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="failed"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="failure_ignored"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="target_role"> <text/> </attribute>
|
||||
+ </optional>
|
||||
+ <ref name="element-resource-list" />
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-group">
|
||||
+ <element name="group">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="number_resources"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="managed"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="disabled"> <data type="boolean" /> </attribute>
|
||||
+ <ref name="element-resource-list" />
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-resource">
|
||||
+ <element name="resource">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="resource_agent"> <text/> </attribute>
|
||||
+ <attribute name="role"> <text/> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="target_role"> <text/> </attribute>
|
||||
+ </optional>
|
||||
+ <attribute name="active"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="orphaned"> <data type="boolean" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="blocked"> <data type="boolean" /> </attribute>
|
||||
+ </optional>
|
||||
+ <attribute name="managed"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="failed"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="failure_ignored"> <data type="boolean" /> </attribute>
|
||||
+ <attribute name="nodes_running_on"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="pending"> <text/> </attribute>
|
||||
+ </optional>
|
||||
+ <zeroOrMore>
|
||||
+ <element name="node">
|
||||
+ <attribute name="name"> <text/> </attribute>
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="cached"> <data type="boolean" /> </attribute>
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ <optional>
|
||||
+ <element name="xml"> <text/> </element>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 814eb921cd429692220f33722c9bc061266bd838 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 29 Oct 2020 14:45:02 -0400
|
||||
Subject: [PATCH 3/6] Feature: xml: Add a generic list XML schema file.
|
||||
|
||||
Formatted output supports a generic list structure that isn't used in
|
||||
too many places at the moment, but it could be getting used more in the
|
||||
future. It's also really easy to have a schema for this piece of XML.
|
||||
---
|
||||
xml/Makefile.am | 7 ++++++-
|
||||
xml/api/generic-list-2.4.rng | 21 +++++++++++++++++++++
|
||||
2 files changed, 27 insertions(+), 1 deletion(-)
|
||||
create mode 100644 xml/api/generic-list-2.4.rng
|
||||
|
||||
diff --git a/xml/Makefile.am b/xml/Makefile.am
|
||||
index 79ce900..2f99f1c 100644
|
||||
--- a/xml/Makefile.am
|
||||
+++ b/xml/Makefile.am
|
||||
@@ -44,6 +44,11 @@ version_pairs_last = $(wordlist \
|
||||
),$(1),$(2) \
|
||||
)
|
||||
|
||||
+# NOTE: All files in API_request_base, CIB_cfg_base, API_base, and CIB_base
|
||||
+# need to start with a unique prefix. These variables all get iterated over
|
||||
+# and globbed, and two files starting with the same prefix will cause
|
||||
+# problems.
|
||||
+
|
||||
# Names of API schemas that form the choices for pacemaker-result content
|
||||
API_request_base = command-output crm_mon crmadmin stonith_admin version
|
||||
|
||||
@@ -51,7 +56,7 @@ API_request_base = command-output crm_mon crmadmin stonith_admin version
|
||||
CIB_cfg_base = options nodes resources constraints fencing acls tags alerts
|
||||
|
||||
# Names of all schemas (including top level and those included by others)
|
||||
-API_base = $(API_request_base) fence-event item resources status
|
||||
+API_base = $(API_request_base) fence-event generic-list item resources status
|
||||
CIB_base = cib $(CIB_cfg_base) status score rule nvset
|
||||
|
||||
# Static schema files and transforms (only CIB has transforms)
|
||||
diff --git a/xml/api/generic-list-2.4.rng b/xml/api/generic-list-2.4.rng
|
||||
new file mode 100644
|
||||
index 0000000..fee93a9
|
||||
--- /dev/null
|
||||
+++ b/xml/api/generic-list-2.4.rng
|
||||
@@ -0,0 +1,21 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="generic-list"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="generic-list">
|
||||
+ <element name="list">
|
||||
+ <attribute name="name"> <text /> </attribute>
|
||||
+ <attribute name="count"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <choice>
|
||||
+ <empty/>
|
||||
+ <oneOrMore>
|
||||
+ <externalRef href="item-1.1.rng"/>
|
||||
+ </oneOrMore>
|
||||
+ </choice>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 316b6f66ca5425093503c51c2f8738922287ebca Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Wed, 16 Sep 2020 15:59:34 -0400
|
||||
Subject: [PATCH 4/6] Fix: tools: Save the optarg parameter for
|
||||
--list-ocf-alternatives.
|
||||
|
||||
We need this so it can be added to the XML output of crm_resource.
|
||||
---
|
||||
tools/crm_resource.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
||||
index 6573ad5..acaddc0 100644
|
||||
--- a/tools/crm_resource.c
|
||||
+++ b/tools/crm_resource.c
|
||||
@@ -720,9 +720,7 @@ list_alternatives_cb(const gchar *option_name, const gchar *optarg,
|
||||
gpointer data, GError **error)
|
||||
{
|
||||
SET_COMMAND(cmd_list_alternatives);
|
||||
- options.require_cib = FALSE;
|
||||
- options.require_dataset = FALSE;
|
||||
- options.require_resource = FALSE;
|
||||
+ get_agent_spec(optarg);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From c063ce9b193f2022611e651c13afcb3ceb5969e3 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Wed, 2 Sep 2020 16:20:10 -0400
|
||||
Subject: [PATCH 5/6] Fix: scheduler: Use the default format handler in a few
|
||||
more places.
|
||||
|
||||
---
|
||||
lib/pengine/pe_output.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
|
||||
index d0f96f4..9d43e5f 100644
|
||||
--- a/lib/pengine/pe_output.c
|
||||
+++ b/lib/pengine/pe_output.c
|
||||
@@ -1847,9 +1847,7 @@ static pcmk__message_entry_t fmt_functions[] = {
|
||||
{ "cluster-times", "log", pe__cluster_times_text },
|
||||
{ "cluster-times", "text", pe__cluster_times_text },
|
||||
{ "cluster-times", "xml", pe__cluster_times_xml },
|
||||
- { "failed-action", "html", pe__failed_action_text },
|
||||
- { "failed-action", "log", pe__failed_action_text },
|
||||
- { "failed-action", "text", pe__failed_action_text },
|
||||
+ { "failed-action", "default", pe__failed_action_text },
|
||||
{ "failed-action", "xml", pe__failed_action_xml },
|
||||
{ "group", "xml", pe__group_xml },
|
||||
{ "group", "html", pe__group_html },
|
||||
@@ -1868,9 +1866,7 @@ static pcmk__message_entry_t fmt_functions[] = {
|
||||
{ "node-attribute", "log", pe__node_attribute_text },
|
||||
{ "node-attribute", "text", pe__node_attribute_text },
|
||||
{ "node-attribute", "xml", pe__node_attribute_xml },
|
||||
- { "op-history", "html", pe__op_history_text },
|
||||
- { "op-history", "log", pe__op_history_text },
|
||||
- { "op-history", "text", pe__op_history_text },
|
||||
+ { "op-history", "default", pe__op_history_text },
|
||||
{ "op-history", "xml", pe__op_history_xml },
|
||||
{ "primitive", "xml", pe__resource_xml },
|
||||
{ "primitive", "html", pe__resource_html },
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From a32b99f5fd09ec15dbba6785c5d8dc2e220417a3 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 3 Sep 2020 10:23:16 -0400
|
||||
Subject: [PATCH 6/6] Refactor: scheduler: Expose native_output_string as
|
||||
pcmk__native_output_string.
|
||||
|
||||
The plan is that this function can be used to help build the string that
|
||||
is output for each line of "crm_resource -o" output. It appears that
|
||||
output only happens for primitive resources. However, I've added a
|
||||
check at the beginning just in case it's called for some other type of
|
||||
resource.
|
||||
---
|
||||
include/crm/pengine/internal.h | 3 +++
|
||||
lib/pengine/native.c | 24 ++++++++++++++----------
|
||||
2 files changed, 17 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h
|
||||
index abe7a76..d658e86 100644
|
||||
--- a/include/crm/pengine/internal.h
|
||||
+++ b/include/crm/pengine/internal.h
|
||||
@@ -243,6 +243,9 @@ void clone_print(pe_resource_t * rsc, const char *pre_text, long options, void *
|
||||
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options,
|
||||
void *print_data);
|
||||
|
||||
+gchar * pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
|
||||
+ long options, const char *target_role, bool show_nodes);
|
||||
+
|
||||
int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name
|
||||
, size_t pairs_count, ...);
|
||||
char *pe__node_display_name(pe_node_t *node, bool print_detail);
|
||||
diff --git a/lib/pengine/native.c b/lib/pengine/native.c
|
||||
index 8f0c5c9..bf1f5c0 100644
|
||||
--- a/lib/pengine/native.c
|
||||
+++ b/lib/pengine/native.c
|
||||
@@ -570,17 +570,21 @@ add_output_node(GString *s, const char *node, bool have_nodes)
|
||||
* \return Newly allocated string description of resource
|
||||
* \note Caller must free the result with g_free().
|
||||
*/
|
||||
-static gchar *
|
||||
-native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
|
||||
- long options, const char *target_role, bool show_nodes)
|
||||
+gchar *
|
||||
+pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
|
||||
+ long options, const char *target_role, bool show_nodes)
|
||||
{
|
||||
const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
|
||||
const char *provider = NULL;
|
||||
const char *kind = crm_element_value(rsc->xml, XML_ATTR_TYPE);
|
||||
- char *retval = NULL;
|
||||
+ gchar *retval = NULL;
|
||||
GString *outstr = NULL;
|
||||
bool have_flags = false;
|
||||
|
||||
+ if (rsc->variant != pe_native) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
CRM_CHECK(name != NULL, name = "unknown");
|
||||
CRM_CHECK(kind != NULL, kind = "unknown");
|
||||
CRM_CHECK(class != NULL, class = "unknown");
|
||||
@@ -758,8 +762,8 @@ pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc,
|
||||
}
|
||||
|
||||
{
|
||||
- gchar *s = native_output_string(rsc, name, node, options, target_role,
|
||||
- true);
|
||||
+ gchar *s = pcmk__native_output_string(rsc, name, node, options,
|
||||
+ target_role, true);
|
||||
|
||||
list_node = pcmk__output_create_html_node(out, "li", NULL, NULL, NULL);
|
||||
pcmk_create_html_node(list_node, "span", NULL, cl, s);
|
||||
@@ -826,8 +830,8 @@ pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc,
|
||||
}
|
||||
|
||||
{
|
||||
- gchar *s = native_output_string(rsc, name, node, options, target_role,
|
||||
- true);
|
||||
+ gchar *s = pcmk__native_output_string(rsc, name, node, options,
|
||||
+ target_role, true);
|
||||
|
||||
out->list_item(out, NULL, "%s", s);
|
||||
g_free(s);
|
||||
@@ -923,8 +927,8 @@ common_print(pe_resource_t * rsc, const char *pre_text, const char *name, pe_nod
|
||||
}
|
||||
|
||||
{
|
||||
- gchar *resource_s = native_output_string(rsc, name, node, options,
|
||||
- target_role, false);
|
||||
+ gchar *resource_s = pcmk__native_output_string(rsc, name, node, options,
|
||||
+ target_role, false);
|
||||
status_print("%s%s", (pre_text? pre_text : ""), resource_s);
|
||||
g_free(resource_s);
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 7ed7675615ada7d0be5654e0dcb26de60cf5b5e9 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Mon, 22 Jun 2020 20:03:56 -0500
|
||||
Subject: [PATCH] Test: scheduler: explicitly disable concurrent-fencing in
|
||||
on_fail_demote4
|
||||
|
||||
... so the expected output is the same regardless of what default the build was
|
||||
compiled with
|
||||
---
|
||||
cts/scheduler/on_fail_demote4.xml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/cts/scheduler/on_fail_demote4.xml b/cts/scheduler/on_fail_demote4.xml
|
||||
index eb4c4cc..1082266 100644
|
||||
--- a/cts/scheduler/on_fail_demote4.xml
|
||||
+++ b/cts/scheduler/on_fail_demote4.xml
|
||||
@@ -8,6 +8,7 @@
|
||||
<nvpair id="cts-shutdown-escalation" name="shutdown-escalation" value="5min"/>
|
||||
<nvpair id="cts-batch-limit" name="batch-limit" value="10"/>
|
||||
<nvpair id="cts-dc-deadtime" name="dc-deadtime" value="5s"/>
|
||||
+ <nvpair id="cts-concurrent-fencing" name="concurrent-fencing" value="false"/>
|
||||
<nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
|
||||
<nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="2.0.4-578.6e1b582.git.el7_8-6e1b582"/>
|
||||
<nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
|
||||
--
|
||||
1.8.3.1
|
||||
|
210
SOURCES/005-feature-set.patch
Normal file
210
SOURCES/005-feature-set.patch
Normal file
@ -0,0 +1,210 @@
|
||||
From 477b7b679d58455dc38c2594b29a1ecfbe88e80c Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 2 Nov 2020 14:55:27 -0500
|
||||
Subject: [PATCH 1/2] Fix: libcrmcommon: Prevent a segfault in
|
||||
pcmk__cmdline_preproc.
|
||||
|
||||
The list of special single-character args is optional. The function
|
||||
currently handles it being an empty string, but it should handle a NULL
|
||||
as well.
|
||||
---
|
||||
lib/common/cmdline.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/common/cmdline.c b/lib/common/cmdline.c
|
||||
index d66ccc7..66f1976 100644
|
||||
--- a/lib/common/cmdline.c
|
||||
+++ b/lib/common/cmdline.c
|
||||
@@ -203,7 +203,7 @@ pcmk__cmdline_preproc(char **argv, const char *special) {
|
||||
* glib does not. Grab both the argument and its value and
|
||||
* separate them into a new argument.
|
||||
*/
|
||||
- if (strchr(special, *ch) != NULL) {
|
||||
+ if (special != NULL && strchr(special, *ch) != NULL) {
|
||||
/* The argument does not occur at the end of this string of
|
||||
* arguments. Take everything through the end as its value.
|
||||
*/
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From d1f4a975fa783045254521f415f1899b34ee96e3 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 2 Nov 2020 16:06:29 -0500
|
||||
Subject: [PATCH 2/2] Test: libcrmcommon: Add unit tests for
|
||||
pcmk__cmdline_preproc.
|
||||
|
||||
---
|
||||
configure.ac | 1 +
|
||||
lib/common/tests/Makefile.am | 2 +-
|
||||
lib/common/tests/cmdline/Makefile.am | 29 ++++++
|
||||
.../tests/cmdline/pcmk__cmdline_preproc_test.c | 102 +++++++++++++++++++++
|
||||
4 files changed, 133 insertions(+), 1 deletion(-)
|
||||
create mode 100644 lib/common/tests/cmdline/Makefile.am
|
||||
create mode 100644 lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 7ed4a30..36e85a9 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -2006,6 +2006,7 @@ AC_CONFIG_FILES(Makefile \
|
||||
lib/pacemaker-cluster.pc \
|
||||
lib/common/Makefile \
|
||||
lib/common/tests/Makefile \
|
||||
+ lib/common/tests/cmdline/Makefile \
|
||||
lib/common/tests/flags/Makefile \
|
||||
lib/common/tests/operations/Makefile \
|
||||
lib/common/tests/strings/Makefile \
|
||||
diff --git a/lib/common/tests/Makefile.am b/lib/common/tests/Makefile.am
|
||||
index 33c45cb..f3eaeec 100644
|
||||
--- a/lib/common/tests/Makefile.am
|
||||
+++ b/lib/common/tests/Makefile.am
|
||||
@@ -1 +1 @@
|
||||
-SUBDIRS = flags operations strings utils
|
||||
+SUBDIRS = cmdline flags operations strings utils
|
||||
diff --git a/lib/common/tests/cmdline/Makefile.am b/lib/common/tests/cmdline/Makefile.am
|
||||
new file mode 100644
|
||||
index 0000000..e69ef21
|
||||
--- /dev/null
|
||||
+++ b/lib/common/tests/cmdline/Makefile.am
|
||||
@@ -0,0 +1,29 @@
|
||||
+#
|
||||
+# Copyright 2020 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
|
||||
+LDADD = $(top_builddir)/lib/common/libcrmcommon.la
|
||||
+
|
||||
+include $(top_srcdir)/mk/glib-tap.mk
|
||||
+
|
||||
+# Add each test program here. Each test should be written as a little standalone
|
||||
+# program using the glib unit testing functions. See the documentation for more
|
||||
+# information.
|
||||
+#
|
||||
+# https://developer.gnome.org/glib/unstable/glib-Testing.html
|
||||
+#
|
||||
+# Add "_test" to the end of all test program names to simplify .gitignore.
|
||||
+test_programs = pcmk__cmdline_preproc_test
|
||||
+
|
||||
+# If any extra data needs to be added to the source distribution, add it to the
|
||||
+# following list.
|
||||
+dist_test_data =
|
||||
+
|
||||
+# If any extra data needs to be used by tests but should not be added to the
|
||||
+# source distribution, add it to the following list.
|
||||
+test_data =
|
||||
diff --git a/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c b/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c
|
||||
new file mode 100644
|
||||
index 0000000..e13c983
|
||||
--- /dev/null
|
||||
+++ b/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c
|
||||
@@ -0,0 +1,102 @@
|
||||
+/*
|
||||
+ * Copyright 2020 the Pacemaker project contributors
|
||||
+ *
|
||||
+ * The version control history for this file may have further details.
|
||||
+ *
|
||||
+ * This source code is licensed under the GNU Lesser General Public License
|
||||
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
|
||||
+ */
|
||||
+
|
||||
+#include <crm_internal.h>
|
||||
+#include <crm/common/cmdline_internal.h>
|
||||
+
|
||||
+#define LISTS_EQ(a, b) { \
|
||||
+ g_assert_cmpint(g_strv_length((gchar **) (a)), ==, g_strv_length((gchar **) (b))); \
|
||||
+ for (int i = 0; i < g_strv_length((a)); i++) { \
|
||||
+ g_assert_cmpstr((a)[i], ==, (b)[i]); \
|
||||
+ } \
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+empty_input(void) {
|
||||
+ g_assert_cmpint(pcmk__cmdline_preproc(NULL, "") == NULL, ==, TRUE);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+no_specials(void) {
|
||||
+ const char *argv[] = { "-a", "-b", "-c", "-d", NULL };
|
||||
+ const gchar *expected[] = { "-a", "-b", "-c", "-d", NULL };
|
||||
+
|
||||
+ gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL);
|
||||
+ LISTS_EQ(processed, expected);
|
||||
+ g_strfreev(processed);
|
||||
+
|
||||
+ processed = pcmk__cmdline_preproc((char **) argv, "");
|
||||
+ LISTS_EQ(processed, expected);
|
||||
+ g_strfreev(processed);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+single_dash(void) {
|
||||
+ const char *argv[] = { "-", NULL };
|
||||
+ const gchar *expected[] = { "-", NULL };
|
||||
+
|
||||
+ gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL);
|
||||
+ LISTS_EQ(processed, expected);
|
||||
+ g_strfreev(processed);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+double_dash(void) {
|
||||
+ const char *argv[] = { "-a", "--", "-bc", NULL };
|
||||
+ const gchar *expected[] = { "-a", "--", "-bc", NULL };
|
||||
+
|
||||
+ gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL);
|
||||
+ LISTS_EQ(processed, expected);
|
||||
+ g_strfreev(processed);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+special_args(void) {
|
||||
+ const char *argv[] = { "-aX", "-Fval", NULL };
|
||||
+ const gchar *expected[] = { "-a", "X", "-F", "val", NULL };
|
||||
+
|
||||
+ gchar **processed = pcmk__cmdline_preproc((char **) argv, "aF");
|
||||
+ LISTS_EQ(processed, expected);
|
||||
+ g_strfreev(processed);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+special_arg_at_end(void) {
|
||||
+ const char *argv[] = { "-a", NULL };
|
||||
+ const gchar *expected[] = { "-a", NULL };
|
||||
+
|
||||
+ gchar **processed = pcmk__cmdline_preproc((char **) argv, "a");
|
||||
+ LISTS_EQ(processed, expected);
|
||||
+ g_strfreev(processed);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+long_arg(void) {
|
||||
+ const char *argv[] = { "--blah=foo", NULL };
|
||||
+ const gchar *expected[] = { "--blah=foo", NULL };
|
||||
+
|
||||
+ gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL);
|
||||
+ LISTS_EQ(processed, expected);
|
||||
+ g_strfreev(processed);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(int argc, char **argv)
|
||||
+{
|
||||
+ g_test_init(&argc, &argv, NULL);
|
||||
+
|
||||
+ g_test_add_func("/common/cmdline/preproc/empty_input", empty_input);
|
||||
+ g_test_add_func("/common/cmdline/preproc/no_specials", no_specials);
|
||||
+ g_test_add_func("/common/cmdline/preproc/single_dash", single_dash);
|
||||
+ g_test_add_func("/common/cmdline/preproc/double_dash", double_dash);
|
||||
+ g_test_add_func("/common/cmdline/preproc/special_args", special_args);
|
||||
+ g_test_add_func("/common/cmdline/preproc/special_arg_at_end", special_arg_at_end);
|
||||
+ g_test_add_func("/common/cmdline/preproc/long_arg", long_arg);
|
||||
+ return g_test_run();
|
||||
+}
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 85040eb19b9405464b01a7e67eb6769d2a03c611 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Fri, 19 Jun 2020 17:49:22 -0500
|
||||
Subject: [PATCH] Doc: sysconfig: remove outdated reference to wildcards in
|
||||
PCMK_trace_files
|
||||
|
||||
Wildcards stopped working when the log filtering implementation changed in
|
||||
1.1.8 to support PCMK_trace_tags. It's not worth the effort to fix at this
|
||||
point, so just update the comment in the sysconfig file.
|
||||
---
|
||||
daemons/pacemakerd/pacemaker.sysconfig | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/daemons/pacemakerd/pacemaker.sysconfig b/daemons/pacemakerd/pacemaker.sysconfig
|
||||
index c7745d8..e4a5c4d 100644
|
||||
--- a/daemons/pacemakerd/pacemaker.sysconfig
|
||||
+++ b/daemons/pacemakerd/pacemaker.sysconfig
|
||||
@@ -34,9 +34,8 @@
|
||||
# Log all messages from a comma-separated list of functions.
|
||||
# PCMK_trace_functions=function1,function2,function3
|
||||
|
||||
-# Log all messages from a comma-separated list of files (no path).
|
||||
-# Wildcards are supported, e.g. PCMK_trace_files=prefix*.c
|
||||
-# PCMK_trace_files=file.c,other.h
|
||||
+# Log all messages from a comma-separated list of file names (without path).
|
||||
+# PCMK_trace_files=file1.c,file2.c
|
||||
|
||||
# Log all messages matching comma-separated list of formats.
|
||||
# PCMK_trace_formats="Sent delete %d"
|
||||
--
|
||||
1.8.3.1
|
||||
|
7903
SOURCES/006-digests.patch
Normal file
7903
SOURCES/006-digests.patch
Normal file
File diff suppressed because it is too large
Load Diff
5949
SOURCES/007-feature-set.patch
Normal file
5949
SOURCES/007-feature-set.patch
Normal file
File diff suppressed because it is too large
Load Diff
1764
SOURCES/008-digests.patch
Normal file
1764
SOURCES/008-digests.patch
Normal file
File diff suppressed because it is too large
Load Diff
846
SOURCES/009-digests.patch
Normal file
846
SOURCES/009-digests.patch
Normal file
@ -0,0 +1,846 @@
|
||||
From df587aaec07b4a08364d4024b3d0c73e6dede562 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Mon, 9 Nov 2020 14:55:42 -0600
|
||||
Subject: [PATCH 1/9] Refactor: scheduler: simplify XML attribute filtering
|
||||
function
|
||||
|
||||
---
|
||||
lib/pengine/pe_digest.c | 52 ++++++++++++++++++++++++++-----------------------
|
||||
1 file changed, 28 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/pe_digest.c b/lib/pengine/pe_digest.c
|
||||
index 5bcd22b..1e119f9 100644
|
||||
--- a/lib/pengine/pe_digest.c
|
||||
+++ b/lib/pengine/pe_digest.c
|
||||
@@ -45,30 +45,38 @@ pe__free_digests(gpointer ptr)
|
||||
}
|
||||
}
|
||||
|
||||
+/*!
|
||||
+ * \internal
|
||||
+ * \brief Remove named attributes from an XML element
|
||||
+ *
|
||||
+ * \param[in,out] param_set XML to be filtered
|
||||
+ * \param[in] param_string Space-separated list of attribute names
|
||||
+ * \param[in] need_present Whether to remove attributes that match,
|
||||
+ * or those that don't match
|
||||
+ */
|
||||
static void
|
||||
-filter_parameters(xmlNode * param_set, const char *param_string, bool need_present)
|
||||
+filter_parameters(xmlNode *param_set, const char *param_string,
|
||||
+ bool need_present)
|
||||
{
|
||||
- if (param_set && param_string) {
|
||||
- xmlAttrPtr xIter = param_set->properties;
|
||||
-
|
||||
- while (xIter) {
|
||||
- const char *prop_name = (const char *)xIter->name;
|
||||
- char *name = crm_strdup_printf(" %s ", prop_name);
|
||||
- char *match = strstr(param_string, name);
|
||||
+ if ((param_set == NULL) || (param_string == NULL)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (xmlAttrPtr xIter = param_set->properties; xIter; ) {
|
||||
+ const char *prop_name = (const char *) xIter->name;
|
||||
+ char *name = crm_strdup_printf(" %s ", prop_name);
|
||||
+ char *match = strstr(param_string, name);
|
||||
|
||||
- free(name);
|
||||
+ free(name);
|
||||
|
||||
- // Do now, because current entry might get removed below
|
||||
- xIter = xIter->next;
|
||||
+ // Do now, because current entry might get removed below
|
||||
+ xIter = xIter->next;
|
||||
|
||||
- if (need_present && match == NULL) {
|
||||
- crm_trace("%s not found in %s", prop_name, param_string);
|
||||
- xml_remove_prop(param_set, prop_name);
|
||||
+ if ((need_present && (match == NULL))
|
||||
+ || (!need_present && (match != NULL))) {
|
||||
|
||||
- } else if (need_present == FALSE && match) {
|
||||
- crm_trace("%s found in %s", prop_name, param_string);
|
||||
- xml_remove_prop(param_set, prop_name);
|
||||
- }
|
||||
+ crm_trace("Filtering %s (%sfound in '%s')",
|
||||
+ prop_name, (need_present? "not " : ""), param_string);
|
||||
+ xml_remove_prop(param_set, prop_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,9 +211,7 @@ calculate_secure_digest(op_digest_cache_t *data, pe_resource_t *rsc,
|
||||
g_hash_table_foreach(overrides, hash2field, data->params_secure);
|
||||
}
|
||||
g_hash_table_foreach(rsc->parameters, hash2field, data->params_secure);
|
||||
- if (secure_list != NULL) {
|
||||
- filter_parameters(data->params_secure, secure_list, FALSE);
|
||||
- }
|
||||
+ filter_parameters(data->params_secure, secure_list, FALSE);
|
||||
if (pcmk_is_set(pcmk_get_ra_caps(class),
|
||||
pcmk_ra_cap_fence_params)) {
|
||||
/* For stonith resources, Pacemaker adds special parameters,
|
||||
@@ -259,9 +265,7 @@ calculate_restart_digest(op_digest_cache_t *data, xmlNode *xml_op,
|
||||
|
||||
// Then filter out reloadable parameters, if any
|
||||
value = crm_element_value(xml_op, XML_LRM_ATTR_OP_RESTART);
|
||||
- if (value != NULL) {
|
||||
- filter_parameters(data->params_restart, value, TRUE);
|
||||
- }
|
||||
+ filter_parameters(data->params_restart, value, TRUE);
|
||||
|
||||
value = crm_element_value(xml_op, XML_ATTR_CRM_VERSION);
|
||||
data->digest_restart_calc = calculate_operation_digest(data->params_restart,
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From f030af8771601d46947ac9276538c46c6c296504 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Mon, 9 Nov 2020 18:37:37 -0600
|
||||
Subject: [PATCH 2/9] Refactor: scheduler: remember whether action is probe
|
||||
when unpacking
|
||||
|
||||
... to reduce code duplication and improve readability
|
||||
---
|
||||
lib/pengine/utils.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c
|
||||
index 04110be..b0922fa 100644
|
||||
--- a/lib/pengine/utils.c
|
||||
+++ b/lib/pengine/utils.c
|
||||
@@ -995,6 +995,8 @@ unpack_operation(pe_action_t * action, xmlNode * xml_obj, pe_resource_t * contai
|
||||
{
|
||||
int timeout_ms = 0;
|
||||
const char *value = NULL;
|
||||
+ bool is_probe = pcmk__str_eq(action->task, RSC_STATUS, pcmk__str_casei)
|
||||
+ && (interval_ms == 0);
|
||||
#if ENABLE_VERSIONED_ATTRS
|
||||
pe_rsc_action_details_t *rsc_details = NULL;
|
||||
#endif
|
||||
@@ -1026,8 +1028,7 @@ unpack_operation(pe_action_t * action, xmlNode * xml_obj, pe_resource_t * contai
|
||||
action->meta, NULL, FALSE, data_set);
|
||||
|
||||
// Determine probe default timeout differently
|
||||
- if (pcmk__str_eq(action->task, RSC_STATUS, pcmk__str_casei)
|
||||
- && (interval_ms == 0)) {
|
||||
+ if (is_probe) {
|
||||
xmlNode *min_interval_mon = find_min_interval_mon(action->rsc, FALSE);
|
||||
|
||||
if (min_interval_mon) {
|
||||
@@ -1099,8 +1100,7 @@ unpack_operation(pe_action_t * action, xmlNode * xml_obj, pe_resource_t * contai
|
||||
if (pcmk_is_set(pcmk_get_ra_caps(rsc_rule_data.standard),
|
||||
pcmk_ra_cap_fence_params)
|
||||
&& (pcmk__str_eq(action->task, RSC_START, pcmk__str_casei)
|
||||
- || (pcmk__str_eq(action->task, RSC_STATUS, pcmk__str_casei)
|
||||
- && (interval_ms == 0)))
|
||||
+ || is_probe)
|
||||
&& action->rsc->parameters) {
|
||||
|
||||
value = g_hash_table_lookup(action->rsc->parameters,
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 9de547849697cd6a3581db3f83b04f68d0405d9d Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Tue, 10 Nov 2020 15:15:01 -0600
|
||||
Subject: [PATCH 3/9] Refactor: scheduler: don't include originally unpacked
|
||||
resource parameters in digest
|
||||
|
||||
Previously, when calculating an operation digest, calculate_main_digest() would
|
||||
grab the following, in order of highest to lowest precedence:
|
||||
|
||||
* instance attributes evaluated for the appropriate node
|
||||
* instance attributes specified with the operation
|
||||
* instance attributes as originally unpacked (without evaluating for any node)
|
||||
* resource meta-attributes
|
||||
|
||||
Adding the originally unpacked instance attributes was redundant, since
|
||||
node-evaluated instance attributes would always be a superset of those and
|
||||
would take precedence.
|
||||
---
|
||||
lib/pengine/pe_digest.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/lib/pengine/pe_digest.c b/lib/pengine/pe_digest.c
|
||||
index 1e119f9..dd6b753 100644
|
||||
--- a/lib/pengine/pe_digest.c
|
||||
+++ b/lib/pengine/pe_digest.c
|
||||
@@ -162,7 +162,6 @@ calculate_main_digest(op_digest_cache_t *data, pe_resource_t *rsc,
|
||||
}
|
||||
g_hash_table_foreach(local_rsc_params, hash2field, data->params_all);
|
||||
g_hash_table_foreach(action->extra, hash2field, data->params_all);
|
||||
- g_hash_table_foreach(rsc->parameters, hash2field, data->params_all);
|
||||
g_hash_table_foreach(action->meta, hash2metafield, data->params_all);
|
||||
|
||||
#if ENABLE_VERSIONED_ATTRS
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From e9921b2ab3e9eeab6227d97cc12b85fa04dfd187 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Fri, 13 Nov 2020 09:27:12 -0600
|
||||
Subject: [PATCH 4/9] Refactor: scheduler: reuse existing function to check for
|
||||
remote in XML
|
||||
|
||||
... to reduce code duplication and improve readability
|
||||
---
|
||||
lib/pengine/bundle.c | 21 +++------------------
|
||||
1 file changed, 3 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/bundle.c b/lib/pengine/bundle.c
|
||||
index 76730c7..4f6eac3 100644
|
||||
--- a/lib/pengine/bundle.c
|
||||
+++ b/lib/pengine/bundle.c
|
||||
@@ -959,28 +959,13 @@ pe__bundle_needs_remote_name(pe_resource_t *rsc)
|
||||
const char *value;
|
||||
|
||||
if (rsc == NULL) {
|
||||
- return FALSE;
|
||||
+ return false;
|
||||
}
|
||||
|
||||
value = g_hash_table_lookup(rsc->parameters, XML_RSC_ATTR_REMOTE_RA_ADDR);
|
||||
- if (!pcmk__str_eq(value, "#uname", pcmk__str_casei)) {
|
||||
- return FALSE;
|
||||
|
||||
- } else {
|
||||
- const char *match[3][2] = {
|
||||
- { XML_ATTR_TYPE, "remote" },
|
||||
- { XML_AGENT_ATTR_CLASS, PCMK_RESOURCE_CLASS_OCF },
|
||||
- { XML_AGENT_ATTR_PROVIDER, "pacemaker" },
|
||||
- };
|
||||
-
|
||||
- for (int m = 0; m < 3; m++) {
|
||||
- value = crm_element_value(rsc->xml, match[m][0]);
|
||||
- if (!pcmk__str_eq(value, match[m][1], pcmk__str_casei)) {
|
||||
- return FALSE;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- return TRUE;
|
||||
+ return pcmk__str_eq(value, "#uname", pcmk__str_casei)
|
||||
+ && xml_contains_remote_node(rsc->xml);
|
||||
}
|
||||
|
||||
const char *
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 0f220e1cd25ec095492ac4b346452520f4b71cf1 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Wed, 11 Nov 2020 15:29:46 -0600
|
||||
Subject: [PATCH 5/9] Refactor: scheduler: remove dead code
|
||||
|
||||
Several internal expression-testing functions were unused. While they might
|
||||
have had some potential future value, the abundance of similarly named
|
||||
functions made debugging difficult. Comment blocks were added to the functions
|
||||
they wrapped, which should add similar value.
|
||||
|
||||
Also, we had an internal wrapper for pe__eval_date_expr() that was used
|
||||
only in crm_rule, so it was moved there.
|
||||
---
|
||||
include/crm/pengine/rules_internal.h | 10 +--
|
||||
lib/pengine/rules.c | 130 +++++++++++------------------------
|
||||
tools/crm_rule.c | 27 +++++++-
|
||||
3 files changed, 66 insertions(+), 101 deletions(-)
|
||||
|
||||
diff --git a/include/crm/pengine/rules_internal.h b/include/crm/pengine/rules_internal.h
|
||||
index f60263a..7380826 100644
|
||||
--- a/include/crm/pengine/rules_internal.h
|
||||
+++ b/include/crm/pengine/rules_internal.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2015-2019 the Pacemaker project contributors
|
||||
+ * Copyright 2015-2020 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -28,14 +28,6 @@ gboolean pe__eval_op_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data);
|
||||
gboolean pe__eval_role_expr(xmlNode *expr, pe_rule_eval_data_t *rule_data);
|
||||
gboolean pe__eval_rsc_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data);
|
||||
|
||||
-int pe_eval_date_expression(xmlNode *time_expr,
|
||||
- crm_time_t *now,
|
||||
- crm_time_t *next_change);
|
||||
-gboolean pe_test_date_expression(xmlNode *time_expr, crm_time_t *now,
|
||||
- crm_time_t *next_change);
|
||||
int pe_cron_range_satisfied(crm_time_t * now, xmlNode * cron_spec);
|
||||
-gboolean pe_test_attr_expression(xmlNode *expr, GHashTable *hash, crm_time_t *now,
|
||||
- pe_match_data_t *match_data);
|
||||
-gboolean pe_test_role_expression(xmlNode * expr, enum rsc_role_e role, crm_time_t * now);
|
||||
|
||||
#endif
|
||||
diff --git a/lib/pengine/rules.c b/lib/pengine/rules.c
|
||||
index 28562aa..be30e67 100644
|
||||
--- a/lib/pengine/rules.c
|
||||
+++ b/lib/pengine/rules.c
|
||||
@@ -140,37 +140,6 @@ find_expression_type(xmlNode * expr)
|
||||
return attr_expr;
|
||||
}
|
||||
|
||||
-gboolean
|
||||
-pe_test_role_expression(xmlNode *expr, enum rsc_role_e role, crm_time_t *now)
|
||||
-{
|
||||
- pe_rule_eval_data_t rule_data = {
|
||||
- .node_hash = NULL,
|
||||
- .role = role,
|
||||
- .now = now,
|
||||
- .match_data = NULL,
|
||||
- .rsc_data = NULL,
|
||||
- .op_data = NULL
|
||||
- };
|
||||
-
|
||||
- return pe__eval_role_expr(expr, &rule_data);
|
||||
-}
|
||||
-
|
||||
-gboolean
|
||||
-pe_test_attr_expression(xmlNode *expr, GHashTable *hash, crm_time_t *now,
|
||||
- pe_match_data_t *match_data)
|
||||
-{
|
||||
- pe_rule_eval_data_t rule_data = {
|
||||
- .node_hash = hash,
|
||||
- .role = RSC_ROLE_UNKNOWN,
|
||||
- .now = now,
|
||||
- .match_data = match_data,
|
||||
- .rsc_data = NULL,
|
||||
- .op_data = NULL
|
||||
- };
|
||||
-
|
||||
- return pe__eval_attr_expr(expr, &rule_data);
|
||||
-}
|
||||
-
|
||||
/* As per the nethack rules:
|
||||
*
|
||||
* moon period = 29.53058 days ~= 30, year = 365.2422 days
|
||||
@@ -331,38 +300,6 @@ pe_parse_xml_duration(crm_time_t * start, xmlNode * duration_spec)
|
||||
return end;
|
||||
}
|
||||
|
||||
-/*!
|
||||
- * \internal
|
||||
- * \brief Test a date expression (pass/fail) for a specific time
|
||||
- *
|
||||
- * \param[in] time_expr date_expression XML
|
||||
- * \param[in] now Time for which to evaluate expression
|
||||
- * \param[out] next_change If not NULL, set to when evaluation will change
|
||||
- *
|
||||
- * \return TRUE if date expression is in effect at given time, FALSE otherwise
|
||||
- */
|
||||
-gboolean
|
||||
-pe_test_date_expression(xmlNode *expr, crm_time_t *now, crm_time_t *next_change)
|
||||
-{
|
||||
- pe_rule_eval_data_t rule_data = {
|
||||
- .node_hash = NULL,
|
||||
- .role = RSC_ROLE_UNKNOWN,
|
||||
- .now = now,
|
||||
- .match_data = NULL,
|
||||
- .rsc_data = NULL,
|
||||
- .op_data = NULL
|
||||
- };
|
||||
-
|
||||
- switch (pe__eval_date_expr(expr, &rule_data, next_change)) {
|
||||
- case pcmk_rc_within_range:
|
||||
- case pcmk_rc_ok:
|
||||
- return TRUE;
|
||||
-
|
||||
- default:
|
||||
- return FALSE;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
// Set next_change to t if t is earlier
|
||||
static void
|
||||
crm_time_set_if_earlier(crm_time_t *next_change, crm_time_t *t)
|
||||
@@ -375,31 +312,6 @@ crm_time_set_if_earlier(crm_time_t *next_change, crm_time_t *t)
|
||||
}
|
||||
}
|
||||
|
||||
-/*!
|
||||
- * \internal
|
||||
- * \brief Evaluate a date expression for a specific time
|
||||
- *
|
||||
- * \param[in] time_expr date_expression XML
|
||||
- * \param[in] now Time for which to evaluate expression
|
||||
- * \param[out] next_change If not NULL, set to when evaluation will change
|
||||
- *
|
||||
- * \return Standard Pacemaker return code
|
||||
- */
|
||||
-int
|
||||
-pe_eval_date_expression(xmlNode *expr, crm_time_t *now, crm_time_t *next_change)
|
||||
-{
|
||||
- pe_rule_eval_data_t rule_data = {
|
||||
- .node_hash = NULL,
|
||||
- .role = RSC_ROLE_UNKNOWN,
|
||||
- .now = now,
|
||||
- .match_data = NULL,
|
||||
- .rsc_data = NULL,
|
||||
- .op_data = NULL
|
||||
- };
|
||||
-
|
||||
- return pe__eval_date_expr(expr, &rule_data, next_change);
|
||||
-}
|
||||
-
|
||||
// Information about a block of nvpair elements
|
||||
typedef struct sorted_set_s {
|
||||
int score; // This block's score for sorting
|
||||
@@ -908,7 +820,16 @@ pe_eval_subexpr(xmlNode *expr, pe_rule_eval_data_t *rule_data, crm_time_t *next_
|
||||
break;
|
||||
|
||||
case time_expr:
|
||||
- accept = pe_test_date_expression(expr, rule_data->now, next_change);
|
||||
+ switch (pe__eval_date_expr(expr, rule_data, next_change)) {
|
||||
+ case pcmk_rc_within_range:
|
||||
+ case pcmk_rc_ok:
|
||||
+ accept = TRUE;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ accept = FALSE;
|
||||
+ break;
|
||||
+ }
|
||||
break;
|
||||
|
||||
case role_expr:
|
||||
@@ -1104,6 +1025,16 @@ accept_attr_expr(const char *l_val, const char *r_val, const char *type,
|
||||
return false; // Should never reach this point
|
||||
}
|
||||
|
||||
+/*!
|
||||
+ * \internal
|
||||
+ * \brief Evaluate a node attribute expression based on #uname, #id, #kind,
|
||||
+ * or a generic node attribute
|
||||
+ *
|
||||
+ * \param[in] expr XML of rule expression
|
||||
+ * \param[in] rule_data The match_data and node_hash members are used
|
||||
+ *
|
||||
+ * \return TRUE if rule_data satisfies the expression, FALSE otherwise
|
||||
+ */
|
||||
gboolean
|
||||
pe__eval_attr_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data)
|
||||
{
|
||||
@@ -1169,8 +1100,16 @@ pe__eval_attr_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data)
|
||||
return accept_attr_expr(h_val, value, type, op);
|
||||
}
|
||||
|
||||
-
|
||||
-
|
||||
+/*!
|
||||
+ * \internal
|
||||
+ * \brief Evaluate a date_expression
|
||||
+ *
|
||||
+ * \param[in] expr XML of rule expression
|
||||
+ * \param[in] rule_data Only the now member is used
|
||||
+ * \param[out] next_change If not NULL, set to when evaluation will change
|
||||
+ *
|
||||
+ * \return Standard Pacemaker return code
|
||||
+ */
|
||||
int
|
||||
pe__eval_date_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data, crm_time_t *next_change)
|
||||
{
|
||||
@@ -1285,6 +1224,15 @@ pe__eval_op_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+/*!
|
||||
+ * \internal
|
||||
+ * \brief Evaluate a node attribute expression based on #role
|
||||
+ *
|
||||
+ * \param[in] expr XML of rule expression
|
||||
+ * \param[in] rule_data Only the role member is used
|
||||
+ *
|
||||
+ * \return TRUE if rule_data->role satisfies the expression, FALSE otherwise
|
||||
+ */
|
||||
gboolean
|
||||
pe__eval_role_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data)
|
||||
{
|
||||
diff --git a/tools/crm_rule.c b/tools/crm_rule.c
|
||||
index 0e44828..2871f3d 100644
|
||||
--- a/tools/crm_rule.c
|
||||
+++ b/tools/crm_rule.c
|
||||
@@ -75,6 +75,31 @@ mode_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **e
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+/*!
|
||||
+ * \internal
|
||||
+ * \brief Evaluate a date expression for a specific time
|
||||
+ *
|
||||
+ * \param[in] time_expr date_expression XML
|
||||
+ * \param[in] now Time for which to evaluate expression
|
||||
+ * \param[out] next_change If not NULL, set to when evaluation will change
|
||||
+ *
|
||||
+ * \return Standard Pacemaker return code
|
||||
+ */
|
||||
+static int
|
||||
+eval_date_expression(xmlNode *expr, crm_time_t *now, crm_time_t *next_change)
|
||||
+{
|
||||
+ pe_rule_eval_data_t rule_data = {
|
||||
+ .node_hash = NULL,
|
||||
+ .role = RSC_ROLE_UNKNOWN,
|
||||
+ .now = now,
|
||||
+ .match_data = NULL,
|
||||
+ .rsc_data = NULL,
|
||||
+ .op_data = NULL
|
||||
+ };
|
||||
+
|
||||
+ return pe__eval_date_expr(expr, &rule_data, next_change);
|
||||
+}
|
||||
+
|
||||
static int
|
||||
crm_rule_check(pe_working_set_t *data_set, const char *rule_id, crm_time_t *effective_date)
|
||||
{
|
||||
@@ -156,7 +181,7 @@ crm_rule_check(pe_working_set_t *data_set, const char *rule_id, crm_time_t *effe
|
||||
CRM_ASSERT(match != NULL);
|
||||
CRM_ASSERT(find_expression_type(match) == time_expr);
|
||||
|
||||
- rc = pe_eval_date_expression(match, effective_date, NULL);
|
||||
+ rc = eval_date_expression(match, effective_date, NULL);
|
||||
|
||||
if (rc == pcmk_rc_within_range) {
|
||||
printf("Rule %s is still in effect\n", rule_id);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 91a6ec4bec86de7389fcd64cb27e315da760f0dd Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Wed, 11 Nov 2020 16:44:57 -0600
|
||||
Subject: [PATCH 6/9] Refactor: scheduler: make constraint unpacking function
|
||||
static
|
||||
|
||||
... for linker efficiency and readability. Also change the return type to void
|
||||
since it was ignored (and the same for some related functions).
|
||||
---
|
||||
include/pcmki/pcmki_sched_allocate.h | 4 +--
|
||||
lib/pacemaker/pcmk_sched_constraints.c | 46 ++++++++++++++++------------------
|
||||
2 files changed, 23 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/include/pcmki/pcmki_sched_allocate.h b/include/pcmki/pcmki_sched_allocate.h
|
||||
index efc0da6..a7f8c11 100644
|
||||
--- a/include/pcmki/pcmki_sched_allocate.h
|
||||
+++ b/include/pcmki/pcmki_sched_allocate.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2004-2019 the Pacemaker project contributors
|
||||
+ * Copyright 2004-2020 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -143,8 +143,6 @@ extern gboolean unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
|
||||
extern gboolean unpack_rsc_colocation(xmlNode * xml_obj, pe_working_set_t * data_set);
|
||||
|
||||
-extern gboolean unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set);
|
||||
-
|
||||
extern gboolean unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set);
|
||||
|
||||
void LogNodeActions(pe_working_set_t * data_set, gboolean terminal);
|
||||
diff --git a/lib/pacemaker/pcmk_sched_constraints.c b/lib/pacemaker/pcmk_sched_constraints.c
|
||||
index 6ed2d8c..121754d 100644
|
||||
--- a/lib/pacemaker/pcmk_sched_constraints.c
|
||||
+++ b/lib/pacemaker/pcmk_sched_constraints.c
|
||||
@@ -48,6 +48,7 @@ static pe__location_t *generate_location_rule(pe_resource_t *rsc,
|
||||
crm_time_t *next_change,
|
||||
pe_working_set_t *data_set,
|
||||
pe_match_data_t *match_data);
|
||||
+static void unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set);
|
||||
|
||||
static bool
|
||||
evaluate_lifetime(xmlNode *lifetime, pe_working_set_t *data_set)
|
||||
@@ -709,11 +710,13 @@ tag_to_set(xmlNode * xml_obj, xmlNode ** rsc_set, const char * attr,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
-static gboolean unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role,
|
||||
- const char * score, pe_working_set_t * data_set, pe_match_data_t * match_data);
|
||||
+static void unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh,
|
||||
+ const char *role, const char *score,
|
||||
+ pe_working_set_t *data_set,
|
||||
+ pe_match_data_t *match_data);
|
||||
|
||||
-static gboolean
|
||||
-unpack_simple_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
+static void
|
||||
+unpack_simple_location(xmlNode *xml_obj, pe_working_set_t *data_set)
|
||||
{
|
||||
const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
|
||||
const char *value = crm_element_value(xml_obj, XML_LOC_ATTR_SOURCE);
|
||||
@@ -721,7 +724,7 @@ unpack_simple_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
if(value) {
|
||||
pe_resource_t *rsc_lh = pe_find_constraint_resource(data_set->resources, value);
|
||||
|
||||
- return unpack_rsc_location(xml_obj, rsc_lh, NULL, NULL, data_set, NULL);
|
||||
+ unpack_rsc_location(xml_obj, rsc_lh, NULL, NULL, data_set, NULL);
|
||||
}
|
||||
|
||||
value = crm_element_value(xml_obj, XML_LOC_ATTR_SOURCE_PATTERN);
|
||||
@@ -741,7 +744,7 @@ unpack_simple_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
" has invalid value '%s'", id, value);
|
||||
regfree(r_patt);
|
||||
free(r_patt);
|
||||
- return FALSE;
|
||||
+ return;
|
||||
}
|
||||
|
||||
for (rIter = data_set->resources; rIter; rIter = rIter->next) {
|
||||
@@ -787,13 +790,12 @@ unpack_simple_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
regfree(r_patt);
|
||||
free(r_patt);
|
||||
}
|
||||
-
|
||||
- return FALSE;
|
||||
}
|
||||
|
||||
-static gboolean
|
||||
-unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role,
|
||||
- const char * score, pe_working_set_t * data_set, pe_match_data_t * match_data)
|
||||
+static void
|
||||
+unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role,
|
||||
+ const char *score, pe_working_set_t *data_set,
|
||||
+ pe_match_data_t *match_data)
|
||||
{
|
||||
pe__location_t *location = NULL;
|
||||
const char *id_lh = crm_element_value(xml_obj, XML_LOC_ATTR_SOURCE);
|
||||
@@ -804,7 +806,7 @@ unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role
|
||||
if (rsc_lh == NULL) {
|
||||
pcmk__config_warn("Ignoring constraint '%s' because resource '%s' "
|
||||
"does not exist", id, id_lh);
|
||||
- return FALSE;
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (score == NULL) {
|
||||
@@ -816,7 +818,7 @@ unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role
|
||||
pe_node_t *match = pe_find_node(data_set->nodes, node);
|
||||
|
||||
if (!match) {
|
||||
- return FALSE;
|
||||
+ return;
|
||||
}
|
||||
location = rsc2node_new(id, rsc_lh, score_i, discovery, match, data_set);
|
||||
|
||||
@@ -850,7 +852,7 @@ unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role
|
||||
pe__update_recheck_time(t, data_set);
|
||||
}
|
||||
crm_time_free(next_change);
|
||||
- return TRUE;
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (role == NULL) {
|
||||
@@ -860,7 +862,7 @@ unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role
|
||||
if (location && role) {
|
||||
if (text2role(role) == RSC_ROLE_UNKNOWN) {
|
||||
pe_err("Invalid constraint %s: Bad role %s", id, role);
|
||||
- return FALSE;
|
||||
+ return;
|
||||
|
||||
} else {
|
||||
enum rsc_role_e r = text2role(role);
|
||||
@@ -877,8 +879,6 @@ unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
- return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -992,8 +992,8 @@ unpack_location_set(xmlNode * location, xmlNode * set, pe_working_set_t * data_s
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
-gboolean
|
||||
-unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
+static void
|
||||
+unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set)
|
||||
{
|
||||
xmlNode *set = NULL;
|
||||
gboolean any_sets = FALSE;
|
||||
@@ -1002,7 +1002,7 @@ unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
xmlNode *expanded_xml = NULL;
|
||||
|
||||
if (unpack_location_tags(xml_obj, &expanded_xml, data_set) == FALSE) {
|
||||
- return FALSE;
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (expanded_xml) {
|
||||
@@ -1020,7 +1020,7 @@ unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
if (expanded_xml) {
|
||||
free_xml(expanded_xml);
|
||||
}
|
||||
- return FALSE;
|
||||
+ return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1031,10 +1031,8 @@ unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set)
|
||||
}
|
||||
|
||||
if (any_sets == FALSE) {
|
||||
- return unpack_simple_location(xml_obj, data_set);
|
||||
+ unpack_simple_location(xml_obj, data_set);
|
||||
}
|
||||
-
|
||||
- return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From df842adafca8ba56ddb5b448490ffef54ea785d4 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Fri, 13 Nov 2020 09:19:51 -0600
|
||||
Subject: [PATCH 7/9] Refactor: scheduler: trivial refactoring of nvpair
|
||||
evaluation
|
||||
|
||||
... for readability
|
||||
---
|
||||
lib/pengine/rules.c | 15 +++++++--------
|
||||
1 file changed, 7 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/rules.c b/lib/pengine/rules.c
|
||||
index be30e67..86e7899 100644
|
||||
--- a/lib/pengine/rules.c
|
||||
+++ b/lib/pengine/rules.c
|
||||
@@ -529,20 +529,19 @@ static GList *
|
||||
make_pairs(xmlNode *top, xmlNode *xml_obj, const char *set_name,
|
||||
const char *always_first)
|
||||
{
|
||||
- GListPtr unsorted = NULL;
|
||||
- const char *score = NULL;
|
||||
- sorted_set_t *pair = NULL;
|
||||
- xmlNode *attr_set = NULL;
|
||||
+ GList *unsorted = NULL;
|
||||
|
||||
if (xml_obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
- for (attr_set = pcmk__xe_first_child(xml_obj); attr_set != NULL;
|
||||
+ for (xmlNode *attr_set = pcmk__xe_first_child(xml_obj); attr_set != NULL;
|
||||
attr_set = pcmk__xe_next(attr_set)) {
|
||||
|
||||
- /* Uncertain if set_name == NULL check is strictly necessary here */
|
||||
- if (pcmk__str_eq(set_name, (const char *)attr_set->name, pcmk__str_null_matches)) {
|
||||
- pair = NULL;
|
||||
+ if (pcmk__str_eq(set_name, (const char *) attr_set->name,
|
||||
+ pcmk__str_null_matches)) {
|
||||
+ const char *score = NULL;
|
||||
+ sorted_set_t *pair = NULL;
|
||||
+
|
||||
attr_set = expand_idref(attr_set, top);
|
||||
if (attr_set == NULL) {
|
||||
continue;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 373c224ac1c41bd47a928a7523744c6c678a6543 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Fri, 13 Nov 2020 09:21:35 -0600
|
||||
Subject: [PATCH 8/9] Low: scheduler: correctly skip dangling id-ref
|
||||
|
||||
When evaluating XML nvpair blocks, make_pairs() previously reused the
|
||||
"for" loop variable when expanding id-ref's. However if the id-ref was dangling
|
||||
(only possible if schema enforcement is turned off), this would make it NULL
|
||||
and thus exiting the loop instead of continuing.
|
||||
---
|
||||
lib/pengine/rules.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/rules.c b/lib/pengine/rules.c
|
||||
index 86e7899..1bd807f 100644
|
||||
--- a/lib/pengine/rules.c
|
||||
+++ b/lib/pengine/rules.c
|
||||
@@ -541,18 +541,19 @@ make_pairs(xmlNode *top, xmlNode *xml_obj, const char *set_name,
|
||||
pcmk__str_null_matches)) {
|
||||
const char *score = NULL;
|
||||
sorted_set_t *pair = NULL;
|
||||
+ xmlNode *expanded_attr_set = expand_idref(attr_set, top);
|
||||
|
||||
- attr_set = expand_idref(attr_set, top);
|
||||
- if (attr_set == NULL) {
|
||||
+ if (expanded_attr_set == NULL) {
|
||||
+ // Schema (if not "none") prevents this
|
||||
continue;
|
||||
}
|
||||
|
||||
pair = calloc(1, sizeof(sorted_set_t));
|
||||
- pair->name = ID(attr_set);
|
||||
+ pair->name = ID(expanded_attr_set);
|
||||
pair->special_name = always_first;
|
||||
- pair->attr_set = attr_set;
|
||||
+ pair->attr_set = expanded_attr_set;
|
||||
|
||||
- score = crm_element_value(attr_set, XML_RULE_ATTR_SCORE);
|
||||
+ score = crm_element_value(expanded_attr_set, XML_RULE_ATTR_SCORE);
|
||||
pair->score = char2score(score);
|
||||
|
||||
unsorted = g_list_prepend(unsorted, pair);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From b59717751c168ec745bedbcc5696bee11036d931 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Thu, 12 Nov 2020 14:37:27 -0600
|
||||
Subject: [PATCH 9/9] Low: scheduler: treat missing parameter as NULL in rules
|
||||
with value-source
|
||||
|
||||
Previously, if value-source were set to "param" or "meta", and an affected
|
||||
resource did not have the specified parameter, the parameter name would wrongly
|
||||
be used as the value to compare against. Now, use NULL as the value to compare
|
||||
against.
|
||||
---
|
||||
lib/pengine/rules.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/rules.c b/lib/pengine/rules.c
|
||||
index 1bd807f..e5d452f 100644
|
||||
--- a/lib/pengine/rules.c
|
||||
+++ b/lib/pengine/rules.c
|
||||
@@ -1041,6 +1041,7 @@ pe__eval_attr_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data)
|
||||
gboolean attr_allocated = FALSE;
|
||||
const char *h_val = NULL;
|
||||
GHashTable *table = NULL;
|
||||
+ bool literal = true;
|
||||
|
||||
const char *op = NULL;
|
||||
const char *type = NULL;
|
||||
@@ -1071,18 +1072,22 @@ pe__eval_attr_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data)
|
||||
}
|
||||
|
||||
if (pcmk__str_eq(value_source, "param", pcmk__str_casei)) {
|
||||
+ literal = false;
|
||||
table = rule_data->match_data->params;
|
||||
} else if (pcmk__str_eq(value_source, "meta", pcmk__str_casei)) {
|
||||
+ literal = false;
|
||||
table = rule_data->match_data->meta;
|
||||
}
|
||||
}
|
||||
|
||||
- if (table) {
|
||||
+ if (!literal) {
|
||||
const char *param_name = value;
|
||||
const char *param_value = NULL;
|
||||
|
||||
- if (param_name && param_name[0]) {
|
||||
- if ((param_value = (const char *)g_hash_table_lookup(table, param_name))) {
|
||||
+ value = NULL;
|
||||
+ if ((table != NULL) && !pcmk__str_empty(param_name)) {
|
||||
+ param_value = (const char *)g_hash_table_lookup(table, param_name);
|
||||
+ if (param_value != NULL) {
|
||||
value = param_value;
|
||||
}
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
26
SOURCES/010-feature-set.patch
Normal file
26
SOURCES/010-feature-set.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From d1b6b6cb5151763888ac8bc55708d2e7cbbf590b Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 19 Nov 2020 13:35:31 -0500
|
||||
Subject: [PATCH] Fix: scheduler: Fix output of failed actions without an
|
||||
operation_key.
|
||||
|
||||
---
|
||||
lib/pengine/pe_output.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
|
||||
index 1a3f93d..b91348f 100644
|
||||
--- a/lib/pengine/pe_output.c
|
||||
+++ b/lib/pengine/pe_output.c
|
||||
@@ -975,7 +975,7 @@ pe__failed_action_xml(pcmk__output_t *out, va_list args) {
|
||||
xmlNodePtr node = pcmk__output_create_xml_node(out, "failure");
|
||||
|
||||
xmlSetProp(node, (pcmkXmlStr) (op_key ? "op_key" : "id"),
|
||||
- (pcmkXmlStr) (op_key ? op_key : "id"));
|
||||
+ (pcmkXmlStr) (op_key ? op_key : ID(xml_op)));
|
||||
xmlSetProp(node, (pcmkXmlStr) "node",
|
||||
(pcmkXmlStr) crm_element_value(xml_op, XML_ATTR_UNAME));
|
||||
xmlSetProp(node, (pcmkXmlStr) "exitstatus",
|
||||
--
|
||||
1.8.3.1
|
||||
|
1900
SOURCES/011-feature-set.patch
Normal file
1900
SOURCES/011-feature-set.patch
Normal file
File diff suppressed because it is too large
Load Diff
2355
SOURCES/012-feature-set.patch
Normal file
2355
SOURCES/012-feature-set.patch
Normal file
File diff suppressed because it is too large
Load Diff
2808
SOURCES/013-feature-set.patch
Normal file
2808
SOURCES/013-feature-set.patch
Normal file
File diff suppressed because it is too large
Load Diff
285
SOURCES/014-feature-set.patch
Normal file
285
SOURCES/014-feature-set.patch
Normal file
@ -0,0 +1,285 @@
|
||||
From 0700a4814a598d0e2e9bd54f970c6d3ff66184df Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Tue, 24 Nov 2020 16:17:34 +0100
|
||||
Subject: [PATCH 1/2] Refactor: move stonith__register_messages() call from
|
||||
pcmk__out_prologue() to the calling functions
|
||||
|
||||
---
|
||||
lib/pacemaker/pcmk_fence.c | 14 ++++++++++++++
|
||||
lib/pacemaker/pcmk_output.c | 1 -
|
||||
2 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/pacemaker/pcmk_fence.c b/lib/pacemaker/pcmk_fence.c
|
||||
index 7beedff..d591379 100644
|
||||
--- a/lib/pacemaker/pcmk_fence.c
|
||||
+++ b/lib/pacemaker/pcmk_fence.c
|
||||
@@ -247,6 +247,8 @@ pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, char *target, unsigned int ti
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ stonith__register_messages(out);
|
||||
+
|
||||
out->quiet = quiet;
|
||||
|
||||
rc = pcmk__fence_history(out, st, target, timeout, verbose, broadcast, cleanup);
|
||||
@@ -287,6 +289,8 @@ pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ stonith__register_messages(out);
|
||||
+
|
||||
rc = pcmk__fence_installed(out, st, timeout);
|
||||
pcmk__out_epilogue(out, xml, rc);
|
||||
return rc;
|
||||
@@ -321,6 +325,8 @@ pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ stonith__register_messages(out);
|
||||
+
|
||||
rc = pcmk__fence_last(out, target, as_nodeid);
|
||||
pcmk__out_epilogue(out, xml, rc);
|
||||
return rc;
|
||||
@@ -364,6 +370,8 @@ pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st, const char *device_id,
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ stonith__register_messages(out);
|
||||
+
|
||||
rc = pcmk__fence_list_targets(out, st, device_id, timeout);
|
||||
pcmk__out_epilogue(out, xml, rc);
|
||||
return rc;
|
||||
@@ -398,6 +406,8 @@ pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, char *agent,
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ stonith__register_messages(out);
|
||||
+
|
||||
rc = pcmk__fence_metadata(out, st, agent, timeout);
|
||||
pcmk__out_epilogue(out, xml, rc);
|
||||
return rc;
|
||||
@@ -442,6 +452,8 @@ pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, char *target,
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ stonith__register_messages(out);
|
||||
+
|
||||
rc = pcmk__fence_registered(out, st, target, timeout);
|
||||
pcmk__out_epilogue(out, xml, rc);
|
||||
return rc;
|
||||
@@ -501,6 +513,8 @@ pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ stonith__register_messages(out);
|
||||
+
|
||||
rc = pcmk__fence_validate(out, st, agent, id, params, timeout);
|
||||
pcmk__out_epilogue(out, xml, rc);
|
||||
return rc;
|
||||
diff --git a/lib/pacemaker/pcmk_output.c b/lib/pacemaker/pcmk_output.c
|
||||
index 74a7c59..a637031 100644
|
||||
--- a/lib/pacemaker/pcmk_output.c
|
||||
+++ b/lib/pacemaker/pcmk_output.c
|
||||
@@ -34,7 +34,6 @@ pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
- stonith__register_messages(*out);
|
||||
return rc;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 27677a6d03ba42aeb0d6a971df9d9b8861232903 Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Tue, 24 Nov 2020 16:19:59 +0100
|
||||
Subject: [PATCH 2/2] API: libpacemaker: add public API functions for cluster
|
||||
queries
|
||||
|
||||
---
|
||||
include/pacemaker.h | 45 +++++++++++++++++++++-
|
||||
lib/pacemaker/pcmk_cluster_queries.c | 75 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 118 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/pacemaker.h b/include/pacemaker.h
|
||||
index a1e76d0..b2a73cd 100644
|
||||
--- a/include/pacemaker.h
|
||||
+++ b/include/pacemaker.h
|
||||
@@ -14,8 +14,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
-#ifdef BUILD_PUBLIC_LIBPACEMAKER
|
||||
-
|
||||
/**
|
||||
* \file
|
||||
* \brief High Level API
|
||||
@@ -26,6 +24,49 @@ extern "C" {
|
||||
# include <libxml/tree.h>
|
||||
|
||||
/*!
|
||||
+ * \brief Get controller status
|
||||
+ *
|
||||
+ * \param[in,out] xml The destination for the result, as an XML tree.
|
||||
+ * \param[in] dest_node Destination node for request
|
||||
+ * \param[in] message_timeout_ms Message timeout
|
||||
+ *
|
||||
+ * \return Standard Pacemaker return code
|
||||
+ */
|
||||
+int pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms);
|
||||
+
|
||||
+/*!
|
||||
+ * \brief Get designated controller
|
||||
+ *
|
||||
+ * \param[in,out] xml The destination for the result, as an XML tree.
|
||||
+ * \param[in] message_timeout_ms Message timeout
|
||||
+ *
|
||||
+ * \return Standard Pacemaker return code
|
||||
+ */
|
||||
+int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms);
|
||||
+
|
||||
+/*!
|
||||
+ * \brief Get pacemakerd status
|
||||
+ *
|
||||
+ * \param[in,out] xml The destination for the result, as an XML tree.
|
||||
+ * \param[in] ipc_name IPC name for request
|
||||
+ * \param[in] message_timeout_ms Message timeout
|
||||
+ *
|
||||
+ * \return Standard Pacemaker return code
|
||||
+ */
|
||||
+int pcmk_pacemakerd_status(xmlNodePtr *xml, char *ipc_name, unsigned int message_timeout_ms);
|
||||
+
|
||||
+#ifdef BUILD_PUBLIC_LIBPACEMAKER
|
||||
+
|
||||
+/*!
|
||||
+ * \brief Get nodes list
|
||||
+ *
|
||||
+ * \param[in,out] xml The destination for the result, as an XML tree.
|
||||
+ *
|
||||
+ * \return Standard Pacemaker return code
|
||||
+ */
|
||||
+int pcmk_list_nodes(xmlNodePtr *xml);
|
||||
+
|
||||
+/*!
|
||||
* \brief Perform a STONITH action.
|
||||
*
|
||||
* \param[in] st A connection to the STONITH API.
|
||||
diff --git a/lib/pacemaker/pcmk_cluster_queries.c b/lib/pacemaker/pcmk_cluster_queries.c
|
||||
index 8d729eb..c705b7f 100644
|
||||
--- a/lib/pacemaker/pcmk_cluster_queries.c
|
||||
+++ b/lib/pacemaker/pcmk_cluster_queries.c
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <glib.h> // gboolean, GMainLoop, etc.
|
||||
#include <libxml/tree.h> // xmlNode
|
||||
|
||||
+#include <pacemaker.h>
|
||||
#include <pacemaker-internal.h>
|
||||
|
||||
#include <crm/crm.h>
|
||||
@@ -282,6 +283,24 @@ pcmk__controller_status(pcmk__output_t *out, char *dest_node, guint message_time
|
||||
}
|
||||
|
||||
int
|
||||
+pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms)
|
||||
+{
|
||||
+ pcmk__output_t *out = NULL;
|
||||
+ int rc = pcmk_rc_ok;
|
||||
+
|
||||
+ rc = pcmk__out_prologue(&out, xml);
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ pcmk__register_lib_messages(out);
|
||||
+
|
||||
+ rc = pcmk__controller_status(out, dest_node, (guint) message_timeout_ms);
|
||||
+ pcmk__out_epilogue(out, xml, rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
pcmk__designated_controller(pcmk__output_t *out, guint message_timeout_ms)
|
||||
{
|
||||
data_t data = {
|
||||
@@ -309,6 +328,24 @@ pcmk__designated_controller(pcmk__output_t *out, guint message_timeout_ms)
|
||||
}
|
||||
|
||||
int
|
||||
+pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms)
|
||||
+{
|
||||
+ pcmk__output_t *out = NULL;
|
||||
+ int rc = pcmk_rc_ok;
|
||||
+
|
||||
+ rc = pcmk__out_prologue(&out, xml);
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ pcmk__register_lib_messages(out);
|
||||
+
|
||||
+ rc = pcmk__designated_controller(out, (guint) message_timeout_ms);
|
||||
+ pcmk__out_epilogue(out, xml, rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
pcmk__pacemakerd_status(pcmk__output_t *out, char *ipc_name, guint message_timeout_ms)
|
||||
{
|
||||
data_t data = {
|
||||
@@ -335,6 +372,24 @@ pcmk__pacemakerd_status(pcmk__output_t *out, char *ipc_name, guint message_timeo
|
||||
return data.rc;
|
||||
}
|
||||
|
||||
+int
|
||||
+pcmk_pacemakerd_status(xmlNodePtr *xml, char *ipc_name, unsigned int message_timeout_ms)
|
||||
+{
|
||||
+ pcmk__output_t *out = NULL;
|
||||
+ int rc = pcmk_rc_ok;
|
||||
+
|
||||
+ rc = pcmk__out_prologue(&out, xml);
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ pcmk__register_lib_messages(out);
|
||||
+
|
||||
+ rc = pcmk__pacemakerd_status(out, ipc_name, (guint) message_timeout_ms);
|
||||
+ pcmk__out_epilogue(out, xml, rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
// \return Standard Pacemaker return code
|
||||
int
|
||||
pcmk__list_nodes(pcmk__output_t *out, gboolean BASH_EXPORT)
|
||||
@@ -361,6 +416,26 @@ pcmk__list_nodes(pcmk__output_t *out, gboolean BASH_EXPORT)
|
||||
return pcmk_legacy2rc(rc);
|
||||
}
|
||||
|
||||
+#ifdef BUILD_PUBLIC_LIBPACEMAKER
|
||||
+int
|
||||
+pcmk_list_nodes(xmlNodePtr *xml)
|
||||
+{
|
||||
+ pcmk__output_t *out = NULL;
|
||||
+ int rc = pcmk_rc_ok;
|
||||
+
|
||||
+ rc = pcmk__out_prologue(&out, xml);
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ pcmk__register_lib_messages(out);
|
||||
+
|
||||
+ rc = pcmk__list_nodes(out, FALSE);
|
||||
+ pcmk__out_epilogue(out, xml, rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
// remove when parameters removed from tools/crmadmin.c
|
||||
int
|
||||
pcmk__shutdown_controller(pcmk__output_t *out, char *dest_node)
|
||||
--
|
||||
1.8.3.1
|
||||
|
114
SOURCES/015-feature-set.patch
Normal file
114
SOURCES/015-feature-set.patch
Normal file
@ -0,0 +1,114 @@
|
||||
From 12b30c920dd15287a7b295475ce1cc4a6cb1f43f Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Tue, 8 Dec 2020 15:48:38 -0500
|
||||
Subject: [PATCH] Fix: scheduler: Don't output a resource header with no list.
|
||||
|
||||
If there's no resources to print, don't output just the header with
|
||||
nothing under it. This potentially comes up if there are only inactive
|
||||
resources, but inactive_resources is FALSE.
|
||||
---
|
||||
lib/pengine/pe_output.c | 48 ++++++++++++++++++++++++++++++++++++------------
|
||||
1 file changed, 36 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
|
||||
index 5562eb6..f1a6b43 100644
|
||||
--- a/lib/pengine/pe_output.c
|
||||
+++ b/lib/pengine/pe_output.c
|
||||
@@ -1761,6 +1761,21 @@ resource_history_xml(pcmk__output_t *out, va_list args) {
|
||||
return pcmk_rc_ok;
|
||||
}
|
||||
|
||||
+static void
|
||||
+print_resource_header(pcmk__output_t *out, gboolean group_by_node,
|
||||
+ gboolean inactive_resources)
|
||||
+{
|
||||
+ if (group_by_node) {
|
||||
+ /* Active resources have already been printed by node */
|
||||
+ out->begin_list(out, NULL, NULL, "Inactive Resources");
|
||||
+ } else if (inactive_resources) {
|
||||
+ out->begin_list(out, NULL, NULL, "Full List of Resources");
|
||||
+ } else {
|
||||
+ out->begin_list(out, NULL, NULL, "Active Resources");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
PCMK__OUTPUT_ARGS("resource-list", "pe_working_set_t *", "unsigned int", "gboolean",
|
||||
"gboolean", "gboolean", "gboolean", "GList *", "GList *", "gboolean")
|
||||
static int
|
||||
@@ -1778,6 +1793,7 @@ resource_list(pcmk__output_t *out, va_list args)
|
||||
|
||||
GList *rsc_iter;
|
||||
int rc = pcmk_rc_no_output;
|
||||
+ bool printed_header = false;
|
||||
|
||||
/* If we already showed active resources by node, and
|
||||
* we're not showing inactive resources, we have nothing to do
|
||||
@@ -1786,22 +1802,15 @@ resource_list(pcmk__output_t *out, va_list args)
|
||||
return rc;
|
||||
}
|
||||
|
||||
- PCMK__OUTPUT_SPACER_IF(out, print_spacer);
|
||||
-
|
||||
- if (group_by_node) {
|
||||
- /* Active resources have already been printed by node */
|
||||
- out->begin_list(out, NULL, NULL, "Inactive Resources");
|
||||
- } else if (inactive_resources) {
|
||||
- out->begin_list(out, NULL, NULL, "Full List of Resources");
|
||||
- } else {
|
||||
- out->begin_list(out, NULL, NULL, "Active Resources");
|
||||
- }
|
||||
-
|
||||
/* If we haven't already printed resources grouped by node,
|
||||
* and brief output was requested, print resource summary */
|
||||
if (brief_output && !group_by_node) {
|
||||
GList *rscs = pe__filter_rsc_list(data_set->resources, only_rsc);
|
||||
|
||||
+ PCMK__OUTPUT_SPACER_IF(out, print_spacer);
|
||||
+ print_resource_header(out, group_by_node, inactive_resources);
|
||||
+ printed_header = true;
|
||||
+
|
||||
pe__rscs_brief_output(out, rscs, print_opts, inactive_resources);
|
||||
g_list_free(rscs);
|
||||
}
|
||||
@@ -1839,6 +1848,12 @@ resource_list(pcmk__output_t *out, va_list args)
|
||||
continue;
|
||||
}
|
||||
|
||||
+ if (!printed_header) {
|
||||
+ PCMK__OUTPUT_SPACER_IF(out, print_spacer);
|
||||
+ print_resource_header(out, group_by_node, inactive_resources);
|
||||
+ printed_header = true;
|
||||
+ }
|
||||
+
|
||||
/* Print this resource */
|
||||
x = out->message(out, crm_map_element_name(rsc->xml), print_opts, rsc,
|
||||
only_node, only_rsc);
|
||||
@@ -1848,6 +1863,12 @@ resource_list(pcmk__output_t *out, va_list args)
|
||||
}
|
||||
|
||||
if (print_summary && rc != pcmk_rc_ok) {
|
||||
+ if (!printed_header) {
|
||||
+ PCMK__OUTPUT_SPACER_IF(out, print_spacer);
|
||||
+ print_resource_header(out, group_by_node, inactive_resources);
|
||||
+ printed_header = true;
|
||||
+ }
|
||||
+
|
||||
if (group_by_node) {
|
||||
out->list_item(out, NULL, "No inactive resources");
|
||||
} else if (inactive_resources) {
|
||||
@@ -1857,7 +1878,10 @@ resource_list(pcmk__output_t *out, va_list args)
|
||||
}
|
||||
}
|
||||
|
||||
- out->end_list(out);
|
||||
+ if (printed_header) {
|
||||
+ out->end_list(out);
|
||||
+ }
|
||||
+
|
||||
return rc;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
5133
SOURCES/016-feature-set.patch
Normal file
5133
SOURCES/016-feature-set.patch
Normal file
File diff suppressed because it is too large
Load Diff
26
SOURCES/017-feature-set.patch
Normal file
26
SOURCES/017-feature-set.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From a66f63e1001c2c93e286978c0383b4256abfce6b Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 4 Jan 2021 16:46:52 -0500
|
||||
Subject: [PATCH] Test: cts: Distribute the new constraints.xml file.
|
||||
|
||||
---
|
||||
cts/Makefile.am | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cts/Makefile.am b/cts/Makefile.am
|
||||
index 6abb42f..5666a9f 100644
|
||||
--- a/cts/Makefile.am
|
||||
+++ b/cts/Makefile.am
|
||||
@@ -60,7 +60,8 @@ cts_SCRIPTS = CTSlab.py \
|
||||
pacemaker-cts-dummyd
|
||||
|
||||
clidir = $(testdir)/cli
|
||||
-dist_cli_DATA = cli/crm_diff_new.xml \
|
||||
+dist_cli_DATA = cli/constraints.xml \
|
||||
+ cli/crm_diff_new.xml \
|
||||
cli/crm_diff_old.xml \
|
||||
cli/crm_mon.xml \
|
||||
cli/crm_mon-partial.xml \
|
||||
--
|
||||
1.8.3.1
|
||||
|
47
SOURCES/018-rhbz1907726.patch
Normal file
47
SOURCES/018-rhbz1907726.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From c3e2edb78e6d0b6ffc8acbe8fc7caef058b35d76 Mon Sep 17 00:00:00 2001
|
||||
From: Reid Wahl <nrwahl@protonmail.com>
|
||||
Date: Tue, 22 Dec 2020 22:28:46 -0800
|
||||
Subject: [PATCH] Fix: liblrmd: Limit node name addition to proxied attrd
|
||||
update commands
|
||||
|
||||
remote_proxy_cb() currently adds the remote node's name as
|
||||
PCMK__XA_ATTR_NODE_NAME if that attribute is not explicitly set. This is
|
||||
necessary for attrd update commands. For those, lack of an explicit node
|
||||
name means to use the local node. Since requests are proxied to full
|
||||
nodes, the node hosting the remote resource would be incorrectly treated
|
||||
as the "local node", causing the attribute to be updated for the wrong
|
||||
node.
|
||||
|
||||
However, for other commands, this is not the case. Lack of an explicit
|
||||
node name can mean "all nodes" (as for CLEAR_FAILURE and QUERY), or a
|
||||
node name may be ignored (as for REFRESH). In these cases (the
|
||||
non-update commands), we don't want to add a node name automatically if
|
||||
it's not explicitly set.
|
||||
|
||||
Resolves: RHBZ#1907726
|
||||
|
||||
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
||||
---
|
||||
lib/lrmd/proxy_common.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/lrmd/proxy_common.c b/lib/lrmd/proxy_common.c
|
||||
index b8d889e..0f1e76a 100644
|
||||
--- a/lib/lrmd/proxy_common.c
|
||||
+++ b/lib/lrmd/proxy_common.c
|
||||
@@ -259,7 +259,11 @@ remote_proxy_cb(lrmd_t *lrmd, const char *node_name, xmlNode *msg)
|
||||
|
||||
if (pcmk__str_eq(type, T_ATTRD, pcmk__str_casei)
|
||||
&& crm_element_value(request,
|
||||
- PCMK__XA_ATTR_NODE_NAME) == NULL) {
|
||||
+ PCMK__XA_ATTR_NODE_NAME) == NULL
|
||||
+ && pcmk__str_any_of(crm_element_value(request, PCMK__XA_TASK),
|
||||
+ PCMK__ATTRD_CMD_UPDATE,
|
||||
+ PCMK__ATTRD_CMD_UPDATE_BOTH,
|
||||
+ PCMK__ATTRD_CMD_UPDATE_DELAY, NULL)) {
|
||||
crm_xml_add(request, PCMK__XA_ATTR_NODE_NAME, proxy->node_name);
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
1174
SOURCES/019-rhbz1371576.patch
Normal file
1174
SOURCES/019-rhbz1371576.patch
Normal file
File diff suppressed because it is too large
Load Diff
1529
SOURCES/020-rhbz1872376.patch
Normal file
1529
SOURCES/020-rhbz1872376.patch
Normal file
File diff suppressed because it is too large
Load Diff
2082
SOURCES/021-rhbz1872376.patch
Normal file
2082
SOURCES/021-rhbz1872376.patch
Normal file
File diff suppressed because it is too large
Load Diff
1452
SOURCES/022-rhbz1872376.patch
Normal file
1452
SOURCES/022-rhbz1872376.patch
Normal file
File diff suppressed because it is too large
Load Diff
26
SOURCES/023-rhbz1872376.patch
Normal file
26
SOURCES/023-rhbz1872376.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From b1241e5026a4fd9a8674ad4b867c7efa3d8ef466 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Tue, 12 Jan 2021 09:03:03 -0600
|
||||
Subject: [PATCH] Feature: tools: bump feature set for crm_resource --digests
|
||||
|
||||
... so script and tools can check for support
|
||||
---
|
||||
include/crm/crm.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/crm/crm.h b/include/crm/crm.h
|
||||
index b07152c..4bbf46a 100644
|
||||
--- a/include/crm/crm.h
|
||||
+++ b/include/crm/crm.h
|
||||
@@ -51,7 +51,7 @@ extern "C" {
|
||||
* >=3.0.13: Fail counts include operation name and interval
|
||||
* >=3.2.0: DC supports PCMK_LRM_OP_INVALID and PCMK_LRM_OP_NOT_CONNECTED
|
||||
*/
|
||||
-# define CRM_FEATURE_SET "3.6.3"
|
||||
+# define CRM_FEATURE_SET "3.6.4"
|
||||
|
||||
# define EOS '\0'
|
||||
# define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) )
|
||||
--
|
||||
1.8.3.1
|
||||
|
4354
SOURCES/024-rhbz1371576.patch
Normal file
4354
SOURCES/024-rhbz1371576.patch
Normal file
File diff suppressed because it is too large
Load Diff
505
SOURCES/025-feature-set.patch
Normal file
505
SOURCES/025-feature-set.patch
Normal file
@ -0,0 +1,505 @@
|
||||
From cf0eebd913855f9ceda2864cbcd9cbd647fca055 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Wed, 13 Jan 2021 12:10:07 -0600
|
||||
Subject: [PATCH] Build: xml: rename crm_resource API file
|
||||
|
||||
5aadeaf added an API schema 2.5 for crm_resource, but API schema 2.5 was
|
||||
released with 2.0.5, so rename it to 2.6 to indicate it is a later change.
|
||||
---
|
||||
xml/api/crm_resource-2.5.rng | 238 -------------------------------------------
|
||||
xml/api/crm_resource-2.6.rng | 238 +++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 238 insertions(+), 238 deletions(-)
|
||||
delete mode 100644 xml/api/crm_resource-2.5.rng
|
||||
create mode 100644 xml/api/crm_resource-2.6.rng
|
||||
|
||||
diff --git a/xml/api/crm_resource-2.5.rng b/xml/api/crm_resource-2.5.rng
|
||||
deleted file mode 100644
|
||||
index b49e24c..0000000
|
||||
--- a/xml/api/crm_resource-2.5.rng
|
||||
+++ /dev/null
|
||||
@@ -1,238 +0,0 @@
|
||||
-<?xml version="1.0" encoding="UTF-8"?>
|
||||
-<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
-
|
||||
- <start>
|
||||
- <ref name="element-crm-resource"/>
|
||||
- </start>
|
||||
-
|
||||
- <define name="element-crm-resource">
|
||||
- <choice>
|
||||
- <ref name="agents-list" />
|
||||
- <ref name="alternatives-list" />
|
||||
- <ref name="constraints-list" />
|
||||
- <externalRef href="generic-list-2.4.rng"/>
|
||||
- <element name="metadata"> <text/> </element>
|
||||
- <ref name="locate-list" />
|
||||
- <ref name="operations-list" />
|
||||
- <ref name="providers-list" />
|
||||
- <ref name="reasons-list" />
|
||||
- <ref name="resource-check" />
|
||||
- <ref name="resource-config" />
|
||||
- <ref name="resources-list" />
|
||||
- </choice>
|
||||
- </define>
|
||||
-
|
||||
- <define name="agents-list">
|
||||
- <element name="agents">
|
||||
- <attribute name="standard"> <text/> </attribute>
|
||||
- <optional>
|
||||
- <attribute name="provider"> <text/> </attribute>
|
||||
- </optional>
|
||||
- <zeroOrMore>
|
||||
- <element name="agent"> <text/> </element>
|
||||
- </zeroOrMore>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="alternatives-list">
|
||||
- <element name="providers">
|
||||
- <attribute name="for"> <text/> </attribute>
|
||||
- <zeroOrMore>
|
||||
- <element name="provider"> <text/> </element>
|
||||
- </zeroOrMore>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="constraints-list">
|
||||
- <element name="constraints">
|
||||
- <interleave>
|
||||
- <zeroOrMore>
|
||||
- <ref name="rsc-location" />
|
||||
- </zeroOrMore>
|
||||
- <zeroOrMore>
|
||||
- <ref name="rsc-colocation" />
|
||||
- </zeroOrMore>
|
||||
- </interleave>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="locate-list">
|
||||
- <element name="nodes">
|
||||
- <attribute name="resource"> <text/> </attribute>
|
||||
- <zeroOrMore>
|
||||
- <element name="node">
|
||||
- <optional>
|
||||
- <attribute name="state"><value>promoted</value></attribute>
|
||||
- </optional>
|
||||
- <text/>
|
||||
- </element>
|
||||
- </zeroOrMore>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="rsc-location">
|
||||
- <element name="rsc_location">
|
||||
- <attribute name="node"> <text/> </attribute>
|
||||
- <attribute name="rsc"> <text/> </attribute>
|
||||
- <attribute name="id"> <text/> </attribute>
|
||||
- <externalRef href="../score.rng"/>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="operations-list">
|
||||
- <element name="operations">
|
||||
- <oneOrMore>
|
||||
- <ref name="element-operation-list" />
|
||||
- </oneOrMore>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="providers-list">
|
||||
- <element name="providers">
|
||||
- <attribute name="standard"> <value>ocf</value> </attribute>
|
||||
- <optional>
|
||||
- <attribute name="agent"> <text/> </attribute>
|
||||
- </optional>
|
||||
- <zeroOrMore>
|
||||
- <element name="provider"> <text/> </element>
|
||||
- </zeroOrMore>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="reasons-list">
|
||||
- <choice>
|
||||
- <ref name="no-resource-or-uname"/>
|
||||
- <ref name="resource-and-uname"/>
|
||||
- <ref name="no-resource-but-uname"/>
|
||||
- <ref name="resource-but-no-uname"/>
|
||||
- </choice>
|
||||
- </define>
|
||||
-
|
||||
- <define name="no-resource-or-uname">
|
||||
- <element name="reason">
|
||||
- <element name="resources">
|
||||
- <zeroOrMore>
|
||||
- <element name="resource">
|
||||
- <attribute name="id"> <text/> </attribute>
|
||||
- <attribute name="running"> <data type="boolean"/> </attribute>
|
||||
- <ref name="resource-check"/>
|
||||
- </element>
|
||||
- </zeroOrMore>
|
||||
- </element>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="resource-and-uname">
|
||||
- <element name="reason">
|
||||
- <attribute name="running_on"> <text/> </attribute>
|
||||
- <ref name="resource-check"/>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="no-resource-but-uname">
|
||||
- <element name="reason">
|
||||
- <element name="resources">
|
||||
- <zeroOrMore>
|
||||
- <element name="resource">
|
||||
- <attribute name="id"> <text/> </attribute>
|
||||
- <attribute name="running"> <data type="boolean"/> </attribute>
|
||||
- <attribute name="host"> <text/> </attribute>
|
||||
- <ref name="resource-check"/>
|
||||
- </element>
|
||||
- </zeroOrMore>
|
||||
- </element>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="resource-but-no-uname">
|
||||
- <element name="reason">
|
||||
- <attribute name="running"> <data type="boolean"/> </attribute>
|
||||
- <ref name="resource-check"/>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="resource-config">
|
||||
- <element name="resource_config">
|
||||
- <externalRef href="resources-2.4.rng" />
|
||||
- <element name="xml"> <text/> </element>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="resource-check">
|
||||
- <element name="check">
|
||||
- <attribute name="id"> <text/> </attribute>
|
||||
- <optional>
|
||||
- <choice>
|
||||
- <attribute name="remain_stopped"><value>true</value></attribute>
|
||||
- <attribute name="promotable"><value>false</value></attribute>
|
||||
- </choice>
|
||||
- </optional>
|
||||
- <optional>
|
||||
- <attribute name="unmanaged"><value>true</value></attribute>
|
||||
- </optional>
|
||||
- <optional>
|
||||
- <attribute name="locked-to"> <text/> </attribute>
|
||||
- </optional>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="resources-list">
|
||||
- <element name="resources">
|
||||
- <zeroOrMore>
|
||||
- <externalRef href="resources-2.4.rng" />
|
||||
- </zeroOrMore>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="rsc-colocation">
|
||||
- <element name="rsc_colocation">
|
||||
- <attribute name="id"> <text/> </attribute>
|
||||
- <attribute name="rsc"> <text/> </attribute>
|
||||
- <attribute name="with-rsc"> <text/> </attribute>
|
||||
- <externalRef href="../score.rng"/>
|
||||
- <optional>
|
||||
- <attribute name="node-attribute"> <text/> </attribute>
|
||||
- </optional>
|
||||
- <optional>
|
||||
- <attribute name="rsc-role">
|
||||
- <ref name="attribute-roles"/>
|
||||
- </attribute>
|
||||
- </optional>
|
||||
- <optional>
|
||||
- <attribute name="with-rsc-role">
|
||||
- <ref name="attribute-roles"/>
|
||||
- </attribute>
|
||||
- </optional>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="element-operation-list">
|
||||
- <element name="operation">
|
||||
- <optional>
|
||||
- <group>
|
||||
- <attribute name="rsc"> <text/> </attribute>
|
||||
- <attribute name="agent"> <text/> </attribute>
|
||||
- </group>
|
||||
- </optional>
|
||||
- <attribute name="op"> <text/> </attribute>
|
||||
- <attribute name="node"> <text/> </attribute>
|
||||
- <attribute name="call"> <data type="nonNegativeInteger" /> </attribute>
|
||||
- <attribute name="rc"> <data type="nonNegativeInteger" /> </attribute>
|
||||
- <optional>
|
||||
- <attribute name="last-rc-change"> <text/> </attribute>
|
||||
- <attribute name="exec-time"> <data type="nonNegativeInteger" /> </attribute>
|
||||
- </optional>
|
||||
- <attribute name="status"> <text/> </attribute>
|
||||
- </element>
|
||||
- </define>
|
||||
-
|
||||
- <define name="attribute-roles">
|
||||
- <choice>
|
||||
- <value>Stopped</value>
|
||||
- <value>Started</value>
|
||||
- <value>Master</value>
|
||||
- <value>Slave</value>
|
||||
- </choice>
|
||||
- </define>
|
||||
-</grammar>
|
||||
diff --git a/xml/api/crm_resource-2.6.rng b/xml/api/crm_resource-2.6.rng
|
||||
new file mode 100644
|
||||
index 0000000..b49e24c
|
||||
--- /dev/null
|
||||
+++ b/xml/api/crm_resource-2.6.rng
|
||||
@@ -0,0 +1,238 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
+
|
||||
+ <start>
|
||||
+ <ref name="element-crm-resource"/>
|
||||
+ </start>
|
||||
+
|
||||
+ <define name="element-crm-resource">
|
||||
+ <choice>
|
||||
+ <ref name="agents-list" />
|
||||
+ <ref name="alternatives-list" />
|
||||
+ <ref name="constraints-list" />
|
||||
+ <externalRef href="generic-list-2.4.rng"/>
|
||||
+ <element name="metadata"> <text/> </element>
|
||||
+ <ref name="locate-list" />
|
||||
+ <ref name="operations-list" />
|
||||
+ <ref name="providers-list" />
|
||||
+ <ref name="reasons-list" />
|
||||
+ <ref name="resource-check" />
|
||||
+ <ref name="resource-config" />
|
||||
+ <ref name="resources-list" />
|
||||
+ </choice>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="agents-list">
|
||||
+ <element name="agents">
|
||||
+ <attribute name="standard"> <text/> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="provider"> <text/> </attribute>
|
||||
+ </optional>
|
||||
+ <zeroOrMore>
|
||||
+ <element name="agent"> <text/> </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="alternatives-list">
|
||||
+ <element name="providers">
|
||||
+ <attribute name="for"> <text/> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <element name="provider"> <text/> </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="constraints-list">
|
||||
+ <element name="constraints">
|
||||
+ <interleave>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="rsc-location" />
|
||||
+ </zeroOrMore>
|
||||
+ <zeroOrMore>
|
||||
+ <ref name="rsc-colocation" />
|
||||
+ </zeroOrMore>
|
||||
+ </interleave>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="locate-list">
|
||||
+ <element name="nodes">
|
||||
+ <attribute name="resource"> <text/> </attribute>
|
||||
+ <zeroOrMore>
|
||||
+ <element name="node">
|
||||
+ <optional>
|
||||
+ <attribute name="state"><value>promoted</value></attribute>
|
||||
+ </optional>
|
||||
+ <text/>
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="rsc-location">
|
||||
+ <element name="rsc_location">
|
||||
+ <attribute name="node"> <text/> </attribute>
|
||||
+ <attribute name="rsc"> <text/> </attribute>
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <externalRef href="../score.rng"/>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="operations-list">
|
||||
+ <element name="operations">
|
||||
+ <oneOrMore>
|
||||
+ <ref name="element-operation-list" />
|
||||
+ </oneOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="providers-list">
|
||||
+ <element name="providers">
|
||||
+ <attribute name="standard"> <value>ocf</value> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="agent"> <text/> </attribute>
|
||||
+ </optional>
|
||||
+ <zeroOrMore>
|
||||
+ <element name="provider"> <text/> </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="reasons-list">
|
||||
+ <choice>
|
||||
+ <ref name="no-resource-or-uname"/>
|
||||
+ <ref name="resource-and-uname"/>
|
||||
+ <ref name="no-resource-but-uname"/>
|
||||
+ <ref name="resource-but-no-uname"/>
|
||||
+ </choice>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="no-resource-or-uname">
|
||||
+ <element name="reason">
|
||||
+ <element name="resources">
|
||||
+ <zeroOrMore>
|
||||
+ <element name="resource">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="running"> <data type="boolean"/> </attribute>
|
||||
+ <ref name="resource-check"/>
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resource-and-uname">
|
||||
+ <element name="reason">
|
||||
+ <attribute name="running_on"> <text/> </attribute>
|
||||
+ <ref name="resource-check"/>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="no-resource-but-uname">
|
||||
+ <element name="reason">
|
||||
+ <element name="resources">
|
||||
+ <zeroOrMore>
|
||||
+ <element name="resource">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="running"> <data type="boolean"/> </attribute>
|
||||
+ <attribute name="host"> <text/> </attribute>
|
||||
+ <ref name="resource-check"/>
|
||||
+ </element>
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resource-but-no-uname">
|
||||
+ <element name="reason">
|
||||
+ <attribute name="running"> <data type="boolean"/> </attribute>
|
||||
+ <ref name="resource-check"/>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resource-config">
|
||||
+ <element name="resource_config">
|
||||
+ <externalRef href="resources-2.4.rng" />
|
||||
+ <element name="xml"> <text/> </element>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resource-check">
|
||||
+ <element name="check">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <optional>
|
||||
+ <choice>
|
||||
+ <attribute name="remain_stopped"><value>true</value></attribute>
|
||||
+ <attribute name="promotable"><value>false</value></attribute>
|
||||
+ </choice>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="unmanaged"><value>true</value></attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="locked-to"> <text/> </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="resources-list">
|
||||
+ <element name="resources">
|
||||
+ <zeroOrMore>
|
||||
+ <externalRef href="resources-2.4.rng" />
|
||||
+ </zeroOrMore>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="rsc-colocation">
|
||||
+ <element name="rsc_colocation">
|
||||
+ <attribute name="id"> <text/> </attribute>
|
||||
+ <attribute name="rsc"> <text/> </attribute>
|
||||
+ <attribute name="with-rsc"> <text/> </attribute>
|
||||
+ <externalRef href="../score.rng"/>
|
||||
+ <optional>
|
||||
+ <attribute name="node-attribute"> <text/> </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="rsc-role">
|
||||
+ <ref name="attribute-roles"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="with-rsc-role">
|
||||
+ <ref name="attribute-roles"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="element-operation-list">
|
||||
+ <element name="operation">
|
||||
+ <optional>
|
||||
+ <group>
|
||||
+ <attribute name="rsc"> <text/> </attribute>
|
||||
+ <attribute name="agent"> <text/> </attribute>
|
||||
+ </group>
|
||||
+ </optional>
|
||||
+ <attribute name="op"> <text/> </attribute>
|
||||
+ <attribute name="node"> <text/> </attribute>
|
||||
+ <attribute name="call"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <attribute name="rc"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="last-rc-change"> <text/> </attribute>
|
||||
+ <attribute name="exec-time"> <data type="nonNegativeInteger" /> </attribute>
|
||||
+ </optional>
|
||||
+ <attribute name="status"> <text/> </attribute>
|
||||
+ </element>
|
||||
+ </define>
|
||||
+
|
||||
+ <define name="attribute-roles">
|
||||
+ <choice>
|
||||
+ <value>Stopped</value>
|
||||
+ <value>Started</value>
|
||||
+ <value>Master</value>
|
||||
+ <value>Slave</value>
|
||||
+ </choice>
|
||||
+ </define>
|
||||
+</grammar>
|
||||
--
|
||||
1.8.3.1
|
||||
|
26
SOURCES/026-tests.patch
Normal file
26
SOURCES/026-tests.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 610e54caf9a695d3d108c87c735a630f2ea5657f Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Wed, 2 Dec 2020 15:09:35 -0600
|
||||
Subject: [PATCH] Test: cts-fencing: update expected output
|
||||
|
||||
b16b24ed changed the order of some XML attributes
|
||||
---
|
||||
cts/cts-fencing.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cts/cts-fencing.in b/cts/cts-fencing.in
|
||||
index c901c6c..224b5d4 100644
|
||||
--- a/cts/cts-fencing.in
|
||||
+++ b/cts/cts-fencing.in
|
||||
@@ -1102,7 +1102,7 @@ class Tests(object):
|
||||
|
||||
test.add_cmd("stonith_admin", "--output-as=xml -F node3 -t 5 -V")
|
||||
|
||||
- test.add_cmd_check_stdout("stonith_admin", "--output-as=xml -H node3", 'status="success" .* action="off" target="node3"')
|
||||
+ test.add_cmd_check_stdout("stonith_admin", "--output-as=xml -H node3", 'action="off" target="node3" .* status="success"')
|
||||
|
||||
# simple test of dynamic list query
|
||||
for test_type in test_types:
|
||||
--
|
||||
1.8.3.1
|
||||
|
962
SOURCES/027-crm_mon.patch
Normal file
962
SOURCES/027-crm_mon.patch
Normal file
@ -0,0 +1,962 @@
|
||||
From a32b6e14ba51fefbda2d4a699cf1c48dd3a1bb5a Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 7 Jan 2021 11:37:51 -0500
|
||||
Subject: [PATCH 01/10] Fix: tools: Don't pass stonith history to
|
||||
print_simple_status.
|
||||
|
||||
It's not being used.
|
||||
---
|
||||
tools/crm_mon.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 4555516..729f6a1 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2004-2020 the Pacemaker project contributors
|
||||
+ * Copyright 2004-2021 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -1451,14 +1451,13 @@ main(int argc, char **argv)
|
||||
* \brief Print one-line status suitable for use with monitoring software
|
||||
*
|
||||
* \param[in] data_set Working set of CIB state
|
||||
- * \param[in] history List of stonith actions
|
||||
*
|
||||
* \note This function's output (and the return code when the program exits)
|
||||
* should conform to https://www.monitoring-plugins.org/doc/guidelines.html
|
||||
*/
|
||||
static void
|
||||
print_simple_status(pcmk__output_t *out, pe_working_set_t * data_set,
|
||||
- stonith_history_t *history, unsigned int mon_ops)
|
||||
+ unsigned int mon_ops)
|
||||
{
|
||||
GListPtr gIter = NULL;
|
||||
int nodes_online = 0;
|
||||
@@ -2012,7 +2011,7 @@ mon_refresh_display(gpointer user_data)
|
||||
break;
|
||||
|
||||
case mon_output_monitor:
|
||||
- print_simple_status(out, mon_data_set, stonith_history, options.mon_ops);
|
||||
+ print_simple_status(out, mon_data_set, options.mon_ops);
|
||||
if (pcmk_is_set(options.mon_ops, mon_op_has_warnings)) {
|
||||
clean_up(MON_STATUS_WARN);
|
||||
return FALSE;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 8b9c47089c70295bc0529671ba5991c6d831e14b Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 7 Jan 2021 13:17:04 -0500
|
||||
Subject: [PATCH 02/10] Refactor: tools: Don't pass output_format to
|
||||
mon_refresh_display.
|
||||
|
||||
output_format is a global variable.
|
||||
---
|
||||
tools/crm_mon.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 729f6a1..b801560 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -827,7 +827,7 @@ cib_connect(gboolean full)
|
||||
|
||||
rc = cib->cmds->query(cib, NULL, ¤t_cib, cib_scope_local | cib_sync_call);
|
||||
if (rc == pcmk_ok) {
|
||||
- mon_refresh_display(&output_format);
|
||||
+ mon_refresh_display(NULL);
|
||||
}
|
||||
|
||||
if (rc == pcmk_ok && full) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From a1b14ad96f12746167da8588dc086b20e6f6d1d6 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 7 Jan 2021 13:20:14 -0500
|
||||
Subject: [PATCH 03/10] Refactor: tools: Remove unnecessary checks for cib !=
|
||||
NULL.
|
||||
|
||||
cib is guaranteed to not be NULL at these points, so there's no need to
|
||||
do an additional check. This code was leftover from a previous
|
||||
reorganization that changed when the cib variable gets initialized.
|
||||
---
|
||||
tools/crm_mon.c | 41 +++++++++++++++++++----------------------
|
||||
1 file changed, 19 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index b801560..1eedd38 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -1346,7 +1346,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Extra sanity checks when in CGI mode */
|
||||
if (output_format == mon_output_cgi) {
|
||||
- if (cib && cib->variant == cib_file) {
|
||||
+ if (cib->variant == cib_file) {
|
||||
g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_USAGE, "CGI mode used with CIB file");
|
||||
return clean_up(CRM_EX_USAGE);
|
||||
} else if (options.external_agent != NULL) {
|
||||
@@ -1370,33 +1370,30 @@ main(int argc, char **argv)
|
||||
|
||||
crm_info("Starting %s", crm_system_name);
|
||||
|
||||
- if (cib) {
|
||||
-
|
||||
- do {
|
||||
- if (!pcmk_is_set(options.mon_ops, mon_op_one_shot)) {
|
||||
- print_as(output_format ,"Waiting until cluster is available on this node ...\n");
|
||||
- }
|
||||
- rc = cib_connect(!pcmk_is_set(options.mon_ops, mon_op_one_shot));
|
||||
+ do {
|
||||
+ if (!pcmk_is_set(options.mon_ops, mon_op_one_shot)) {
|
||||
+ print_as(output_format ,"Waiting until cluster is available on this node ...\n");
|
||||
+ }
|
||||
+ rc = cib_connect(!pcmk_is_set(options.mon_ops, mon_op_one_shot));
|
||||
|
||||
- if (pcmk_is_set(options.mon_ops, mon_op_one_shot)) {
|
||||
- break;
|
||||
+ if (pcmk_is_set(options.mon_ops, mon_op_one_shot)) {
|
||||
+ break;
|
||||
|
||||
- } else if (rc != pcmk_ok) {
|
||||
- sleep(options.reconnect_msec / 1000);
|
||||
+ } else if (rc != pcmk_ok) {
|
||||
+ sleep(options.reconnect_msec / 1000);
|
||||
#if CURSES_ENABLED
|
||||
- if (output_format == mon_output_console) {
|
||||
- clear();
|
||||
- refresh();
|
||||
- }
|
||||
+ if (output_format == mon_output_console) {
|
||||
+ clear();
|
||||
+ refresh();
|
||||
+ }
|
||||
#endif
|
||||
- } else {
|
||||
- if (output_format == mon_output_html && out->dest != stdout) {
|
||||
- printf("Writing html to %s ...\n", args->output_dest);
|
||||
- }
|
||||
+ } else {
|
||||
+ if (output_format == mon_output_html && out->dest != stdout) {
|
||||
+ printf("Writing html to %s ...\n", args->output_dest);
|
||||
}
|
||||
+ }
|
||||
|
||||
- } while (rc == -ENOTCONN);
|
||||
- }
|
||||
+ } while (rc == -ENOTCONN);
|
||||
|
||||
if (rc != pcmk_ok) {
|
||||
if (output_format == mon_output_monitor) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From fe5284a12765e775905bdfe58711c5733a063132 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 7 Jan 2021 14:15:40 -0500
|
||||
Subject: [PATCH 04/10] Fix: tools: mon_refresh_display should return an int.
|
||||
|
||||
While GSourceFunc is defined as returning a boolean, our public API
|
||||
mainloop function expect the dispatch function to return an int. So
|
||||
change mon_refresh_display to do so.
|
||||
---
|
||||
tools/crm_mon.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 1eedd38..8657a89 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -125,7 +125,7 @@ struct {
|
||||
static void clean_up_connections(void);
|
||||
static crm_exit_t clean_up(crm_exit_t exit_code);
|
||||
static void crm_diff_update(const char *event, xmlNode * msg);
|
||||
-static gboolean mon_refresh_display(gpointer user_data);
|
||||
+static int mon_refresh_display(gpointer user_data);
|
||||
static int cib_connect(gboolean full);
|
||||
static void mon_st_callback_event(stonith_t * st, stonith_event_t * e);
|
||||
static void mon_st_callback_display(stonith_t * st, stonith_event_t * e);
|
||||
@@ -1925,7 +1925,7 @@ crm_diff_update(const char *event, xmlNode * msg)
|
||||
kick_refresh(cib_updated);
|
||||
}
|
||||
|
||||
-static gboolean
|
||||
+static int
|
||||
mon_refresh_display(gpointer user_data)
|
||||
{
|
||||
xmlNode *cib_copy = copy_xml(current_cib);
|
||||
@@ -1940,7 +1940,7 @@ mon_refresh_display(gpointer user_data)
|
||||
}
|
||||
out->err(out, "Upgrade failed: %s", pcmk_strerror(-pcmk_err_schema_validation));
|
||||
clean_up(CRM_EX_CONFIG);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* get the stonith-history if there is evidence we need it
|
||||
@@ -1966,7 +1966,7 @@ mon_refresh_display(gpointer user_data)
|
||||
}
|
||||
free_xml(cib_copy);
|
||||
out->err(out, "Reading stonith-history failed");
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
if (mon_data_set == NULL) {
|
||||
@@ -1995,7 +1995,7 @@ mon_refresh_display(gpointer user_data)
|
||||
options.only_node, options.only_rsc) != 0) {
|
||||
g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_CANTCREAT, "Critical: Unable to output html file");
|
||||
clean_up(CRM_EX_CANTCREAT);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2044,7 +2044,7 @@ mon_refresh_display(gpointer user_data)
|
||||
stonith_history_free(stonith_history);
|
||||
stonith_history = NULL;
|
||||
pe_reset_working_set(mon_data_set);
|
||||
- return TRUE;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 7f88a5a428ed73fb5161096ece2517abe1119f06 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 7 Jan 2021 16:59:02 -0500
|
||||
Subject: [PATCH 05/10] Refactor: tools: Change a conditional in cib_connect.
|
||||
|
||||
This allows unindenting everything that occurs inside that conditional,
|
||||
which I think makes it a little bit easier to understand what is going
|
||||
on.
|
||||
---
|
||||
tools/crm_mon.c | 86 +++++++++++++++++++++++++++++----------------------------
|
||||
1 file changed, 44 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 8657a89..b8ba56b 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -804,55 +804,57 @@ cib_connect(gboolean full)
|
||||
}
|
||||
}
|
||||
|
||||
- if (cib->state != cib_connected_query && cib->state != cib_connected_command) {
|
||||
- crm_trace("Connecting to the CIB");
|
||||
-
|
||||
- /* Hack: the CIB signon will print the prompt for a password if needed,
|
||||
- * but to stderr. If we're in curses, show it on the screen instead.
|
||||
- *
|
||||
- * @TODO Add a password prompt (maybe including input) function to
|
||||
- * pcmk__output_t and use it in libcib.
|
||||
- */
|
||||
- if ((output_format == mon_output_console) && need_pass && (cib->variant == cib_remote)) {
|
||||
- need_pass = FALSE;
|
||||
- print_as(output_format, "Password:");
|
||||
- }
|
||||
+ if (cib->state == cib_connected_query || cib->state == cib_connected_command) {
|
||||
+ return rc;
|
||||
+ }
|
||||
|
||||
- rc = cib->cmds->signon(cib, crm_system_name, cib_query);
|
||||
- if (rc != pcmk_ok) {
|
||||
- out->err(out, "Could not connect to the CIB: %s",
|
||||
- pcmk_strerror(rc));
|
||||
- return rc;
|
||||
- }
|
||||
+ crm_trace("Connecting to the CIB");
|
||||
|
||||
- rc = cib->cmds->query(cib, NULL, ¤t_cib, cib_scope_local | cib_sync_call);
|
||||
- if (rc == pcmk_ok) {
|
||||
- mon_refresh_display(NULL);
|
||||
- }
|
||||
+ /* Hack: the CIB signon will print the prompt for a password if needed,
|
||||
+ * but to stderr. If we're in curses, show it on the screen instead.
|
||||
+ *
|
||||
+ * @TODO Add a password prompt (maybe including input) function to
|
||||
+ * pcmk__output_t and use it in libcib.
|
||||
+ */
|
||||
+ if ((output_format == mon_output_console) && need_pass && (cib->variant == cib_remote)) {
|
||||
+ need_pass = FALSE;
|
||||
+ print_as(output_format, "Password:");
|
||||
+ }
|
||||
|
||||
- if (rc == pcmk_ok && full) {
|
||||
- if (rc == pcmk_ok) {
|
||||
- rc = cib->cmds->set_connection_dnotify(cib, mon_cib_connection_destroy_regular);
|
||||
- if (rc == -EPROTONOSUPPORT) {
|
||||
- print_as
|
||||
- (output_format, "Notification setup not supported, won't be able to reconnect after failure");
|
||||
- if (output_format == mon_output_console) {
|
||||
- sleep(2);
|
||||
- }
|
||||
- rc = pcmk_ok;
|
||||
- }
|
||||
+ rc = cib->cmds->signon(cib, crm_system_name, cib_query);
|
||||
+ if (rc != pcmk_ok) {
|
||||
+ out->err(out, "Could not connect to the CIB: %s",
|
||||
+ pcmk_strerror(rc));
|
||||
+ return rc;
|
||||
+ }
|
||||
|
||||
- }
|
||||
+ rc = cib->cmds->query(cib, NULL, ¤t_cib, cib_scope_local | cib_sync_call);
|
||||
+ if (rc == pcmk_ok) {
|
||||
+ mon_refresh_display(NULL);
|
||||
+ }
|
||||
|
||||
- if (rc == pcmk_ok) {
|
||||
- cib->cmds->del_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);
|
||||
- rc = cib->cmds->add_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);
|
||||
+ if (rc == pcmk_ok && full) {
|
||||
+ if (rc == pcmk_ok) {
|
||||
+ rc = cib->cmds->set_connection_dnotify(cib, mon_cib_connection_destroy_regular);
|
||||
+ if (rc == -EPROTONOSUPPORT) {
|
||||
+ print_as
|
||||
+ (output_format, "Notification setup not supported, won't be able to reconnect after failure");
|
||||
+ if (output_format == mon_output_console) {
|
||||
+ sleep(2);
|
||||
+ }
|
||||
+ rc = pcmk_ok;
|
||||
}
|
||||
|
||||
- if (rc != pcmk_ok) {
|
||||
- out->err(out, "Notification setup failed, could not monitor CIB actions");
|
||||
- clean_up_connections();
|
||||
- }
|
||||
+ }
|
||||
+
|
||||
+ if (rc == pcmk_ok) {
|
||||
+ cib->cmds->del_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);
|
||||
+ rc = cib->cmds->add_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);
|
||||
+ }
|
||||
+
|
||||
+ if (rc != pcmk_ok) {
|
||||
+ out->err(out, "Notification setup failed, could not monitor CIB actions");
|
||||
+ clean_up_connections();
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 178ba17e4ee62bef28f8e71cad2c002f823661b5 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Thu, 7 Jan 2021 17:37:36 -0500
|
||||
Subject: [PATCH 06/10] Refactor: tools: Remove an unnecessary conditional in
|
||||
cib_connect.
|
||||
|
||||
---
|
||||
tools/crm_mon.c | 17 +++++++----------
|
||||
1 file changed, 7 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index b8ba56b..36249e8 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -834,17 +834,14 @@ cib_connect(gboolean full)
|
||||
}
|
||||
|
||||
if (rc == pcmk_ok && full) {
|
||||
- if (rc == pcmk_ok) {
|
||||
- rc = cib->cmds->set_connection_dnotify(cib, mon_cib_connection_destroy_regular);
|
||||
- if (rc == -EPROTONOSUPPORT) {
|
||||
- print_as
|
||||
- (output_format, "Notification setup not supported, won't be able to reconnect after failure");
|
||||
- if (output_format == mon_output_console) {
|
||||
- sleep(2);
|
||||
- }
|
||||
- rc = pcmk_ok;
|
||||
+ rc = cib->cmds->set_connection_dnotify(cib, mon_cib_connection_destroy_regular);
|
||||
+ if (rc == -EPROTONOSUPPORT) {
|
||||
+ print_as
|
||||
+ (output_format, "Notification setup not supported, won't be able to reconnect after failure");
|
||||
+ if (output_format == mon_output_console) {
|
||||
+ sleep(2);
|
||||
}
|
||||
-
|
||||
+ rc = pcmk_ok;
|
||||
}
|
||||
|
||||
if (rc == pcmk_ok) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 33bac5886417afc5c7bbf56f4d31e0e36f8ae947 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Fri, 8 Jan 2021 10:00:50 -0500
|
||||
Subject: [PATCH 07/10] Refactor: tools: Simplify another conditional in
|
||||
crm_mon.
|
||||
|
||||
---
|
||||
tools/crm_mon.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 36249e8..8b47bbc 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -1386,10 +1386,8 @@ main(int argc, char **argv)
|
||||
refresh();
|
||||
}
|
||||
#endif
|
||||
- } else {
|
||||
- if (output_format == mon_output_html && out->dest != stdout) {
|
||||
- printf("Writing html to %s ...\n", args->output_dest);
|
||||
- }
|
||||
+ } else if (output_format == mon_output_html && out->dest != stdout) {
|
||||
+ printf("Writing html to %s ...\n", args->output_dest);
|
||||
}
|
||||
|
||||
} while (rc == -ENOTCONN);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 40bc8b3147e7ebef4318211fa69973a8b5d32e79 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Fri, 8 Jan 2021 12:12:37 -0500
|
||||
Subject: [PATCH 08/10] Refactor: libcrmcommon,tools,daemons: Put common xpath
|
||||
code in one place.
|
||||
|
||||
---
|
||||
configure.ac | 1 +
|
||||
daemons/controld/controld_te_callbacks.c | 26 +++-----------
|
||||
include/crm/common/xml_internal.h | 14 +++++++-
|
||||
lib/common/tests/Makefile.am | 2 +-
|
||||
lib/common/tests/xpath/Makefile.am | 29 +++++++++++++++
|
||||
lib/common/tests/xpath/pcmk__xpath_node_id_test.c | 43 +++++++++++++++++++++++
|
||||
lib/common/xpath.c | 34 +++++++++++++++++-
|
||||
tools/crm_mon.c | 25 ++-----------
|
||||
8 files changed, 127 insertions(+), 47 deletions(-)
|
||||
create mode 100644 lib/common/tests/xpath/Makefile.am
|
||||
create mode 100644 lib/common/tests/xpath/pcmk__xpath_node_id_test.c
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 5959116..ce0f1fe 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1920,6 +1920,7 @@ AC_CONFIG_FILES(Makefile \
|
||||
lib/common/tests/operations/Makefile \
|
||||
lib/common/tests/strings/Makefile \
|
||||
lib/common/tests/utils/Makefile \
|
||||
+ lib/common/tests/xpath/Makefile \
|
||||
lib/cluster/Makefile \
|
||||
lib/cib/Makefile \
|
||||
lib/gnu/Makefile \
|
||||
diff --git a/daemons/controld/controld_te_callbacks.c b/daemons/controld/controld_te_callbacks.c
|
||||
index 66fc645..4e3e4e6 100644
|
||||
--- a/daemons/controld/controld_te_callbacks.c
|
||||
+++ b/daemons/controld/controld_te_callbacks.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2004-2020 the Pacemaker project contributors
|
||||
+ * Copyright 2004-2021 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -276,24 +276,6 @@ process_resource_updates(const char *node, xmlNode *xml, xmlNode *change,
|
||||
}
|
||||
}
|
||||
|
||||
-#define NODE_PATT "/lrm[@id="
|
||||
-static char *get_node_from_xpath(const char *xpath)
|
||||
-{
|
||||
- char *nodeid = NULL;
|
||||
- char *tmp = strstr(xpath, NODE_PATT);
|
||||
-
|
||||
- if(tmp) {
|
||||
- tmp += strlen(NODE_PATT);
|
||||
- tmp += 1;
|
||||
-
|
||||
- nodeid = strdup(tmp);
|
||||
- tmp = strstr(nodeid, "\'");
|
||||
- CRM_ASSERT(tmp);
|
||||
- tmp[0] = 0;
|
||||
- }
|
||||
- return nodeid;
|
||||
-}
|
||||
-
|
||||
static char *extract_node_uuid(const char *xpath)
|
||||
{
|
||||
char *mutable_path = strdup(xpath);
|
||||
@@ -522,19 +504,19 @@ te_update_diff_v2(xmlNode *diff)
|
||||
process_resource_updates(ID(match), match, change, op, xpath);
|
||||
|
||||
} else if (strcmp(name, XML_LRM_TAG_RESOURCES) == 0) {
|
||||
- char *local_node = get_node_from_xpath(xpath);
|
||||
+ char *local_node = pcmk__xpath_node_id(xpath, "lrm");
|
||||
|
||||
process_resource_updates(local_node, match, change, op, xpath);
|
||||
free(local_node);
|
||||
|
||||
} else if (strcmp(name, XML_LRM_TAG_RESOURCE) == 0) {
|
||||
- char *local_node = get_node_from_xpath(xpath);
|
||||
+ char *local_node = pcmk__xpath_node_id(xpath, "lrm");
|
||||
|
||||
process_lrm_resource_diff(match, local_node);
|
||||
free(local_node);
|
||||
|
||||
} else if (strcmp(name, XML_LRM_TAG_RSC_OP) == 0) {
|
||||
- char *local_node = get_node_from_xpath(xpath);
|
||||
+ char *local_node = pcmk__xpath_node_id(xpath, "lrm");
|
||||
|
||||
process_graph_event(match, local_node);
|
||||
free(local_node);
|
||||
diff --git a/include/crm/common/xml_internal.h b/include/crm/common/xml_internal.h
|
||||
index 1e80bc6..d8694ee 100644
|
||||
--- a/include/crm/common/xml_internal.h
|
||||
+++ b/include/crm/common/xml_internal.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2017-2020 the Pacemaker project contributors
|
||||
+ * Copyright 2017-2021 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -273,4 +273,16 @@ pcmk__xe_first_attr(const xmlNode *xe)
|
||||
return (xe == NULL)? NULL : xe->properties;
|
||||
}
|
||||
|
||||
+/*!
|
||||
+ * \internal
|
||||
+ * \brief Extract the ID attribute from an XML element
|
||||
+ *
|
||||
+ * \param[in] xpath String to search
|
||||
+ * \param[in] node Node to get the ID for
|
||||
+ *
|
||||
+ * \return ID attribute of \p node in xpath string \p xpath
|
||||
+ */
|
||||
+char *
|
||||
+pcmk__xpath_node_id(const char *xpath, const char *node);
|
||||
+
|
||||
#endif // PCMK__XML_INTERNAL__H
|
||||
diff --git a/lib/common/tests/Makefile.am b/lib/common/tests/Makefile.am
|
||||
index 2c33cc5..4c6e8b4 100644
|
||||
--- a/lib/common/tests/Makefile.am
|
||||
+++ b/lib/common/tests/Makefile.am
|
||||
@@ -1 +1 @@
|
||||
-SUBDIRS = agents cmdline flags operations strings utils
|
||||
+SUBDIRS = agents cmdline flags operations strings utils xpath
|
||||
diff --git a/lib/common/tests/xpath/Makefile.am b/lib/common/tests/xpath/Makefile.am
|
||||
new file mode 100644
|
||||
index 0000000..7a53683
|
||||
--- /dev/null
|
||||
+++ b/lib/common/tests/xpath/Makefile.am
|
||||
@@ -0,0 +1,29 @@
|
||||
+#
|
||||
+# Copyright 2021 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
|
||||
+LDADD = $(top_builddir)/lib/common/libcrmcommon.la
|
||||
+
|
||||
+include $(top_srcdir)/mk/glib-tap.mk
|
||||
+
|
||||
+# Add each test program here. Each test should be written as a little standalone
|
||||
+# program using the glib unit testing functions. See the documentation for more
|
||||
+# information.
|
||||
+#
|
||||
+# https://developer.gnome.org/glib/unstable/glib-Testing.html
|
||||
+#
|
||||
+# Add "_test" to the end of all test program names to simplify .gitignore.
|
||||
+test_programs = pcmk__xpath_node_id_test
|
||||
+
|
||||
+# If any extra data needs to be added to the source distribution, add it to the
|
||||
+# following list.
|
||||
+dist_test_data =
|
||||
+
|
||||
+# If any extra data needs to be used by tests but should not be added to the
|
||||
+# source distribution, add it to the following list.
|
||||
+test_data =
|
||||
diff --git a/lib/common/tests/xpath/pcmk__xpath_node_id_test.c b/lib/common/tests/xpath/pcmk__xpath_node_id_test.c
|
||||
new file mode 100644
|
||||
index 0000000..f6b5c10
|
||||
--- /dev/null
|
||||
+++ b/lib/common/tests/xpath/pcmk__xpath_node_id_test.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+/*
|
||||
+ * Copyright 2021 the Pacemaker project contributors
|
||||
+ *
|
||||
+ * The version control history for this file may have further details.
|
||||
+ *
|
||||
+ * This source code is licensed under the GNU Lesser General Public License
|
||||
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
|
||||
+ */
|
||||
+
|
||||
+#include <crm_internal.h>
|
||||
+#include <crm/common/xml_internal.h>
|
||||
+
|
||||
+static void
|
||||
+empty_input(void) {
|
||||
+ g_assert_null(pcmk__xpath_node_id(NULL, "lrm"));
|
||||
+ g_assert_null(pcmk__xpath_node_id("", "lrm"));
|
||||
+ g_assert_null(pcmk__xpath_node_id("/blah/blah", NULL));
|
||||
+ g_assert_null(pcmk__xpath_node_id("/blah/blah", ""));
|
||||
+ g_assert_null(pcmk__xpath_node_id(NULL, NULL));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+not_present(void) {
|
||||
+ g_assert_null(pcmk__xpath_node_id("/some/xpath/string[@id='xyz']", "lrm"));
|
||||
+ g_assert_null(pcmk__xpath_node_id("/some/xpath/containing[@id='lrm']", "lrm"));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+present(void) {
|
||||
+ g_assert_cmpint(strcmp(pcmk__xpath_node_id("/some/xpath/containing/lrm[@id='xyz']", "lrm"), "xyz"), ==, 0);
|
||||
+ g_assert_cmpint(strcmp(pcmk__xpath_node_id("/some/other/lrm[@id='xyz']/xpath", "lrm"), "xyz"), ==, 0);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(int argc, char **argv)
|
||||
+{
|
||||
+ g_test_init(&argc, &argv, NULL);
|
||||
+
|
||||
+ g_test_add_func("/common/xpath/node_id/empty_input", empty_input);
|
||||
+ g_test_add_func("/common/xpath/node_id/not_present", not_present);
|
||||
+ g_test_add_func("/common/xpath/node_id/present", present);
|
||||
+ return g_test_run();
|
||||
+}
|
||||
diff --git a/lib/common/xpath.c b/lib/common/xpath.c
|
||||
index 6fa4941..7851a7c 100644
|
||||
--- a/lib/common/xpath.c
|
||||
+++ b/lib/common/xpath.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2004-2020 the Pacemaker project contributors
|
||||
+ * Copyright 2004-2021 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <crm/msg_xml.h>
|
||||
+#include <crm/common/xml_internal.h>
|
||||
#include "crmcommon_private.h"
|
||||
|
||||
/*
|
||||
@@ -297,3 +298,34 @@ xml_get_path(xmlNode *xml)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
+
|
||||
+char *
|
||||
+pcmk__xpath_node_id(const char *xpath, const char *node)
|
||||
+{
|
||||
+ char *retval = NULL;
|
||||
+ char *patt = NULL;
|
||||
+ char *start = NULL;
|
||||
+ char *end = NULL;
|
||||
+
|
||||
+ if (node == NULL || xpath == NULL) {
|
||||
+ return retval;
|
||||
+ }
|
||||
+
|
||||
+ patt = crm_strdup_printf("/%s[@id=", node);
|
||||
+ start = strstr(xpath, patt);
|
||||
+
|
||||
+ if (!start) {
|
||||
+ free(patt);
|
||||
+ return retval;
|
||||
+ }
|
||||
+
|
||||
+ start += strlen(patt);
|
||||
+ start++;
|
||||
+
|
||||
+ end = strstr(start, "\'");
|
||||
+ CRM_ASSERT(end);
|
||||
+ retval = strndup(start, end-start);
|
||||
+
|
||||
+ free(patt);
|
||||
+ return retval;
|
||||
+}
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 8b47bbc..ff1b86b 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -1719,25 +1719,6 @@ mon_trigger_refresh(gpointer user_data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
-#define NODE_PATT "/lrm[@id="
|
||||
-static char *
|
||||
-get_node_from_xpath(const char *xpath)
|
||||
-{
|
||||
- char *nodeid = NULL;
|
||||
- char *tmp = strstr(xpath, NODE_PATT);
|
||||
-
|
||||
- if(tmp) {
|
||||
- tmp += strlen(NODE_PATT);
|
||||
- tmp += 1;
|
||||
-
|
||||
- nodeid = strdup(tmp);
|
||||
- tmp = strstr(nodeid, "\'");
|
||||
- CRM_ASSERT(tmp);
|
||||
- tmp[0] = 0;
|
||||
- }
|
||||
- return nodeid;
|
||||
-}
|
||||
-
|
||||
static void
|
||||
crm_diff_update_v2(const char *event, xmlNode * msg)
|
||||
{
|
||||
@@ -1822,19 +1803,19 @@ crm_diff_update_v2(const char *event, xmlNode * msg)
|
||||
handle_rsc_op(match, node);
|
||||
|
||||
} else if(strcmp(name, XML_LRM_TAG_RESOURCES) == 0) {
|
||||
- char *local_node = get_node_from_xpath(xpath);
|
||||
+ char *local_node = pcmk__xpath_node_id(xpath, "lrm");
|
||||
|
||||
handle_rsc_op(match, local_node);
|
||||
free(local_node);
|
||||
|
||||
} else if(strcmp(name, XML_LRM_TAG_RESOURCE) == 0) {
|
||||
- char *local_node = get_node_from_xpath(xpath);
|
||||
+ char *local_node = pcmk__xpath_node_id(xpath, "lrm");
|
||||
|
||||
handle_rsc_op(match, local_node);
|
||||
free(local_node);
|
||||
|
||||
} else if(strcmp(name, XML_LRM_TAG_RSC_OP) == 0) {
|
||||
- char *local_node = get_node_from_xpath(xpath);
|
||||
+ char *local_node = pcmk__xpath_node_id(xpath, "lrm");
|
||||
|
||||
handle_rsc_op(match, local_node);
|
||||
free(local_node);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From b0126373d8b2a739ec5b985a7e1f530e850618d3 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Mon, 11 Jan 2021 10:20:11 -0500
|
||||
Subject: [PATCH 09/10] Refactor: libpacemaker: Move reduce_stonith_history
|
||||
into the library.
|
||||
|
||||
And also rename it to pcmk__reduce_fence_history. I don't see anywhere
|
||||
else that could use this function at the moment, but it seems too
|
||||
generic to keep in crm_mon.
|
||||
---
|
||||
include/pcmki/pcmki_fence.h | 16 +++++++++++++-
|
||||
lib/pacemaker/pcmk_fence.c | 45 ++++++++++++++++++++++++++++++++++++++-
|
||||
tools/crm_mon.c | 52 +--------------------------------------------
|
||||
3 files changed, 60 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/include/pcmki/pcmki_fence.h b/include/pcmki/pcmki_fence.h
|
||||
index 241d030..d4cef68 100644
|
||||
--- a/include/pcmki/pcmki_fence.h
|
||||
+++ b/include/pcmki/pcmki_fence.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2019-2020 the Pacemaker project contributors
|
||||
+ * Copyright 2019-2021 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -219,4 +219,18 @@ int pcmk__fence_validate(pcmk__output_t *out, stonith_t *st, const char *agent,
|
||||
const char *id, stonith_key_value_t *params,
|
||||
unsigned int timeout);
|
||||
|
||||
+/**
|
||||
+ * \brief Reduce the STONITH history
|
||||
+ *
|
||||
+ * STONITH history is reduced as follows:
|
||||
+ * - The last successful action of every action-type and target is kept
|
||||
+ * - For failed actions, who failed is kept
|
||||
+ * - All actions in progress are kept
|
||||
+ *
|
||||
+ * \param[in] history List of STONITH actions
|
||||
+ *
|
||||
+ * \return The reduced history
|
||||
+ */
|
||||
+stonith_history_t *
|
||||
+pcmk__reduce_fence_history(stonith_history_t *history);
|
||||
#endif
|
||||
diff --git a/lib/pacemaker/pcmk_fence.c b/lib/pacemaker/pcmk_fence.c
|
||||
index d591379..34540cc 100644
|
||||
--- a/lib/pacemaker/pcmk_fence.c
|
||||
+++ b/lib/pacemaker/pcmk_fence.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2009-2020 the Pacemaker project contributors
|
||||
+ * Copyright 2009-2021 the Pacemaker project contributors
|
||||
*
|
||||
* The version control history for this file may have further details.
|
||||
*
|
||||
@@ -520,3 +520,46 @@ pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+stonith_history_t *
|
||||
+pcmk__reduce_fence_history(stonith_history_t *history)
|
||||
+{
|
||||
+ stonith_history_t *new, *hp, *np;
|
||||
+
|
||||
+ if (!history) {
|
||||
+ return history;
|
||||
+ }
|
||||
+
|
||||
+ new = history;
|
||||
+ hp = new->next;
|
||||
+ new->next = NULL;
|
||||
+
|
||||
+ while (hp) {
|
||||
+ stonith_history_t *hp_next = hp->next;
|
||||
+
|
||||
+ hp->next = NULL;
|
||||
+
|
||||
+ for (np = new; ; np = np->next) {
|
||||
+ if ((hp->state == st_done) || (hp->state == st_failed)) {
|
||||
+ /* action not in progress */
|
||||
+ if (pcmk__str_eq(hp->target, np->target, pcmk__str_casei) &&
|
||||
+ pcmk__str_eq(hp->action, np->action, pcmk__str_casei) &&
|
||||
+ (hp->state == np->state) &&
|
||||
+ ((hp->state == st_done) ||
|
||||
+ pcmk__str_eq(hp->delegate, np->delegate, pcmk__str_casei))) {
|
||||
+ /* purge older hp */
|
||||
+ stonith_history_free(hp);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!np->next) {
|
||||
+ np->next = hp;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ hp = hp_next;
|
||||
+ }
|
||||
+
|
||||
+ return new;
|
||||
+}
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index ff1b86b..2179f53 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -1520,56 +1520,6 @@ print_simple_status(pcmk__output_t *out, pe_working_set_t * data_set,
|
||||
/* coverity[leaked_storage] False positive */
|
||||
}
|
||||
|
||||
-/*!
|
||||
- * \internal
|
||||
- * \brief Reduce the stonith-history
|
||||
- * for successful actions we keep the last of every action-type & target
|
||||
- * for failed actions we record as well who had failed
|
||||
- * for actions in progress we keep full track
|
||||
- *
|
||||
- * \param[in] history List of stonith actions
|
||||
- *
|
||||
- */
|
||||
-static stonith_history_t *
|
||||
-reduce_stonith_history(stonith_history_t *history)
|
||||
-{
|
||||
- stonith_history_t *new = history, *hp, *np;
|
||||
-
|
||||
- if (new) {
|
||||
- hp = new->next;
|
||||
- new->next = NULL;
|
||||
-
|
||||
- while (hp) {
|
||||
- stonith_history_t *hp_next = hp->next;
|
||||
-
|
||||
- hp->next = NULL;
|
||||
-
|
||||
- for (np = new; ; np = np->next) {
|
||||
- if ((hp->state == st_done) || (hp->state == st_failed)) {
|
||||
- /* action not in progress */
|
||||
- if (pcmk__str_eq(hp->target, np->target, pcmk__str_casei) &&
|
||||
- pcmk__str_eq(hp->action, np->action, pcmk__str_casei) &&
|
||||
- (hp->state == np->state) &&
|
||||
- ((hp->state == st_done) ||
|
||||
- pcmk__str_eq(hp->delegate, np->delegate, pcmk__str_casei))) {
|
||||
- /* purge older hp */
|
||||
- stonith_history_free(hp);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!np->next) {
|
||||
- np->next = hp;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- hp = hp_next;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return new;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
send_custom_trap(const char *node, const char *rsc, const char *task, int target_rc, int rc,
|
||||
int status, const char *desc)
|
||||
@@ -1935,7 +1885,7 @@ mon_refresh_display(gpointer user_data)
|
||||
if (!pcmk_is_set(options.mon_ops, mon_op_fence_full_history)
|
||||
&& (output_format != mon_output_xml)) {
|
||||
|
||||
- stonith_history = reduce_stonith_history(stonith_history);
|
||||
+ stonith_history = pcmk__reduce_fence_history(stonith_history);
|
||||
}
|
||||
break; /* all other cases are errors */
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From af3f1368bc76eb498c2c96b3eda9324b579c9380 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Tue, 12 Jan 2021 15:46:55 -0500
|
||||
Subject: [PATCH 10/10] Low: tools: Adjust fencing shown indicator in crm_mon.
|
||||
|
||||
If any of the various fencing flags are set, but not all of them, no '*'
|
||||
will be shown next to the fencing line in the interactive change screen.
|
||||
This makes it seem like fencing should not be shown, and hitting 'm'
|
||||
should toggle the fencing display on. However, that's not the case and
|
||||
hitting 'm' will actually toggle fencing off. Hitting it again will
|
||||
toggle it on and the '*' will appear.
|
||||
|
||||
This is confusing, so just display the '*' if any fencing flag is set.
|
||||
---
|
||||
tools/crm_mon.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 2179f53..8ec97bb 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -984,7 +984,10 @@ detect_user_input(GIOChannel *channel, GIOCondition condition, gpointer user_dat
|
||||
print_option_help(out, 'R', pcmk_is_set(options.mon_ops, mon_op_print_clone_detail));
|
||||
print_option_help(out, 'b', pcmk_is_set(options.mon_ops, mon_op_print_brief));
|
||||
print_option_help(out, 'j', pcmk_is_set(options.mon_ops, mon_op_print_pending));
|
||||
- print_option_help(out, 'm', pcmk_is_set(show, mon_show_fencing_all));
|
||||
+ print_option_help(out, 'm', pcmk_any_flags_set(show,
|
||||
+ mon_show_fence_failed
|
||||
+ |mon_show_fence_pending
|
||||
+ |mon_show_fence_worked));
|
||||
out->info(out, "%s", "\nToggle fields via field letter, type any other key to return");
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
1305
SOURCES/028-crm_mon.patch
Normal file
1305
SOURCES/028-crm_mon.patch
Normal file
File diff suppressed because it is too large
Load Diff
202
SOURCES/029-crm_mon.patch
Normal file
202
SOURCES/029-crm_mon.patch
Normal file
@ -0,0 +1,202 @@
|
||||
From bc60f9c84bd6f0fa4d73db8d140030dfcdbf4f5e Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Tue, 19 Jan 2021 15:58:36 -0500
|
||||
Subject: [PATCH 1/2] Fix: tools: Describe interactive crm_mon use in help and
|
||||
man page.
|
||||
|
||||
---
|
||||
tools/crm_mon.8.inc | 3 +++
|
||||
tools/crm_mon.c | 4 ++++
|
||||
tools/fix-manpages | 2 +-
|
||||
3 files changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_mon.8.inc b/tools/crm_mon.8.inc
|
||||
index e4cd7e3..6b46d7b 100644
|
||||
--- a/tools/crm_mon.8.inc
|
||||
+++ b/tools/crm_mon.8.inc
|
||||
@@ -12,3 +12,6 @@ crm_mon mode [options]
|
||||
|
||||
/command line arguments./
|
||||
.SH TIME SPECIFICATION
|
||||
+
|
||||
+/or --exclude=list./
|
||||
+.SH INTERACTIVE USE
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 083b7ae..aafc80f 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -1062,6 +1062,10 @@ build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) {
|
||||
"times on the command line, and each can give a comma-separated list of sections.\n"
|
||||
"The options are applied to the default set, from left to right as seen on the\n"
|
||||
"command line. For a list of valid sections, pass --include=list or --exclude=list.\n\n"
|
||||
+ "Interactive Use:\n\n"
|
||||
+ "When run interactively, crm_mon can be told to hide and display various sections\n"
|
||||
+ "of output. To see a help screen explaining the options, hit '?'. Any key stroke\n"
|
||||
+ "aside from those listed will cause the screen to refresh.\n\n"
|
||||
"Examples:\n\n"
|
||||
"Display the cluster status on the console with updates as they occur:\n\n"
|
||||
"\tcrm_mon\n\n"
|
||||
diff --git a/tools/fix-manpages b/tools/fix-manpages
|
||||
index 714ecce..f1f6f0d 100644
|
||||
--- a/tools/fix-manpages
|
||||
+++ b/tools/fix-manpages
|
||||
@@ -26,7 +26,7 @@
|
||||
# This leaves the --help-all output looking good and removes redundant
|
||||
# stuff from the man page. Feel free to add additional headers here.
|
||||
# Not all tools will have all headers.
|
||||
-/.SH NOTES\|.SH OPERATION SPECIFICATION\|.SH OUTPUT CONTROL\|.SH TIME SPECIFICATION/{ n
|
||||
+/.SH NOTES\|.SH INTERACTIVE USE\|.SH OPERATION SPECIFICATION\|.SH OUTPUT CONTROL\|.SH TIME SPECIFICATION/{ n
|
||||
N
|
||||
N
|
||||
d
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From ed4e4370dc97bc220878db89d69c71426b9458a3 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Tue, 19 Jan 2021 17:02:45 -0500
|
||||
Subject: [PATCH 2/2] Fix: tools: The 'm' key in crm_mon is a cycle, not a
|
||||
toggle.
|
||||
|
||||
Each time it's pressed, a different amount of fencing information should
|
||||
be shown, cycling back to nothing after level 3.
|
||||
---
|
||||
tools/crm_mon.c | 76 +++++++++++++++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 55 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index aafc80f..0981634 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -83,6 +83,8 @@ static gchar **processed_args = NULL;
|
||||
static time_t last_refresh = 0;
|
||||
crm_trigger_t *refresh_trigger = NULL;
|
||||
|
||||
+int interactive_fence_level = 0;
|
||||
+
|
||||
static pcmk__supported_format_t formats[] = {
|
||||
#if CURSES_ENABLED
|
||||
CRM_MON_SUPPORTED_FORMAT_CURSES,
|
||||
@@ -382,9 +384,9 @@ as_xml_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError *
|
||||
|
||||
static gboolean
|
||||
fence_history_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **err) {
|
||||
- int rc = crm_atoi(optarg, "2");
|
||||
+ interactive_fence_level = crm_atoi(optarg, "2");
|
||||
|
||||
- switch (rc) {
|
||||
+ switch (interactive_fence_level) {
|
||||
case 3:
|
||||
options.mon_ops |= mon_op_fence_full_history | mon_op_fence_history | mon_op_fence_connect;
|
||||
return include_exclude_cb("--include", "fencing", data, err);
|
||||
@@ -862,6 +864,38 @@ cib_connect(gboolean full)
|
||||
return rc;
|
||||
}
|
||||
|
||||
+/* This is used to set up the fencing options after the interactive UI has been stared.
|
||||
+ * fence_history_cb can't be used because it builds up a list of includes/excludes that
|
||||
+ * then have to be processed with apply_include_exclude and that could affect other
|
||||
+ * things.
|
||||
+ */
|
||||
+static void
|
||||
+set_fencing_options(int level)
|
||||
+{
|
||||
+ switch (level) {
|
||||
+ case 3:
|
||||
+ options.mon_ops |= mon_op_fence_full_history | mon_op_fence_history | mon_op_fence_connect;
|
||||
+ show |= mon_show_fencing_all;
|
||||
+ break;
|
||||
+
|
||||
+ case 2:
|
||||
+ options.mon_ops |= mon_op_fence_history | mon_op_fence_connect;
|
||||
+ show |= mon_show_fencing_all;
|
||||
+ break;
|
||||
+
|
||||
+ case 1:
|
||||
+ options.mon_ops |= mon_op_fence_history | mon_op_fence_connect;
|
||||
+ show |= mon_show_fence_failed | mon_show_fence_pending;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ level = 0;
|
||||
+ options.mon_ops &= ~(mon_op_fence_history | mon_op_fence_connect);
|
||||
+ show &= ~mon_show_fencing_all;
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
#if CURSES_ENABLED
|
||||
static const char *
|
||||
get_option_desc(char c)
|
||||
@@ -900,23 +934,12 @@ detect_user_input(GIOChannel *channel, GIOCondition condition, gpointer user_dat
|
||||
|
||||
switch (c) {
|
||||
case 'm':
|
||||
- if (!pcmk_is_set(show, mon_show_fencing_all)) {
|
||||
- options.mon_ops |= mon_op_fence_history;
|
||||
- options.mon_ops |= mon_op_fence_connect;
|
||||
- if (st == NULL) {
|
||||
- mon_cib_connection_destroy(NULL);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (pcmk_any_flags_set(show,
|
||||
- mon_show_fence_failed
|
||||
- |mon_show_fence_pending
|
||||
- |mon_show_fence_worked)) {
|
||||
- show &= ~mon_show_fencing_all;
|
||||
- } else {
|
||||
- show |= mon_show_fencing_all;
|
||||
+ interactive_fence_level++;
|
||||
+ if (interactive_fence_level > 3) {
|
||||
+ interactive_fence_level = 0;
|
||||
}
|
||||
|
||||
+ set_fencing_options(interactive_fence_level);
|
||||
break;
|
||||
case 'c':
|
||||
show ^= mon_show_tickets;
|
||||
@@ -997,10 +1020,7 @@ detect_user_input(GIOChannel *channel, GIOCondition condition, gpointer user_dat
|
||||
print_option_help(out, 'R', pcmk_is_set(options.mon_ops, mon_op_print_clone_detail));
|
||||
print_option_help(out, 'b', pcmk_is_set(options.mon_ops, mon_op_print_brief));
|
||||
print_option_help(out, 'j', pcmk_is_set(options.mon_ops, mon_op_print_pending));
|
||||
- print_option_help(out, 'm', pcmk_any_flags_set(show,
|
||||
- mon_show_fence_failed
|
||||
- |mon_show_fence_pending
|
||||
- |mon_show_fence_worked));
|
||||
+ out->info(out, "%d m: \t%s", interactive_fence_level, get_option_desc('m'));
|
||||
out->info(out, "%s", "\nToggle fields via field letter, type any other key to return");
|
||||
}
|
||||
|
||||
@@ -1400,6 +1420,19 @@ main(int argc, char **argv)
|
||||
return clean_up(CRM_EX_USAGE);
|
||||
}
|
||||
|
||||
+ /* Sync up the initial value of interactive_fence_level with whatever was set with
|
||||
+ * --include/--exclude= options.
|
||||
+ */
|
||||
+ if (pcmk_is_set(show, mon_show_fencing_all)) {
|
||||
+ interactive_fence_level = 3;
|
||||
+ } else if (pcmk_is_set(show, mon_show_fence_worked)) {
|
||||
+ interactive_fence_level = 2;
|
||||
+ } else if (pcmk_any_flags_set(show, mon_show_fence_failed | mon_show_fence_pending)) {
|
||||
+ interactive_fence_level = 1;
|
||||
+ } else {
|
||||
+ interactive_fence_level = 0;
|
||||
+ }
|
||||
+
|
||||
crm_mon_register_messages(out);
|
||||
pe__register_messages(out);
|
||||
stonith__register_messages(out);
|
||||
@@ -1460,6 +1493,7 @@ main(int argc, char **argv)
|
||||
} while (rc == -ENOTCONN);
|
||||
|
||||
handle_connection_failures(rc);
|
||||
+ set_fencing_options(interactive_fence_level);
|
||||
mon_refresh_display(NULL);
|
||||
|
||||
mainloop = g_main_loop_new(NULL, FALSE);
|
||||
--
|
||||
1.8.3.1
|
||||
|
1505
SOURCES/030-crmadmin.patch
Normal file
1505
SOURCES/030-crmadmin.patch
Normal file
File diff suppressed because it is too large
Load Diff
29
SOURCES/031-cibsecret.patch
Normal file
29
SOURCES/031-cibsecret.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 240b9ec01e6a6e6554f0ae13d759c01339835a40 Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Wed, 27 Jan 2021 10:10:03 +0100
|
||||
Subject: [PATCH] Feature: cibsecret: use crmadmin -N (which also lists guest
|
||||
and remote nodes) to get nodes to sync to
|
||||
|
||||
---
|
||||
tools/cibsecret.in | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/cibsecret.in b/tools/cibsecret.in
|
||||
index 8923a70..6326bf0 100644
|
||||
--- a/tools/cibsecret.in
|
||||
+++ b/tools/cibsecret.in
|
||||
@@ -182,9 +182,9 @@ get_live_peers() {
|
||||
[ $? -eq 0 ] || fatal $CRM_EX_UNAVAILABLE "couldn't get local node name"
|
||||
|
||||
# Get a list of all other cluster nodes
|
||||
- GLP_ALL_PEERS="$(crm_node -l)"
|
||||
+ GLP_ALL_PEERS="$(crmadmin -N -q)"
|
||||
[ $? -eq 0 ] || fatal $CRM_EX_UNAVAILABLE "couldn't determine cluster nodes"
|
||||
- GLP_ALL_PEERS="$(echo "$GLP_ALL_PEERS" | awk '{print $2}' | grep -v "^${GLP_LOCAL_NODE}$")"
|
||||
+ GLP_ALL_PEERS="$(echo "$GLP_ALL_PEERS" | grep -v "^${GLP_LOCAL_NODE}$")"
|
||||
|
||||
# Make a list of those that respond to pings
|
||||
if [ "$(id -u)" = "0" ] && which fping >/dev/null 2>&1; then
|
||||
--
|
||||
1.8.3.1
|
||||
|
6801
SOURCES/032-rhbz1898457.patch
Normal file
6801
SOURCES/032-rhbz1898457.patch
Normal file
File diff suppressed because it is too large
Load Diff
26
SOURCES/033-cibsecret.patch
Normal file
26
SOURCES/033-cibsecret.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 494eebe33d56b24e1f3a13ebe6c0ec651c99a2af Mon Sep 17 00:00:00 2001
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Wed, 3 Feb 2021 09:47:39 -0600
|
||||
Subject: [PATCH] Fix: tools: get cibsecret stash working again
|
||||
|
||||
Broke with dfe636c4
|
||||
---
|
||||
tools/cibsecret.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/cibsecret.in b/tools/cibsecret.in
|
||||
index 6326bf0..ce57a18 100644
|
||||
--- a/tools/cibsecret.in
|
||||
+++ b/tools/cibsecret.in
|
||||
@@ -393,7 +393,7 @@ cibsecret_stash() {
|
||||
fatal $CRM_EX_NOSUCH "nothing to stash for resource $rsc parameter $param"
|
||||
is_secret "$CIBSTASH_CURRENT" &&
|
||||
fatal $CRM_EX_EXISTS "resource $rsc parameter $param already set as secret, nothing to stash"
|
||||
- cibsecret_set "$CIBSTASH_CURRENT"
|
||||
+ cibsecret_set "$CIBSTASH_CURRENT" 4
|
||||
}
|
||||
|
||||
cibsecret_unstash() {
|
||||
--
|
||||
1.8.3.1
|
||||
|
709
SOURCES/034-crm_mon.patch
Normal file
709
SOURCES/034-crm_mon.patch
Normal file
@ -0,0 +1,709 @@
|
||||
From 68139dc8ff5efbfd81d3b5e868462e7eaefa2c74 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Mon, 25 Jan 2021 15:35:33 +0100
|
||||
Subject: [PATCH 1/7] Fix: crm_mon: add explicit void to one_shot prototype for
|
||||
compat
|
||||
|
||||
---
|
||||
tools/crm_mon.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 0981634..1eca1b7 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -1226,7 +1226,7 @@ handle_connection_failures(int rc)
|
||||
}
|
||||
|
||||
static void
|
||||
-one_shot()
|
||||
+one_shot(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 8c7a01f8880efff8457e8421c381082b250d4512 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Mon, 25 Jan 2021 16:26:30 +0100
|
||||
Subject: [PATCH 2/7] Refactor: crm_mon: cib_connect &
|
||||
handle_connection_failures -> new rc
|
||||
|
||||
---
|
||||
tools/crm_mon.c | 62 ++++++++++++++++++++++++++++++++-------------------------
|
||||
1 file changed, 35 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 1eca1b7..3fbac5f 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -690,7 +690,7 @@ reconnect_after_timeout(gpointer data)
|
||||
|
||||
print_as(output_format, "Reconnecting...\n");
|
||||
fencing_connect();
|
||||
- if (cib_connect(TRUE) == pcmk_ok) {
|
||||
+ if (cib_connect(TRUE) == pcmk_rc_ok) {
|
||||
/* Redraw the screen and reinstall ourselves to get called after another reconnect_msec. */
|
||||
mon_refresh_display(NULL);
|
||||
return FALSE;
|
||||
@@ -804,16 +804,17 @@ fencing_connect(void)
|
||||
static int
|
||||
cib_connect(gboolean full)
|
||||
{
|
||||
- int rc = pcmk_ok;
|
||||
+ int rc = pcmk_rc_ok;
|
||||
static gboolean need_pass = TRUE;
|
||||
|
||||
- CRM_CHECK(cib != NULL, return -EINVAL);
|
||||
+ CRM_CHECK(cib != NULL, return EINVAL);
|
||||
|
||||
if (getenv("CIB_passwd") != NULL) {
|
||||
need_pass = FALSE;
|
||||
}
|
||||
|
||||
- if (cib->state == cib_connected_query || cib->state == cib_connected_command) {
|
||||
+ if (cib->state == cib_connected_query ||
|
||||
+ cib->state == cib_connected_command) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -825,37 +826,44 @@ cib_connect(gboolean full)
|
||||
* @TODO Add a password prompt (maybe including input) function to
|
||||
* pcmk__output_t and use it in libcib.
|
||||
*/
|
||||
- if ((output_format == mon_output_console) && need_pass && (cib->variant == cib_remote)) {
|
||||
+ if ((output_format == mon_output_console) &&
|
||||
+ need_pass &&
|
||||
+ (cib->variant == cib_remote)) {
|
||||
need_pass = FALSE;
|
||||
print_as(output_format, "Password:");
|
||||
}
|
||||
|
||||
- rc = cib->cmds->signon(cib, crm_system_name, cib_query);
|
||||
- if (rc != pcmk_ok) {
|
||||
+ rc = pcmk_legacy2rc(cib->cmds->signon(cib, crm_system_name, cib_query));
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
out->err(out, "Could not connect to the CIB: %s",
|
||||
- pcmk_strerror(rc));
|
||||
+ pcmk_rc_str(rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
- rc = cib->cmds->query(cib, NULL, ¤t_cib, cib_scope_local | cib_sync_call);
|
||||
+ rc = pcmk_legacy2rc(cib->cmds->query(cib, NULL, ¤t_cib,
|
||||
+ cib_scope_local | cib_sync_call));
|
||||
|
||||
- if (rc == pcmk_ok && full) {
|
||||
- rc = cib->cmds->set_connection_dnotify(cib, mon_cib_connection_destroy);
|
||||
- if (rc == -EPROTONOSUPPORT) {
|
||||
- print_as
|
||||
- (output_format, "Notification setup not supported, won't be able to reconnect after failure");
|
||||
+ if (rc == pcmk_rc_ok && full) {
|
||||
+ rc = pcmk_legacy2rc(cib->cmds->set_connection_dnotify(cib,
|
||||
+ mon_cib_connection_destroy));
|
||||
+ if (rc == EPROTONOSUPPORT) {
|
||||
+ print_as(output_format,
|
||||
+ "Notification setup not supported, won't be "
|
||||
+ "able to reconnect after failure");
|
||||
if (output_format == mon_output_console) {
|
||||
sleep(2);
|
||||
}
|
||||
- rc = pcmk_ok;
|
||||
+ rc = pcmk_rc_ok;
|
||||
}
|
||||
|
||||
- if (rc == pcmk_ok) {
|
||||
- cib->cmds->del_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);
|
||||
- rc = cib->cmds->add_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ cib->cmds->del_notify_callback(cib, T_CIB_DIFF_NOTIFY,
|
||||
+ crm_diff_update);
|
||||
+ rc = pcmk_legacy2rc(cib->cmds->add_notify_callback(cib,
|
||||
+ T_CIB_DIFF_NOTIFY, crm_diff_update));
|
||||
}
|
||||
|
||||
- if (rc != pcmk_ok) {
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
out->err(out, "Notification setup failed, could not monitor CIB actions");
|
||||
clean_up_cib_connection();
|
||||
clean_up_fencing_connection();
|
||||
@@ -1206,20 +1214,20 @@ reconcile_output_format(pcmk__common_args_t *args) {
|
||||
static void
|
||||
handle_connection_failures(int rc)
|
||||
{
|
||||
- if (rc == pcmk_ok) {
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (output_format == mon_output_monitor) {
|
||||
g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "CLUSTER CRIT: Connection to cluster failed: %s",
|
||||
- pcmk_strerror(rc));
|
||||
+ pcmk_rc_str(rc));
|
||||
rc = MON_STATUS_CRIT;
|
||||
- } else if (rc == -ENOTCONN) {
|
||||
+ } else if (rc == ENOTCONN) {
|
||||
g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "Error: cluster is not available on this node");
|
||||
- rc = crm_errno2exit(rc);
|
||||
+ rc = pcmk_rc2exitc(rc);
|
||||
} else {
|
||||
- g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "Connection to cluster failed: %s", pcmk_strerror(rc));
|
||||
- rc = crm_errno2exit(rc);
|
||||
+ g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "Connection to cluster failed: %s", pcmk_rc_str(rc));
|
||||
+ rc = pcmk_rc2exitc(rc);
|
||||
}
|
||||
|
||||
clean_up(rc);
|
||||
@@ -1478,7 +1486,7 @@ main(int argc, char **argv)
|
||||
fencing_connect();
|
||||
rc = cib_connect(TRUE);
|
||||
|
||||
- if (rc != pcmk_ok) {
|
||||
+ if (rc != pcmk_rc_ok) {
|
||||
sleep(options.reconnect_msec / 1000);
|
||||
#if CURSES_ENABLED
|
||||
if (output_format == mon_output_console) {
|
||||
@@ -1490,7 +1498,7 @@ main(int argc, char **argv)
|
||||
printf("Writing html to %s ...\n", args->output_dest);
|
||||
}
|
||||
|
||||
- } while (rc == -ENOTCONN);
|
||||
+ } while (rc == ENOTCONN);
|
||||
|
||||
handle_connection_failures(rc);
|
||||
set_fencing_options(interactive_fence_level);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 9b8fb7b608280f65a3b76d66a99b575a4da70944 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Mon, 25 Jan 2021 18:26:04 +0100
|
||||
Subject: [PATCH 3/7] Fix: tools: Report pacemakerd in state waiting for sbd
|
||||
|
||||
Waiting for pacemakerd to report that all subdaemons are started
|
||||
before trying to connect to cib and fencer should remove the
|
||||
potential race introduced by making fencer connection failure
|
||||
non fatal when cib is faster to come up.
|
||||
---
|
||||
tools/crm_mon.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
tools/crm_mon.h | 1 +
|
||||
2 files changed, 148 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 3fbac5f..61f070d 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -132,6 +132,7 @@ static void handle_connection_failures(int rc);
|
||||
static int mon_refresh_display(gpointer user_data);
|
||||
static int cib_connect(gboolean full);
|
||||
static int fencing_connect(void);
|
||||
+static int pacemakerd_status(void);
|
||||
static void mon_st_callback_event(stonith_t * st, stonith_event_t * e);
|
||||
static void mon_st_callback_display(stonith_t * st, stonith_event_t * e);
|
||||
static void refresh_after_event(gboolean data_updated);
|
||||
@@ -689,11 +690,13 @@ reconnect_after_timeout(gpointer data)
|
||||
}
|
||||
|
||||
print_as(output_format, "Reconnecting...\n");
|
||||
- fencing_connect();
|
||||
- if (cib_connect(TRUE) == pcmk_rc_ok) {
|
||||
- /* Redraw the screen and reinstall ourselves to get called after another reconnect_msec. */
|
||||
- mon_refresh_display(NULL);
|
||||
- return FALSE;
|
||||
+ if (pacemakerd_status() == pcmk_rc_ok) {
|
||||
+ fencing_connect();
|
||||
+ if (cib_connect(TRUE) == pcmk_rc_ok) {
|
||||
+ /* Redraw the screen and reinstall ourselves to get called after another reconnect_msec. */
|
||||
+ mon_refresh_display(NULL);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
}
|
||||
|
||||
reconnect_timer = g_timeout_add(options.reconnect_msec, reconnect_after_timeout, NULL);
|
||||
@@ -840,6 +843,13 @@ cib_connect(gboolean full)
|
||||
return rc;
|
||||
}
|
||||
|
||||
+#if CURSES_ENABLED
|
||||
+ /* just show this if refresh is gonna remove all traces */
|
||||
+ if (output_format == mon_output_console) {
|
||||
+ print_as(output_format ,"Waiting for CIB ...\n");
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
rc = pcmk_legacy2rc(cib->cmds->query(cib, NULL, ¤t_cib,
|
||||
cib_scope_local | cib_sync_call));
|
||||
|
||||
@@ -904,6 +914,121 @@ set_fencing_options(int level)
|
||||
}
|
||||
}
|
||||
|
||||
+/* Before trying to connect to fencer or cib check for state of
|
||||
+ pacemakerd - just no sense in trying till pacemakerd has
|
||||
+ taken care of starting all the sub-processes
|
||||
+
|
||||
+ Only noteworthy thing to show here is when pacemakerd is
|
||||
+ waiting for startup-trigger from SBD.
|
||||
+ */
|
||||
+static void
|
||||
+pacemakerd_event_cb(pcmk_ipc_api_t *pacemakerd_api,
|
||||
+ enum pcmk_ipc_event event_type, crm_exit_t status,
|
||||
+ void *event_data, void *user_data)
|
||||
+{
|
||||
+ pcmk_pacemakerd_api_reply_t *reply = event_data;
|
||||
+ enum pcmk_pacemakerd_state *state =
|
||||
+ (enum pcmk_pacemakerd_state *) user_data;
|
||||
+
|
||||
+ /* we are just interested in the latest reply */
|
||||
+ *state = pcmk_pacemakerd_state_invalid;
|
||||
+
|
||||
+ switch (event_type) {
|
||||
+ case pcmk_ipc_event_reply:
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (status != CRM_EX_OK) {
|
||||
+ out->err(out, "Bad reply from pacemakerd: %s",
|
||||
+ crm_exit_str(status));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (reply->reply_type != pcmk_pacemakerd_reply_ping) {
|
||||
+ out->err(out, "Unknown reply type %d from pacemakerd",
|
||||
+ reply->reply_type);
|
||||
+ } else {
|
||||
+ if ((reply->data.ping.last_good != (time_t) 0) &&
|
||||
+ (reply->data.ping.status == pcmk_rc_ok)) {
|
||||
+ *state = reply->data.ping.state;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+pacemakerd_status(void)
|
||||
+{
|
||||
+ int rc = pcmk_rc_ok;
|
||||
+ pcmk_ipc_api_t *pacemakerd_api = NULL;
|
||||
+ enum pcmk_pacemakerd_state state = pcmk_pacemakerd_state_invalid;
|
||||
+
|
||||
+ if (!pcmk_is_set(options.mon_ops, mon_op_cib_native)) {
|
||||
+ /* we don't need fully functional pacemakerd otherwise */
|
||||
+ return rc;
|
||||
+ }
|
||||
+ if (cib != NULL &&
|
||||
+ (cib->state == cib_connected_query ||
|
||||
+ cib->state == cib_connected_command)) {
|
||||
+ /* As long as we have a cib-connection let's go with
|
||||
+ * that to fetch further cluster-status and avoid
|
||||
+ * unnecessary pings to pacemakerd.
|
||||
+ * If cluster is going down and fencer is down already
|
||||
+ * this will lead to a silently failing fencer reconnect.
|
||||
+ * On cluster startup we shouldn't see this situation
|
||||
+ * as first we do is wait for pacemakerd to report all
|
||||
+ * daemons running.
|
||||
+ */
|
||||
+ return rc;
|
||||
+ }
|
||||
+ rc = pcmk_new_ipc_api(&pacemakerd_api, pcmk_ipc_pacemakerd);
|
||||
+ if (pacemakerd_api == NULL) {
|
||||
+ out->err(out, "Could not connect to pacemakerd: %s",
|
||||
+ pcmk_rc_str(rc));
|
||||
+ /* this is unrecoverable so return with rc we have */
|
||||
+ return rc;
|
||||
+ }
|
||||
+ pcmk_register_ipc_callback(pacemakerd_api, pacemakerd_event_cb, (void *) &state);
|
||||
+ rc = pcmk_connect_ipc(pacemakerd_api, pcmk_ipc_dispatch_poll);
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ rc = pcmk_pacemakerd_api_ping(pacemakerd_api, crm_system_name);
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ rc = pcmk_poll_ipc(pacemakerd_api, options.reconnect_msec/2);
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ pcmk_dispatch_ipc(pacemakerd_api);
|
||||
+ rc = ENOTCONN;
|
||||
+ switch (state) {
|
||||
+ case pcmk_pacemakerd_state_running:
|
||||
+ rc = pcmk_rc_ok;
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_starting_daemons:
|
||||
+ print_as(output_format ,"Pacemaker daemons starting ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_wait_for_ping:
|
||||
+ print_as(output_format ,"Waiting for startup-trigger from SBD ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_shutting_down:
|
||||
+ print_as(output_format ,"Pacemaker daemons shutting down ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_shutdown_complete:
|
||||
+ /* assuming pacemakerd doesn't dispatch any pings after entering
|
||||
+ * that state unless it is waiting for SBD
|
||||
+ */
|
||||
+ print_as(output_format ,"Pacemaker daemons shut down - reporting to SBD ...\n");
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ pcmk_free_ipc_api(pacemakerd_api);
|
||||
+ /* returning with ENOTCONN triggers a retry */
|
||||
+ return (rc == pcmk_rc_ok)?rc:ENOTCONN;
|
||||
+}
|
||||
+
|
||||
#if CURSES_ENABLED
|
||||
static const char *
|
||||
get_option_desc(char c)
|
||||
@@ -1033,8 +1158,11 @@ detect_user_input(GIOChannel *channel, GIOCondition condition, gpointer user_dat
|
||||
}
|
||||
|
||||
refresh:
|
||||
- fencing_connect();
|
||||
- rc = cib_connect(FALSE);
|
||||
+ rc = pacemakerd_status();
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ fencing_connect();
|
||||
+ rc = cib_connect(FALSE);
|
||||
+ }
|
||||
if (rc == pcmk_rc_ok) {
|
||||
mon_refresh_display(NULL);
|
||||
} else {
|
||||
@@ -1238,9 +1366,13 @@ one_shot(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
- fencing_connect();
|
||||
+ rc = pacemakerd_status();
|
||||
+
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ fencing_connect();
|
||||
+ rc = cib_connect(FALSE);
|
||||
+ }
|
||||
|
||||
- rc = cib_connect(FALSE);
|
||||
if (rc == pcmk_rc_ok) {
|
||||
mon_refresh_display(NULL);
|
||||
} else {
|
||||
@@ -1316,6 +1448,7 @@ main(int argc, char **argv)
|
||||
|
||||
case cib_native:
|
||||
/* cib & fencing - everything available */
|
||||
+ options.mon_ops |= mon_op_cib_native;
|
||||
break;
|
||||
|
||||
case cib_file:
|
||||
@@ -1483,8 +1616,11 @@ main(int argc, char **argv)
|
||||
do {
|
||||
print_as(output_format ,"Waiting until cluster is available on this node ...\n");
|
||||
|
||||
- fencing_connect();
|
||||
- rc = cib_connect(TRUE);
|
||||
+ rc = pacemakerd_status();
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ fencing_connect();
|
||||
+ rc = cib_connect(TRUE);
|
||||
+ }
|
||||
|
||||
if (rc != pcmk_rc_ok) {
|
||||
sleep(options.reconnect_msec / 1000);
|
||||
diff --git a/tools/crm_mon.h b/tools/crm_mon.h
|
||||
index 73c926d..b556913 100644
|
||||
--- a/tools/crm_mon.h
|
||||
+++ b/tools/crm_mon.h
|
||||
@@ -91,6 +91,7 @@ typedef enum mon_output_format_e {
|
||||
#define mon_op_print_brief (0x0200U)
|
||||
#define mon_op_print_pending (0x0400U)
|
||||
#define mon_op_print_clone_detail (0x0800U)
|
||||
+#define mon_op_cib_native (0x1000U)
|
||||
|
||||
#define mon_op_default (mon_op_print_pending | mon_op_fence_history | mon_op_fence_connect)
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 046516dbe66fb2c52b90f36215cf60c5ad3c269b Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Thu, 28 Jan 2021 16:38:22 +0100
|
||||
Subject: [PATCH 4/7] Refactor: crm_mon: do refreshes rather via
|
||||
refresh_after_event
|
||||
|
||||
---
|
||||
tools/crm_mon.c | 35 ++++++++++++++---------------------
|
||||
1 file changed, 14 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 61f070d..195e7b5 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -135,7 +135,7 @@ static int fencing_connect(void);
|
||||
static int pacemakerd_status(void);
|
||||
static void mon_st_callback_event(stonith_t * st, stonith_event_t * e);
|
||||
static void mon_st_callback_display(stonith_t * st, stonith_event_t * e);
|
||||
-static void refresh_after_event(gboolean data_updated);
|
||||
+static void refresh_after_event(gboolean data_updated, gboolean enforce);
|
||||
|
||||
static unsigned int
|
||||
all_includes(mon_output_format_t fmt) {
|
||||
@@ -694,13 +694,13 @@ reconnect_after_timeout(gpointer data)
|
||||
fencing_connect();
|
||||
if (cib_connect(TRUE) == pcmk_rc_ok) {
|
||||
/* Redraw the screen and reinstall ourselves to get called after another reconnect_msec. */
|
||||
- mon_refresh_display(NULL);
|
||||
+ refresh_after_event(FALSE, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
reconnect_timer = g_timeout_add(options.reconnect_msec, reconnect_after_timeout, NULL);
|
||||
- return TRUE;
|
||||
+ return FALSE;
|
||||
}
|
||||
|
||||
/* Called from various places when we are disconnected from the CIB or from the
|
||||
@@ -1057,7 +1057,6 @@ static gboolean
|
||||
detect_user_input(GIOChannel *channel, GIOCondition condition, gpointer user_data)
|
||||
{
|
||||
int c;
|
||||
- int rc;
|
||||
gboolean config_mode = FALSE;
|
||||
|
||||
while (1) {
|
||||
@@ -1158,16 +1157,7 @@ detect_user_input(GIOChannel *channel, GIOCondition condition, gpointer user_dat
|
||||
}
|
||||
|
||||
refresh:
|
||||
- rc = pacemakerd_status();
|
||||
- if (rc == pcmk_rc_ok) {
|
||||
- fencing_connect();
|
||||
- rc = cib_connect(FALSE);
|
||||
- }
|
||||
- if (rc == pcmk_rc_ok) {
|
||||
- mon_refresh_display(NULL);
|
||||
- } else {
|
||||
- handle_connection_failures(rc);
|
||||
- }
|
||||
+ refresh_after_event(FALSE, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2087,7 +2077,7 @@ crm_diff_update(const char *event, xmlNode * msg)
|
||||
}
|
||||
|
||||
stale = FALSE;
|
||||
- refresh_after_event(cib_updated);
|
||||
+ refresh_after_event(cib_updated, FALSE);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -2246,7 +2236,7 @@ mon_st_callback_event(stonith_t * st, stonith_event_t * e)
|
||||
* fencing event is received or a CIB diff occurrs.
|
||||
*/
|
||||
static void
|
||||
-refresh_after_event(gboolean data_updated)
|
||||
+refresh_after_event(gboolean data_updated, gboolean enforce)
|
||||
{
|
||||
static int updates = 0;
|
||||
time_t now = time(NULL);
|
||||
@@ -2259,12 +2249,15 @@ refresh_after_event(gboolean data_updated)
|
||||
refresh_timer = mainloop_timer_add("refresh", 2000, FALSE, mon_trigger_refresh, NULL);
|
||||
}
|
||||
|
||||
- if ((now - last_refresh) > (options.reconnect_msec / 1000)) {
|
||||
- mainloop_set_trigger(refresh_trigger);
|
||||
+ if (reconnect_timer > 0) {
|
||||
+ /* we will receive a refresh request after successful reconnect */
|
||||
mainloop_timer_stop(refresh_timer);
|
||||
- updates = 0;
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- } else if(updates >= 10) {
|
||||
+ if (enforce ||
|
||||
+ now - last_refresh > options.reconnect_msec / 1000 ||
|
||||
+ updates >= 10) {
|
||||
mainloop_set_trigger(refresh_trigger);
|
||||
mainloop_timer_stop(refresh_timer);
|
||||
updates = 0;
|
||||
@@ -2285,7 +2278,7 @@ mon_st_callback_display(stonith_t * st, stonith_event_t * e)
|
||||
mon_cib_connection_destroy(NULL);
|
||||
} else {
|
||||
print_dot(output_format);
|
||||
- refresh_after_event(TRUE);
|
||||
+ refresh_after_event(TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From a63af2713f96719fc1d5ef594eb033d0f251187f Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Thu, 28 Jan 2021 16:52:57 +0100
|
||||
Subject: [PATCH 5/7] Fix: crm_mon: retry fencer connection as not fatal
|
||||
initially
|
||||
|
||||
and cleanup fencer api to not leak memory on multiple reconnects
|
||||
---
|
||||
tools/crm_mon.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 195e7b5..a768ca9 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -798,7 +798,7 @@ fencing_connect(void)
|
||||
st->cmds->register_notification(st, T_STONITH_NOTIFY_HISTORY, mon_st_callback_display);
|
||||
}
|
||||
} else {
|
||||
- st = NULL;
|
||||
+ clean_up_fencing_connection();
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -2255,6 +2255,12 @@ refresh_after_event(gboolean data_updated, gboolean enforce)
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* as we're not handling initial failure of fencer-connection as
|
||||
+ * fatal give it a retry here
|
||||
+ * not getting here if cib-reconnection is already on the way
|
||||
+ */
|
||||
+ fencing_connect();
|
||||
+
|
||||
if (enforce ||
|
||||
now - last_refresh > options.reconnect_msec / 1000 ||
|
||||
updates >= 10) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From b6f4b5dfc0b5fec8cdc029409fc61252de019415 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Thu, 28 Jan 2021 18:08:43 +0100
|
||||
Subject: [PATCH 6/7] Refactor: crm_mon: have reconnect-timer removed
|
||||
implicitly
|
||||
|
||||
---
|
||||
tools/crm_mon.c | 12 ++++--------
|
||||
1 file changed, 4 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index a768ca9..4f73379 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -684,23 +684,19 @@ reconnect_after_timeout(gpointer data)
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (reconnect_timer > 0) {
|
||||
- g_source_remove(reconnect_timer);
|
||||
- reconnect_timer = 0;
|
||||
- }
|
||||
-
|
||||
print_as(output_format, "Reconnecting...\n");
|
||||
if (pacemakerd_status() == pcmk_rc_ok) {
|
||||
fencing_connect();
|
||||
if (cib_connect(TRUE) == pcmk_rc_ok) {
|
||||
- /* Redraw the screen and reinstall ourselves to get called after another reconnect_msec. */
|
||||
+ /* trigger redrawing the screen (needs reconnect_timer == 0) */
|
||||
+ reconnect_timer = 0;
|
||||
refresh_after_event(FALSE, TRUE);
|
||||
- return FALSE;
|
||||
+ return G_SOURCE_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
reconnect_timer = g_timeout_add(options.reconnect_msec, reconnect_after_timeout, NULL);
|
||||
- return FALSE;
|
||||
+ return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
/* Called from various places when we are disconnected from the CIB or from the
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
From 586e69ec38d5273b348c42a61b9bc7bbcc2b93b3 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Thu, 28 Jan 2021 21:08:16 +0100
|
||||
Subject: [PATCH 7/7] Fix: crm_mon: suppress pacemakerd-status for non-text
|
||||
output
|
||||
|
||||
---
|
||||
tools/crm_mon.c | 53 ++++++++++++++++++++++++++++++++---------------------
|
||||
1 file changed, 32 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index 4f73379..d4d4ac3 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -995,27 +995,38 @@ pacemakerd_status(void)
|
||||
if (rc == pcmk_rc_ok) {
|
||||
pcmk_dispatch_ipc(pacemakerd_api);
|
||||
rc = ENOTCONN;
|
||||
- switch (state) {
|
||||
- case pcmk_pacemakerd_state_running:
|
||||
- rc = pcmk_rc_ok;
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_starting_daemons:
|
||||
- print_as(output_format ,"Pacemaker daemons starting ...\n");
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_wait_for_ping:
|
||||
- print_as(output_format ,"Waiting for startup-trigger from SBD ...\n");
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_shutting_down:
|
||||
- print_as(output_format ,"Pacemaker daemons shutting down ...\n");
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_shutdown_complete:
|
||||
- /* assuming pacemakerd doesn't dispatch any pings after entering
|
||||
- * that state unless it is waiting for SBD
|
||||
- */
|
||||
- print_as(output_format ,"Pacemaker daemons shut down - reporting to SBD ...\n");
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
+ if ((output_format == mon_output_console) ||
|
||||
+ (output_format == mon_output_plain)) {
|
||||
+ switch (state) {
|
||||
+ case pcmk_pacemakerd_state_running:
|
||||
+ rc = pcmk_rc_ok;
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_starting_daemons:
|
||||
+ print_as(output_format ,"Pacemaker daemons starting ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_wait_for_ping:
|
||||
+ print_as(output_format ,"Waiting for startup-trigger from SBD ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_shutting_down:
|
||||
+ print_as(output_format ,"Pacemaker daemons shutting down ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_shutdown_complete:
|
||||
+ /* assuming pacemakerd doesn't dispatch any pings after entering
|
||||
+ * that state unless it is waiting for SBD
|
||||
+ */
|
||||
+ print_as(output_format ,"Pacemaker daemons shut down - reporting to SBD ...\n");
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ switch (state) {
|
||||
+ case pcmk_pacemakerd_state_running:
|
||||
+ rc = pcmk_rc_ok;
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
267
SOURCES/035-crm_mon.patch
Normal file
267
SOURCES/035-crm_mon.patch
Normal file
@ -0,0 +1,267 @@
|
||||
From f4e3d77c94906a062641c7bf34243049de521a87 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Wed, 3 Feb 2021 13:25:22 +0100
|
||||
Subject: [PATCH] Fix: crm_mon: detect when run on remote-node
|
||||
|
||||
---
|
||||
daemons/execd/remoted_proxy.c | 17 +++++++
|
||||
daemons/pacemakerd/pacemakerd.c | 6 +--
|
||||
include/crm/common/ipc_internal.h | 2 +
|
||||
lib/common/ipc_server.c | 26 ++++++++++
|
||||
tools/crm_mon.c | 99 ++++++++++++++++++++++++---------------
|
||||
5 files changed, 106 insertions(+), 44 deletions(-)
|
||||
|
||||
diff --git a/daemons/execd/remoted_proxy.c b/daemons/execd/remoted_proxy.c
|
||||
index 9329fa6..0fe39bf 100644
|
||||
--- a/daemons/execd/remoted_proxy.c
|
||||
+++ b/daemons/execd/remoted_proxy.c
|
||||
@@ -29,6 +29,7 @@ static qb_ipcs_service_t *cib_shm = NULL;
|
||||
static qb_ipcs_service_t *attrd_ipcs = NULL;
|
||||
static qb_ipcs_service_t *crmd_ipcs = NULL;
|
||||
static qb_ipcs_service_t *stonith_ipcs = NULL;
|
||||
+static qb_ipcs_service_t *pacemakerd_ipcs = NULL;
|
||||
|
||||
// An IPC provider is a cluster node controller connecting as a client
|
||||
static GList *ipc_providers = NULL;
|
||||
@@ -126,6 +127,12 @@ stonith_proxy_accept(qb_ipcs_connection_t * c, uid_t uid, gid_t gid)
|
||||
}
|
||||
|
||||
static int32_t
|
||||
+pacemakerd_proxy_accept(qb_ipcs_connection_t * c, uid_t uid, gid_t gid)
|
||||
+{
|
||||
+ return -EREMOTEIO;
|
||||
+}
|
||||
+
|
||||
+static int32_t
|
||||
cib_proxy_accept_rw(qb_ipcs_connection_t * c, uid_t uid, gid_t gid)
|
||||
{
|
||||
return ipc_proxy_accept(c, uid, gid, PCMK__SERVER_BASED_RW);
|
||||
@@ -356,6 +363,14 @@ static struct qb_ipcs_service_handlers stonith_proxy_callbacks = {
|
||||
.connection_destroyed = ipc_proxy_destroy
|
||||
};
|
||||
|
||||
+static struct qb_ipcs_service_handlers pacemakerd_proxy_callbacks = {
|
||||
+ .connection_accept = pacemakerd_proxy_accept,
|
||||
+ .connection_created = NULL,
|
||||
+ .msg_process = NULL,
|
||||
+ .connection_closed = NULL,
|
||||
+ .connection_destroyed = NULL
|
||||
+};
|
||||
+
|
||||
static struct qb_ipcs_service_handlers cib_proxy_callbacks_ro = {
|
||||
.connection_accept = cib_proxy_accept_ro,
|
||||
.connection_created = NULL,
|
||||
@@ -422,6 +437,7 @@ ipc_proxy_init(void)
|
||||
&cib_proxy_callbacks_rw);
|
||||
pcmk__serve_attrd_ipc(&attrd_ipcs, &attrd_proxy_callbacks);
|
||||
pcmk__serve_fenced_ipc(&stonith_ipcs, &stonith_proxy_callbacks);
|
||||
+ pcmk__serve_pacemakerd_ipc(&pacemakerd_ipcs, &pacemakerd_proxy_callbacks);
|
||||
crmd_ipcs = pcmk__serve_controld_ipc(&crmd_proxy_callbacks);
|
||||
if (crmd_ipcs == NULL) {
|
||||
crm_err("Failed to create controller: exiting and inhibiting respawn");
|
||||
@@ -444,6 +460,7 @@ ipc_proxy_cleanup(void)
|
||||
pcmk__stop_based_ipc(cib_ro, cib_rw, cib_shm);
|
||||
qb_ipcs_destroy(attrd_ipcs);
|
||||
qb_ipcs_destroy(stonith_ipcs);
|
||||
+ qb_ipcs_destroy(pacemakerd_ipcs);
|
||||
qb_ipcs_destroy(crmd_ipcs);
|
||||
cib_ro = NULL;
|
||||
cib_rw = NULL;
|
||||
diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c
|
||||
index 509b0f8..4572b70 100644
|
||||
--- a/daemons/pacemakerd/pacemakerd.c
|
||||
+++ b/daemons/pacemakerd/pacemakerd.c
|
||||
@@ -1287,11 +1287,7 @@ main(int argc, char **argv)
|
||||
|
||||
// Don't build CRM_RSCTMP_DIR, pacemaker-execd will do it
|
||||
|
||||
- ipcs = mainloop_add_ipc_server(CRM_SYSTEM_MCP, QB_IPC_NATIVE, &mcp_ipc_callbacks);
|
||||
- if (ipcs == NULL) {
|
||||
- crm_err("Couldn't start IPC server");
|
||||
- crm_exit(CRM_EX_OSERR);
|
||||
- }
|
||||
+ pcmk__serve_pacemakerd_ipc(&ipcs, &mcp_ipc_callbacks);
|
||||
|
||||
#ifdef SUPPORT_COROSYNC
|
||||
/* Allows us to block shutdown */
|
||||
diff --git a/include/crm/common/ipc_internal.h b/include/crm/common/ipc_internal.h
|
||||
index cf935f3..fb82ce1 100644
|
||||
--- a/include/crm/common/ipc_internal.h
|
||||
+++ b/include/crm/common/ipc_internal.h
|
||||
@@ -221,6 +221,8 @@ void pcmk__serve_attrd_ipc(qb_ipcs_service_t **ipcs,
|
||||
struct qb_ipcs_service_handlers *cb);
|
||||
void pcmk__serve_fenced_ipc(qb_ipcs_service_t **ipcs,
|
||||
struct qb_ipcs_service_handlers *cb);
|
||||
+void pcmk__serve_pacemakerd_ipc(qb_ipcs_service_t **ipcs,
|
||||
+ struct qb_ipcs_service_handlers *cb);
|
||||
qb_ipcs_service_t *pcmk__serve_controld_ipc(struct qb_ipcs_service_handlers *cb);
|
||||
|
||||
void pcmk__serve_based_ipc(qb_ipcs_service_t **ipcs_ro,
|
||||
diff --git a/lib/common/ipc_server.c b/lib/common/ipc_server.c
|
||||
index 4d3e954..b3aaf8e 100644
|
||||
--- a/lib/common/ipc_server.c
|
||||
+++ b/lib/common/ipc_server.c
|
||||
@@ -922,6 +922,32 @@ pcmk__serve_fenced_ipc(qb_ipcs_service_t **ipcs,
|
||||
}
|
||||
|
||||
/*!
|
||||
+ * \internal
|
||||
+ * \brief Add an IPC server to the main loop for the pacemakerd API
|
||||
+ *
|
||||
+ * \param[in] cb IPC callbacks
|
||||
+ *
|
||||
+ * \note This function exits with CRM_EX_OSERR if unable to create the servers.
|
||||
+ */
|
||||
+void
|
||||
+pcmk__serve_pacemakerd_ipc(qb_ipcs_service_t **ipcs,
|
||||
+ struct qb_ipcs_service_handlers *cb)
|
||||
+{
|
||||
+ *ipcs = mainloop_add_ipc_server(CRM_SYSTEM_MCP, QB_IPC_NATIVE, cb);
|
||||
+
|
||||
+ if (*ipcs == NULL) {
|
||||
+ crm_err("Couldn't start pacemakerd IPC server");
|
||||
+ crm_warn("Verify pacemaker and pacemaker_remote are not both enabled.");
|
||||
+ /* sub-daemons are observed by pacemakerd. Thus we exit CRM_EX_FATAL
|
||||
+ * if we want to prevent pacemakerd from restarting them.
|
||||
+ * With pacemakerd we leave the exit-code shown to e.g. systemd
|
||||
+ * to what it was prior to moving the code here from pacemakerd.c
|
||||
+ */
|
||||
+ crm_exit(CRM_EX_OSERR);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*!
|
||||
* \brief Check whether string represents a client name used by cluster daemons
|
||||
*
|
||||
* \param[in] name String to check
|
||||
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
|
||||
index d4d4ac3..e58fed2 100644
|
||||
--- a/tools/crm_mon.c
|
||||
+++ b/tools/crm_mon.c
|
||||
@@ -83,6 +83,8 @@ static gchar **processed_args = NULL;
|
||||
static time_t last_refresh = 0;
|
||||
crm_trigger_t *refresh_trigger = NULL;
|
||||
|
||||
+static gboolean on_remote_node = FALSE;
|
||||
+
|
||||
int interactive_fence_level = 0;
|
||||
|
||||
static pcmk__supported_format_t formats[] = {
|
||||
@@ -988,48 +990,63 @@ pacemakerd_status(void)
|
||||
}
|
||||
pcmk_register_ipc_callback(pacemakerd_api, pacemakerd_event_cb, (void *) &state);
|
||||
rc = pcmk_connect_ipc(pacemakerd_api, pcmk_ipc_dispatch_poll);
|
||||
- if (rc == pcmk_rc_ok) {
|
||||
- rc = pcmk_pacemakerd_api_ping(pacemakerd_api, crm_system_name);
|
||||
- if (rc == pcmk_rc_ok) {
|
||||
- rc = pcmk_poll_ipc(pacemakerd_api, options.reconnect_msec/2);
|
||||
+ switch (rc) {
|
||||
+ case pcmk_rc_ok:
|
||||
+ rc = pcmk_pacemakerd_api_ping(pacemakerd_api, crm_system_name);
|
||||
if (rc == pcmk_rc_ok) {
|
||||
- pcmk_dispatch_ipc(pacemakerd_api);
|
||||
- rc = ENOTCONN;
|
||||
- if ((output_format == mon_output_console) ||
|
||||
- (output_format == mon_output_plain)) {
|
||||
- switch (state) {
|
||||
- case pcmk_pacemakerd_state_running:
|
||||
- rc = pcmk_rc_ok;
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_starting_daemons:
|
||||
- print_as(output_format ,"Pacemaker daemons starting ...\n");
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_wait_for_ping:
|
||||
- print_as(output_format ,"Waiting for startup-trigger from SBD ...\n");
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_shutting_down:
|
||||
- print_as(output_format ,"Pacemaker daemons shutting down ...\n");
|
||||
- break;
|
||||
- case pcmk_pacemakerd_state_shutdown_complete:
|
||||
- /* assuming pacemakerd doesn't dispatch any pings after entering
|
||||
- * that state unless it is waiting for SBD
|
||||
- */
|
||||
- print_as(output_format ,"Pacemaker daemons shut down - reporting to SBD ...\n");
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- } else {
|
||||
- switch (state) {
|
||||
- case pcmk_pacemakerd_state_running:
|
||||
- rc = pcmk_rc_ok;
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
+ rc = pcmk_poll_ipc(pacemakerd_api, options.reconnect_msec/2);
|
||||
+ if (rc == pcmk_rc_ok) {
|
||||
+ pcmk_dispatch_ipc(pacemakerd_api);
|
||||
+ rc = ENOTCONN;
|
||||
+ if ((output_format == mon_output_console) ||
|
||||
+ (output_format == mon_output_plain)) {
|
||||
+ switch (state) {
|
||||
+ case pcmk_pacemakerd_state_running:
|
||||
+ rc = pcmk_rc_ok;
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_starting_daemons:
|
||||
+ print_as(output_format ,"Pacemaker daemons starting ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_wait_for_ping:
|
||||
+ print_as(output_format ,"Waiting for startup-trigger from SBD ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_shutting_down:
|
||||
+ print_as(output_format ,"Pacemaker daemons shutting down ...\n");
|
||||
+ break;
|
||||
+ case pcmk_pacemakerd_state_shutdown_complete:
|
||||
+ /* assuming pacemakerd doesn't dispatch any pings after entering
|
||||
+ * that state unless it is waiting for SBD
|
||||
+ */
|
||||
+ print_as(output_format ,"Pacemaker daemons shut down - reporting to SBD ...\n");
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ switch (state) {
|
||||
+ case pcmk_pacemakerd_state_running:
|
||||
+ rc = pcmk_rc_ok;
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
- }
|
||||
+ break;
|
||||
+ case EREMOTEIO:
|
||||
+ rc = pcmk_rc_ok;
|
||||
+ on_remote_node = TRUE;
|
||||
+#if CURSES_ENABLED
|
||||
+ /* just show this if refresh is gonna remove all traces */
|
||||
+ if (output_format == mon_output_console) {
|
||||
+ print_as(output_format ,
|
||||
+ "Running on remote-node waiting to be connected by cluster ...\n");
|
||||
+ }
|
||||
+#endif
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
}
|
||||
pcmk_free_ipc_api(pacemakerd_api);
|
||||
/* returning with ENOTCONN triggers a retry */
|
||||
@@ -1348,7 +1365,11 @@ handle_connection_failures(int rc)
|
||||
pcmk_rc_str(rc));
|
||||
rc = MON_STATUS_CRIT;
|
||||
} else if (rc == ENOTCONN) {
|
||||
- g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "Error: cluster is not available on this node");
|
||||
+ if (on_remote_node) {
|
||||
+ g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "Error: remote-node not connected to cluster");
|
||||
+ } else {
|
||||
+ g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "Error: cluster is not available on this node");
|
||||
+ }
|
||||
rc = pcmk_rc2exitc(rc);
|
||||
} else {
|
||||
g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_ERROR, "Connection to cluster failed: %s", pcmk_rc_str(rc));
|
||||
--
|
||||
1.8.3.1
|
||||
|
1676
SOURCES/036-crm_resource.patch
Normal file
1676
SOURCES/036-crm_resource.patch
Normal file
File diff suppressed because it is too large
Load Diff
6493
SOURCES/037-scheduler.patch
Normal file
6493
SOURCES/037-scheduler.patch
Normal file
File diff suppressed because it is too large
Load Diff
62
SOURCES/038-feature-set.patch
Normal file
62
SOURCES/038-feature-set.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From 98589d8e1ef9b57d806702b9968ff7e5560e9c8f Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lumens <clumens@redhat.com>
|
||||
Date: Fri, 12 Feb 2021 11:51:16 -0500
|
||||
Subject: [PATCH] Low: Fix a problem with crm_resource exit code handling.
|
||||
|
||||
If no output is produced but an error message is printed (like, when an
|
||||
inactive resource is provided on the command line), don't print the
|
||||
error message for the pcmk_rc_no_output error code. It's weird to see
|
||||
output and a message about no output at the same time.
|
||||
|
||||
Similarly, don't print an "Error: OK" message when usage is printed.
|
||||
---
|
||||
tools/crm_resource.c | 13 +++++++++----
|
||||
1 file changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
||||
index 7d2f0f6..29b0a04 100644
|
||||
--- a/tools/crm_resource.c
|
||||
+++ b/tools/crm_resource.c
|
||||
@@ -1534,9 +1534,9 @@ main(int argc, char **argv)
|
||||
|
||||
rc = pcmk__output_new(&out, args->output_ty, args->output_dest, argv);
|
||||
if (rc != pcmk_rc_ok) {
|
||||
- fprintf(stderr, "Error creating output format %s: %s\n",
|
||||
- args->output_ty, pcmk_rc_str(rc));
|
||||
exit_code = CRM_EX_ERROR;
|
||||
+ g_set_error(&error, PCMK__EXITC_ERROR, exit_code, "Error creating output format %s: %s",
|
||||
+ args->output_ty, pcmk_rc_str(rc));
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2039,7 +2039,12 @@ main(int argc, char **argv)
|
||||
*/
|
||||
|
||||
done:
|
||||
- if (rc != pcmk_rc_ok) {
|
||||
+ /* Don't do any of this for pcmk_rc_no_output (doesn't make sense to show an
|
||||
+ * error message for no output) or for CRM_EX_USAGE (we don't want to show
|
||||
+ * an "error: OK" message from pcmk_rc_str).
|
||||
+ */
|
||||
+ if ((rc != pcmk_rc_ok && rc != pcmk_rc_no_output) ||
|
||||
+ (exit_code != CRM_EX_OK && exit_code != CRM_EX_USAGE)) {
|
||||
if (rc == pcmk_rc_no_quorum) {
|
||||
g_prefix_error(&error, "To ignore quorum, use the force option.\n");
|
||||
}
|
||||
@@ -2054,10 +2059,10 @@ done:
|
||||
g_set_error(&error, PCMK__RC_ERROR, rc,
|
||||
"Error performing operation: %s", pcmk_rc_str(rc));
|
||||
}
|
||||
+ }
|
||||
|
||||
- if (exit_code == CRM_EX_OK) {
|
||||
- exit_code = pcmk_rc2exitc(rc);
|
||||
- }
|
||||
+ if (exit_code == CRM_EX_OK) {
|
||||
+ exit_code = pcmk_rc2exitc(rc);
|
||||
}
|
||||
|
||||
g_free(options.host_uname);
|
||||
--
|
||||
1.8.3.1
|
||||
|
36
SOURCES/100-default-to-syncing-with-sbd.patch
Normal file
36
SOURCES/100-default-to-syncing-with-sbd.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From 34b2d8ab82dcdf49535c74e6a580240455498759 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
||||
Date: Wed, 2 Dec 2020 22:51:33 +0100
|
||||
Subject: [PATCH] default to syncing with sbd
|
||||
|
||||
---
|
||||
lib/common/watchdog.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/common/watchdog.c b/lib/common/watchdog.c
|
||||
index 03ee7f1..bf5df18 100644
|
||||
--- a/lib/common/watchdog.c
|
||||
+++ b/lib/common/watchdog.c
|
||||
@@ -244,12 +244,16 @@ pcmk__get_sbd_timeout(void)
|
||||
bool
|
||||
pcmk__get_sbd_sync_resource_startup(void)
|
||||
{
|
||||
- static bool sync_resource_startup = false;
|
||||
+ static bool sync_resource_startup = true; // default overruled by env
|
||||
static bool checked_sync_resource_startup = false;
|
||||
|
||||
if (!checked_sync_resource_startup) {
|
||||
- sync_resource_startup =
|
||||
- crm_is_true(getenv("SBD_SYNC_RESOURCE_STARTUP"));
|
||||
+ gboolean ret = FALSE;
|
||||
+ const char *s = getenv("SBD_SYNC_RESOURCE_STARTUP");
|
||||
+
|
||||
+ if ((s != NULL) && (crm_str_to_boolean(s, &ret) > 0)) {
|
||||
+ sync_resource_startup = ret;
|
||||
+ }
|
||||
checked_sync_resource_startup = true;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -22,11 +22,11 @@
|
||||
## 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.0.4
|
||||
%global specversion 3
|
||||
%global pcmkversion 2.0.5
|
||||
%global specversion 8
|
||||
|
||||
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
|
||||
%global commit 2deceaa3ae1fbadd844f5c5b47fd33129fa2c227
|
||||
%global commit ba59be71228fed04f78ab374dfac748d314d0e89
|
||||
## 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 7
|
||||
@ -214,7 +214,6 @@
|
||||
}
|
||||
%endif
|
||||
|
||||
|
||||
# Keep sane profiling data if requested
|
||||
%if %{with profiling}
|
||||
|
||||
@ -234,7 +233,7 @@ License: GPLv2+ and LGPLv2+
|
||||
# initscript is Revised BSD
|
||||
License: GPLv2+ and LGPLv2+ and BSD
|
||||
%endif
|
||||
Url: http://www.clusterlabs.org
|
||||
Url: https://www.clusterlabs.org/
|
||||
Group: System Environment/Daemons
|
||||
|
||||
# Example: https://codeload.github.com/ClusterLabs/pacemaker/tar.gz/e91769e
|
||||
@ -249,14 +248,47 @@ Source0: https://codeload.github.com/%{github_owner}/%{name}/tar.gz/%{arch
|
||||
Source1: nagios-agents-metadata-%{nagios_hash}.tar.gz
|
||||
|
||||
# upstream commits
|
||||
Patch1: 001-rules.patch
|
||||
Patch2: 002-demote.patch
|
||||
Patch3: 003-trace.patch
|
||||
Patch4: 004-test.patch
|
||||
Patch5: 005-sysconfig.patch
|
||||
Patch1: 001-feature-set.patch
|
||||
Patch2: 002-feature-set.patch
|
||||
Patch3: 003-feature-set.patch
|
||||
Patch4: 004-feature-set.patch
|
||||
Patch5: 005-feature-set.patch
|
||||
Patch6: 006-digests.patch
|
||||
Patch7: 007-feature-set.patch
|
||||
Patch8: 008-digests.patch
|
||||
Patch9: 009-digests.patch
|
||||
Patch10: 010-feature-set.patch
|
||||
Patch11: 011-feature-set.patch
|
||||
Patch12: 012-feature-set.patch
|
||||
Patch13: 013-feature-set.patch
|
||||
Patch14: 014-feature-set.patch
|
||||
Patch15: 015-feature-set.patch
|
||||
Patch16: 016-feature-set.patch
|
||||
Patch17: 017-feature-set.patch
|
||||
Patch18: 018-rhbz1907726.patch
|
||||
Patch19: 019-rhbz1371576.patch
|
||||
Patch20: 020-rhbz1872376.patch
|
||||
Patch21: 021-rhbz1872376.patch
|
||||
Patch22: 022-rhbz1872376.patch
|
||||
Patch23: 023-rhbz1872376.patch
|
||||
Patch24: 024-rhbz1371576.patch
|
||||
Patch25: 025-feature-set.patch
|
||||
Patch26: 026-tests.patch
|
||||
Patch27: 027-crm_mon.patch
|
||||
Patch28: 028-crm_mon.patch
|
||||
Patch29: 029-crm_mon.patch
|
||||
Patch30: 030-crmadmin.patch
|
||||
Patch31: 031-cibsecret.patch
|
||||
Patch32: 032-rhbz1898457.patch
|
||||
Patch33: 033-cibsecret.patch
|
||||
Patch34: 034-crm_mon.patch
|
||||
Patch35: 035-crm_mon.patch
|
||||
Patch36: 036-crm_resource.patch
|
||||
Patch37: 037-scheduler.patch
|
||||
Patch38: 038-feature-set.patch
|
||||
|
||||
# downstream-only commits
|
||||
#Patch100: xxx.patch
|
||||
Patch100: 100-default-to-syncing-with-sbd.patch
|
||||
|
||||
Requires: resource-agents
|
||||
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
|
||||
@ -370,7 +402,10 @@ Group: System Environment/Daemons
|
||||
Requires(pre): %{pkgname_shadow_utils}
|
||||
Requires: %{name}-schemas = %{version}-%{release}
|
||||
# sbd 1.4.0+ supports the libpe_status API for pe_working_set_t
|
||||
Conflicts: sbd < 1.4.0
|
||||
# sbd 1.4.2+ supports startup/shutdown handshake via pacemakerd-api
|
||||
# and handshake defaults to enabled with rhel-builds
|
||||
# applying 100-default-to-syncing-with-sbd.patch
|
||||
Conflicts: sbd < 1.4.2
|
||||
|
||||
%description -n %{pkgname_pcmk_libs}
|
||||
Pacemaker is an advanced, scalable High-Availability cluster resource
|
||||
@ -515,9 +550,6 @@ monitor resources.
|
||||
|
||||
%build
|
||||
|
||||
# Early versions of autotools (e.g. RHEL <= 5) do not support --docdir
|
||||
export docdir=%{pcmk_docdir}
|
||||
|
||||
export systemdsystemunitdir=%{?_unitdir}%{!?_unitdir:no}
|
||||
|
||||
# RHEL changes pacemaker's concurrent-fencing default to true
|
||||
@ -951,6 +983,88 @@ exit 0
|
||||
%license %{nagios_name}-%{nagios_hash}/COPYING
|
||||
|
||||
%changelog
|
||||
* Mon Feb 15 2021 Ken Gaillot <kgaillot@redhat.com> - 2.0.5-8
|
||||
- Route cancellations through correct node when remote connectin is moving
|
||||
- Resolves: rhbz1928762
|
||||
|
||||
* Fri Feb 12 2021 Ken Gaillot <kgaillot@redhat.com> - 2.0.5-7
|
||||
- Do not introduce regression in crm_resource --locate
|
||||
- Resolves: rhbz1925681
|
||||
|
||||
* Wed Feb 3 2021 Ken Gaillot <kgaillot@redhat.com> - 2.0.5-6
|
||||
- crm_mon --daemonize should reconnect if cluster restarts
|
||||
- crm_mon should show more informative messages when cluster is starting
|
||||
- crm_mon should show rest of status if fencing history is unavailable
|
||||
- cibsecret now works on remote nodes (as long as name can be reached via ssh)
|
||||
- Stop remote nodes correctly when connection history is later than node history
|
||||
- Resolves: rhbz1466875
|
||||
- Resolves: rhbz1872490
|
||||
- Resolves: rhbz1880426
|
||||
- Resolves: rhbz1881537
|
||||
- Resolves: rhbz1898457
|
||||
|
||||
* Thu Jan 14 2021 Ken Gaillot <kgaillot@redhat.com> - 2.0.5-5
|
||||
- Allow non-critical resources that stop rather than make another resource move
|
||||
- Support crm_resource --digests option for showing operation digests
|
||||
- Clean-up of all resources should work from remote nodes
|
||||
- Resolves: rhbz1371576
|
||||
- Resolves: rhbz1872376
|
||||
- Resolves: rhbz1907726
|
||||
|
||||
* Wed Dec 2 2020 Klaus Wenninger <kwenning@redhat.com> - 2.0.5-4
|
||||
- Rebase on upstream 2.0.5 release
|
||||
- Make waiting to be pinged by sbd via pacemakerd-api the default
|
||||
- Resolves: rhbz1885645
|
||||
- Resolves: rhbz1873138
|
||||
|
||||
* Wed Nov 18 2020 Ken Gaillot <kgaillot@redhat.com> - 2.0.5-3
|
||||
- Rebase on upstream 2.0.5-rc3 release
|
||||
- Resolves: rhbz1885645
|
||||
|
||||
* Wed Oct 28 2020 Ken Gaillot <kgaillot@redhat.com> - 2.0.5-2
|
||||
- Rebase on upstream 2.0.5-rc2 release
|
||||
- Prevent ACL bypass (CVE-2020-25654)
|
||||
- Resolves: rhbz1885645
|
||||
- Resolves: rhbz1889582
|
||||
|
||||
* Tue Oct 20 2020 Ken Gaillot <kgaillot@redhat.com> - 2.0.5-1
|
||||
- crm_mon --resource option to filter output by resource
|
||||
- Avoid filling /dev/shm after frequent corosync errors
|
||||
- Allow configurable permissions for log files
|
||||
- Ensure ACL write permission always supersedes read
|
||||
- Use fence device monitor timeout for starts and probes
|
||||
- Allow type="integer" in rule expressions
|
||||
- Avoid error messages when running crm_node inside bundles
|
||||
- Avoid situation where promotion is not scheduled until next transition
|
||||
- crm_mon should show more clearly when an entire group is disabled
|
||||
- Rebase on upstream 2.0.5-rc1 release
|
||||
- Resolves: rhbz1300597
|
||||
- Resolves: rhbz1614166
|
||||
- Resolves: rhbz1647136
|
||||
- Resolves: rhbz1833173
|
||||
- Resolves: rhbz1856015
|
||||
- Resolves: rhbz1866573
|
||||
- Resolves: rhbz1874391
|
||||
- Resolves: rhbz1835717
|
||||
- Resolves: rhbz1748139
|
||||
- Resolves: rhbz1885645
|
||||
|
||||
* Thu Aug 20 2020 Ken Gaillot <kgaillot@redhat.com> - 2.0.4-6
|
||||
- Fix cibsecret bug when node name is different from hostname
|
||||
- Resolves: rhbz1870873
|
||||
|
||||
* Fri Jul 24 2020 Ken Gaillot <kgaillot@redhat.com> - 2.0.4-5
|
||||
- Synchronize start-up and shutdown with SBD
|
||||
- Resolves: rhbz1718324
|
||||
|
||||
* Wed Jul 22 2020 Ken Gaillot <kgaillot@redhat.com> - 2.0.4-4
|
||||
- Allow crm_node -l/-p options to work from Pacemaker Remote nodes
|
||||
- Correct action timeout value listed in log message
|
||||
- Fix regression in crm_mon --daemonize with HTML output
|
||||
- Resolves: rhbz1796824
|
||||
- Resolves: rhbz1856035
|
||||
- Resolves: rhbz1857728
|
||||
|
||||
* Thu Jun 25 2020 Ken Gaillot <kgaillot@redhat.com> - 2.0.4-3
|
||||
- Allow resource and operation defaults per resource or operation type
|
||||
- Rebase on upstream 2.0.4 final release
|
||||
|
Loading…
Reference in New Issue
Block a user