pacemaker/SOURCES/004-feature-set.patch
2021-08-28 18:45:44 +00:00

772 lines
30 KiB
Diff

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