Blame SOURCES/004-feature-set.patch

a216ed
From 9faa62f0701801f1d420462025e863d8ca3d6a06 Mon Sep 17 00:00:00 2001
a216ed
From: Chris Lumens <clumens@redhat.com>
a216ed
Date: Mon, 21 Sep 2020 14:19:19 -0400
a216ed
Subject: [PATCH 1/6] Fix: libcrmcommon: Automatically lower case XML list
a216ed
 names.
a216ed
a216ed
---
a216ed
 lib/common/output_xml.c | 10 ++++------
a216ed
 1 file changed, 4 insertions(+), 6 deletions(-)
a216ed
a216ed
diff --git a/lib/common/output_xml.c b/lib/common/output_xml.c
a216ed
index 1710fac..6a6ed6e 100644
a216ed
--- a/lib/common/output_xml.c
a216ed
+++ b/lib/common/output_xml.c
a216ed
@@ -50,7 +50,6 @@ typedef struct subst_s {
a216ed
 } subst_t;
a216ed
 
a216ed
 static subst_t substitutions[] = {
a216ed
-    { "Attributes",                     "attributes" },
a216ed
     { "Active Resources",               "resources" },
a216ed
     { "Full List of Resources",         "resources" },
a216ed
     { "Inactive Resources",             "resources" },
a216ed
@@ -61,8 +60,6 @@ static subst_t substitutions[] = {
a216ed
     { "Operations",                     "node_history" },
a216ed
     { "Negative Location Constraints",  "bans" },
a216ed
     { "Node Attributes",                "node_attributes" },
a216ed
-    { "Resources",                      "resources" },
a216ed
-    { "Tickets",                        "tickets" },
a216ed
 
a216ed
     { NULL, NULL }
a216ed
 };
a216ed
@@ -288,7 +285,7 @@ static void
a216ed
 xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plural_noun,
a216ed
                const char *format, ...) {
a216ed
     va_list ap;
a216ed
-    const char *name = NULL;
a216ed
+    char *name = NULL;
a216ed
     char *buf = NULL;
a216ed
     int len;
a216ed
 
a216ed
@@ -300,14 +297,14 @@ xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plura
a216ed
     if (substitute) {
a216ed
         for (subst_t *s = substitutions; s->from != NULL; s++) {
a216ed
             if (!strcmp(s->from, buf)) {
a216ed
-                name = s->to;
a216ed
+                name = g_strdup(s->to);
a216ed
                 break;
a216ed
             }
a216ed
         }
a216ed
     }
a216ed
 
a216ed
     if (name == NULL) {
a216ed
-        name = buf;
a216ed
+        name = g_ascii_strdown(buf, -1);
a216ed
     }
a216ed
 
a216ed
     if (legacy_xml || simple_list) {
a216ed
@@ -319,6 +316,7 @@ xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plura
a216ed
         xmlSetProp(list_node, (pcmkXmlStr) "name", (pcmkXmlStr) name);
a216ed
     }
a216ed
 
a216ed
+    g_free(name);
a216ed
     free(buf);
a216ed
 }
a216ed
 
a216ed
-- 
a216ed
1.8.3.1
a216ed
a216ed
a216ed
From 7a77441ae8d3ab943dfafebfc06b63402be323e1 Mon Sep 17 00:00:00 2001
a216ed
From: Chris Lumens <clumens@redhat.com>
a216ed
Date: Tue, 27 Oct 2020 12:49:45 -0400
a216ed
Subject: [PATCH 2/6] Feature: xml: Move resource-related XML schema into its
a216ed
 own file.
a216ed
a216ed
This allows it to be shared between the crm_mon and crm_resource
a216ed
schemas.  Also, this adds support for resource XML to crm_mon given that
a216ed
this is now technically possible as part of the library output.
a216ed
---
a216ed
 xml/Makefile.am           |   2 +-
a216ed
 xml/api/crm_mon-2.4.rng   | 311 ++++++++++++++++++++++++++++++++++++++++++++++
a216ed
 xml/api/resources-2.4.rng | 109 ++++++++++++++++
a216ed
 3 files changed, 421 insertions(+), 1 deletion(-)
a216ed
 create mode 100644 xml/api/crm_mon-2.4.rng
a216ed
 create mode 100644 xml/api/resources-2.4.rng
a216ed
a216ed
diff --git a/xml/Makefile.am b/xml/Makefile.am
a216ed
index 892c811..79ce900 100644
a216ed
--- a/xml/Makefile.am
a216ed
+++ b/xml/Makefile.am
a216ed
@@ -51,7 +51,7 @@ API_request_base	= command-output crm_mon crmadmin stonith_admin version
a216ed
 CIB_cfg_base		= options nodes resources constraints fencing acls tags alerts
a216ed
 
a216ed
 # Names of all schemas (including top level and those included by others)
a216ed
-API_base		= $(API_request_base) fence-event item status
a216ed
+API_base		= $(API_request_base) fence-event item resources status
a216ed
 CIB_base		= cib $(CIB_cfg_base) status score rule nvset
a216ed
 
a216ed
 # Static schema files and transforms (only CIB has transforms)
a216ed
diff --git a/xml/api/crm_mon-2.4.rng b/xml/api/crm_mon-2.4.rng
a216ed
new file mode 100644
a216ed
index 0000000..88973a4
a216ed
--- /dev/null
a216ed
+++ b/xml/api/crm_mon-2.4.rng
a216ed
@@ -0,0 +1,311 @@
a216ed
+
a216ed
+
a216ed
+         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
a216ed
+
a216ed
+    <start>
a216ed
+        <ref name="element-crm-mon"/>
a216ed
+    </start>
a216ed
+
a216ed
+    <define name="element-crm-mon">
a216ed
+        <optional>
a216ed
+            <ref name="element-summary" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="nodes-list" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="resources-list" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="node-attributes-list" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="node-history-list" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="failures-list" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="fence-event-list" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="tickets-list" />
a216ed
+        </optional>
a216ed
+        <optional>
a216ed
+            <ref name="bans-list" />
a216ed
+        </optional>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-summary">
a216ed
+        <element name="summary">
a216ed
+            <optional>
a216ed
+                <element name="stack">
a216ed
+                    <attribute name="type"> <text /> </attribute>
a216ed
+                </element>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <element name="current_dc">
a216ed
+                    <attribute name="present"> <data type="boolean" /> </attribute>
a216ed
+                    <optional>
a216ed
+                        <group>
a216ed
+                            <attribute name="version"> <text /> </attribute>
a216ed
+                            <attribute name="name"> <text /> </attribute>
a216ed
+                            <attribute name="id"> <text /> </attribute>
a216ed
+                            <attribute name="with_quorum"> <data type="boolean" /> </attribute>
a216ed
+                        </group>
a216ed
+                    </optional>
a216ed
+                </element>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <element name="last_update">
a216ed
+                    <attribute name="time"> <text /> </attribute>
a216ed
+                </element>
a216ed
+                <element name="last_change">
a216ed
+                    <attribute name="time"> <text /> </attribute>
a216ed
+                    <attribute name="user"> <text /> </attribute>
a216ed
+                    <attribute name="client"> <text /> </attribute>
a216ed
+                    <attribute name="origin"> <text /> </attribute>
a216ed
+                </element>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <element name="nodes_configured">
a216ed
+                    <attribute name="number"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                </element>
a216ed
+                <element name="resources_configured">
a216ed
+                    <attribute name="number"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    <attribute name="disabled"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    <attribute name="blocked"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                </element>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <element name="cluster_options">
a216ed
+                    <attribute name="stonith-enabled"> <data type="boolean" /> </attribute>
a216ed
+                    <attribute name="symmetric-cluster"> <data type="boolean" /> </attribute>
a216ed
+                    <attribute name="no-quorum-policy"> <text /> </attribute>
a216ed
+                    <attribute name="maintenance-mode"> <data type="boolean" /> </attribute>
a216ed
+                    <attribute name="stop-all-resources"> <data type="boolean" /> </attribute>
a216ed
+                </element>
a216ed
+            </optional>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="resources-list">
a216ed
+        <element name="resources">
a216ed
+            <zeroOrMore>
a216ed
+                <externalRef href="resources-2.4.rng" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="nodes-list">
a216ed
+        <element name="nodes">
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-full-node" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="node-attributes-list">
a216ed
+        <element name="node_attributes">
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-node-with-attributes" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="node-history-list">
a216ed
+        <element name="node_history">
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-node-history" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="failures-list">
a216ed
+        <element name="failures">
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-failure" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="fence-event-list">
a216ed
+        <element name="fence_history">
a216ed
+            <optional>
a216ed
+                <attribute name="status"> <data type="integer" /> </attribute>
a216ed
+            </optional>
a216ed
+            <zeroOrMore>
a216ed
+                <externalRef href="fence-event-2.0.rng" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="tickets-list">
a216ed
+        <element name="tickets">
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-ticket" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="bans-list">
a216ed
+        <element name="bans">
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-ban" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-full-node">
a216ed
+        <element name="node">
a216ed
+            <attribute name="name"> <text/> </attribute>
a216ed
+            <attribute name="id"> <text/> </attribute>
a216ed
+            <attribute name="online"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="standby"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="standby_onfail"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="maintenance"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="pending"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="unclean"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="shutdown"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="expected_up"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="is_dc"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="resources_running"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+            <attribute name="type">
a216ed
+                <choice>
a216ed
+                    <value>unknown</value>
a216ed
+                    <value>member</value>
a216ed
+                    <value>remote</value>
a216ed
+                    <value>ping</value>
a216ed
+                </choice>
a216ed
+            </attribute>
a216ed
+            <optional>
a216ed
+                
a216ed
+                     "container_id" while later versions use "id_as_resource" -->
a216ed
+                <choice>
a216ed
+                    <attribute name="container_id"> <text/> </attribute>
a216ed
+                    <attribute name="id_as_resource"> <text/> </attribute>
a216ed
+                </choice>
a216ed
+            </optional>
a216ed
+            <externalRef href="resources-2.4.rng" />
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-node-with-attributes">
a216ed
+        <element name="node">
a216ed
+            <attribute name="name"> <text /> </attribute>
a216ed
+            <zeroOrMore>
a216ed
+                <element name="attribute">
a216ed
+                    <attribute name="name"> <text /> </attribute>
a216ed
+                    <attribute name="value"> <text /> </attribute>
a216ed
+                    <optional>
a216ed
+                        <attribute name="expected"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    </optional>
a216ed
+                </element>
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-node-history">
a216ed
+        <element name="node">
a216ed
+            <attribute name="name"> <text /> </attribute>
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-resource-history" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-resource-history">
a216ed
+        <element name="resource_history">
a216ed
+            <attribute name="id"> <text /> </attribute>
a216ed
+            <attribute name="orphan"> <data type="boolean" /> </attribute>
a216ed
+            <optional>
a216ed
+                <group>
a216ed
+                    <attribute name="migration-threshold"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    <optional>
a216ed
+                        <attribute name="fail-count"> <text /> </attribute>
a216ed
+                    </optional>
a216ed
+                    <optional>
a216ed
+                        <attribute name="last-failure"> <text /> </attribute>
a216ed
+                    </optional>
a216ed
+                </group>
a216ed
+            </optional>
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-operation-history" />
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-operation-history">
a216ed
+        <element name="operation_history">
a216ed
+            <attribute name="call"> <text /> </attribute>
a216ed
+            <attribute name="task"> <text /> </attribute>
a216ed
+            <optional>
a216ed
+                <attribute name="interval"> <text /> </attribute>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <attribute name="last-rc-change"> <text /> </attribute>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <attribute name="last-run"> <text /> </attribute>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <attribute name="exec-time"> <text /> </attribute>
a216ed
+            </optional>
a216ed
+            <optional>
a216ed
+                <attribute name="queue-time"> <text /> </attribute>
a216ed
+            </optional>
a216ed
+            <attribute name="rc"> <data type="integer" /> </attribute>
a216ed
+            <attribute name="rc_text"> <text /> </attribute>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-failure">
a216ed
+        <element name="failure">
a216ed
+            <choice>
a216ed
+                <attribute name="op_key"> <text/> </attribute>
a216ed
+                <attribute name="id"> <text/> </attribute>
a216ed
+            </choice>
a216ed
+            <attribute name="node"> <text /> </attribute>
a216ed
+            <attribute name="exitstatus"> <text /> </attribute>
a216ed
+            <attribute name="exitreason"> <text /> </attribute>
a216ed
+            <attribute name="exitcode"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+            <attribute name="call"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+            <attribute name="status"> <text /> </attribute>
a216ed
+            <optional>
a216ed
+                <group>
a216ed
+                    <attribute name="last-rc-change"> <text /> </attribute>
a216ed
+                    <attribute name="queued"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    <attribute name="exec"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    <attribute name="interval"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    <attribute name="task"> <text /> </attribute>
a216ed
+                </group>
a216ed
+            </optional>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-ticket">
a216ed
+        <element name="ticket">
a216ed
+            <attribute name="id"> <text /> </attribute>
a216ed
+            <attribute name="status">
a216ed
+                <choice>
a216ed
+                    <value>granted</value>
a216ed
+                    <value>revoked</value>
a216ed
+                </choice>
a216ed
+            </attribute>
a216ed
+            <attribute name="standby"> <data type="boolean" /> </attribute>
a216ed
+            <optional>
a216ed
+                <attribute name="last-granted"> <text /> </attribute>
a216ed
+            </optional>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-ban">
a216ed
+        <element name="ban">
a216ed
+            <attribute name="id"> <text /> </attribute>
a216ed
+            <attribute name="resource"> <text /> </attribute>
a216ed
+            <attribute name="node"> <text /> </attribute>
a216ed
+            <attribute name="weight"> <data type="integer" /> </attribute>
a216ed
+            <attribute name="master_only"> <data type="boolean" /> </attribute>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+</grammar>
a216ed
diff --git a/xml/api/resources-2.4.rng b/xml/api/resources-2.4.rng
a216ed
new file mode 100644
a216ed
index 0000000..e279583
a216ed
--- /dev/null
a216ed
+++ b/xml/api/resources-2.4.rng
a216ed
@@ -0,0 +1,109 @@
a216ed
+
a216ed
+
a216ed
+         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
a216ed
+
a216ed
+    <start>
a216ed
+        <ref name="element-resource-list"/>
a216ed
+    </start>
a216ed
+
a216ed
+    <define name="element-resource-list">
a216ed
+        <interleave>
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-bundle" />
a216ed
+            </zeroOrMore>
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-clone" />
a216ed
+            </zeroOrMore>
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-group" />
a216ed
+            </zeroOrMore>
a216ed
+            <zeroOrMore>
a216ed
+                <ref name="element-resource" />
a216ed
+            </zeroOrMore>
a216ed
+        </interleave>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-bundle">
a216ed
+        <element name="bundle">
a216ed
+            <attribute name="id"> <text/> </attribute>
a216ed
+            <attribute name="type">
a216ed
+                <choice>
a216ed
+                    <value>docker</value>
a216ed
+                    <value>rkt</value>
a216ed
+                    <value>podman</value>
a216ed
+                </choice>
a216ed
+            </attribute>
a216ed
+            <attribute name="image"> <text/> </attribute>
a216ed
+            <attribute name="unique"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="managed"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="failed"> <data type="boolean" /> </attribute>
a216ed
+            <zeroOrMore>
a216ed
+                <element name="replica">
a216ed
+                    <attribute name="id"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+                    <zeroOrMore>
a216ed
+                        <ref name="element-resource" />
a216ed
+                    </zeroOrMore>
a216ed
+                </element>
a216ed
+            </zeroOrMore>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-clone">
a216ed
+        <element name="clone">
a216ed
+            <attribute name="id"> <text/> </attribute>
a216ed
+            <attribute name="multi_state"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="unique"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="managed"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="disabled"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="failed"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="failure_ignored"> <data type="boolean" /> </attribute>
a216ed
+            <optional>
a216ed
+                <attribute name="target_role"> <text/> </attribute>
a216ed
+            </optional>
a216ed
+            <ref name="element-resource-list" />
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-group">
a216ed
+        <element name="group">
a216ed
+            <attribute name="id"> <text/> </attribute>
a216ed
+            <attribute name="number_resources"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+            <attribute name="managed"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="disabled"> <data type="boolean" /> </attribute>
a216ed
+            <ref name="element-resource-list" />
a216ed
+        </element>
a216ed
+    </define>
a216ed
+
a216ed
+    <define name="element-resource">
a216ed
+        <element name="resource">
a216ed
+            <attribute name="id"> <text/> </attribute>
a216ed
+            <attribute name="resource_agent"> <text/> </attribute>
a216ed
+            <attribute name="role"> <text/> </attribute>
a216ed
+            <optional>
a216ed
+                <attribute name="target_role"> <text/> </attribute>
a216ed
+            </optional>
a216ed
+            <attribute name="active"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="orphaned"> <data type="boolean" /> </attribute>
a216ed
+            <optional>
a216ed
+                <attribute name="blocked"> <data type="boolean" /> </attribute>
a216ed
+            </optional>
a216ed
+            <attribute name="managed"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="failed"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="failure_ignored"> <data type="boolean" /> </attribute>
a216ed
+            <attribute name="nodes_running_on"> <data type="nonNegativeInteger" />  </attribute>
a216ed
+            <optional>
a216ed
+                <attribute name="pending"> <text/> </attribute>
a216ed
+            </optional>
a216ed
+            <zeroOrMore>
a216ed
+                <element name="node">
a216ed
+                    <attribute name="name"> <text/> </attribute>
a216ed
+                    <attribute name="id"> <text/> </attribute>
a216ed
+                    <attribute name="cached"> <data type="boolean" /> </attribute>
a216ed
+                </element>
a216ed
+            </zeroOrMore>
a216ed
+            <optional>
a216ed
+                <element name="xml"> <text/> </element>
a216ed
+            </optional>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+</grammar>
a216ed
-- 
a216ed
1.8.3.1
a216ed
a216ed
a216ed
From 814eb921cd429692220f33722c9bc061266bd838 Mon Sep 17 00:00:00 2001
a216ed
From: Chris Lumens <clumens@redhat.com>
a216ed
Date: Thu, 29 Oct 2020 14:45:02 -0400
a216ed
Subject: [PATCH 3/6] Feature: xml: Add a generic list XML schema file.
a216ed
a216ed
Formatted output supports a generic list structure that isn't used in
a216ed
too many places at the moment, but it could be getting used more in the
a216ed
future.  It's also really easy to have a schema for this piece of XML.
a216ed
---
a216ed
 xml/Makefile.am              |  7 ++++++-
a216ed
 xml/api/generic-list-2.4.rng | 21 +++++++++++++++++++++
a216ed
 2 files changed, 27 insertions(+), 1 deletion(-)
a216ed
 create mode 100644 xml/api/generic-list-2.4.rng
a216ed
a216ed
diff --git a/xml/Makefile.am b/xml/Makefile.am
a216ed
index 79ce900..2f99f1c 100644
a216ed
--- a/xml/Makefile.am
a216ed
+++ b/xml/Makefile.am
a216ed
@@ -44,6 +44,11 @@ version_pairs_last = $(wordlist \
a216ed
 			    ),$(1),$(2) \
a216ed
 			  )
a216ed
 
a216ed
+# NOTE: All files in API_request_base, CIB_cfg_base, API_base, and CIB_base
a216ed
+# need to start with a unique prefix.  These variables all get iterated over
a216ed
+# and globbed, and two files starting with the same prefix will cause
a216ed
+# problems.
a216ed
+
a216ed
 # Names of API schemas that form the choices for pacemaker-result content
a216ed
 API_request_base	= command-output crm_mon crmadmin stonith_admin version
a216ed
 
a216ed
@@ -51,7 +56,7 @@ API_request_base	= command-output crm_mon crmadmin stonith_admin version
a216ed
 CIB_cfg_base		= options nodes resources constraints fencing acls tags alerts
a216ed
 
a216ed
 # Names of all schemas (including top level and those included by others)
a216ed
-API_base		= $(API_request_base) fence-event item resources status
a216ed
+API_base		= $(API_request_base) fence-event generic-list item resources status
a216ed
 CIB_base		= cib $(CIB_cfg_base) status score rule nvset
a216ed
 
a216ed
 # Static schema files and transforms (only CIB has transforms)
a216ed
diff --git a/xml/api/generic-list-2.4.rng b/xml/api/generic-list-2.4.rng
a216ed
new file mode 100644
a216ed
index 0000000..fee93a9
a216ed
--- /dev/null
a216ed
+++ b/xml/api/generic-list-2.4.rng
a216ed
@@ -0,0 +1,21 @@
a216ed
+
a216ed
+
a216ed
+         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
a216ed
+
a216ed
+    <start>
a216ed
+        <ref name="generic-list"/>
a216ed
+    </start>
a216ed
+
a216ed
+    <define name="generic-list">
a216ed
+        <element name="list">
a216ed
+            <attribute name="name"> <text /> </attribute>
a216ed
+            <attribute name="count"> <data type="nonNegativeInteger" /> </attribute>
a216ed
+            <choice>
a216ed
+                <empty/>
a216ed
+                <oneOrMore>
a216ed
+                    <externalRef href="item-1.1.rng"/>
a216ed
+                </oneOrMore>
a216ed
+            </choice>
a216ed
+        </element>
a216ed
+    </define>
a216ed
+</grammar>
a216ed
-- 
a216ed
1.8.3.1
a216ed
a216ed
a216ed
From 316b6f66ca5425093503c51c2f8738922287ebca Mon Sep 17 00:00:00 2001
a216ed
From: Chris Lumens <clumens@redhat.com>
a216ed
Date: Wed, 16 Sep 2020 15:59:34 -0400
a216ed
Subject: [PATCH 4/6] Fix: tools: Save the optarg parameter for
a216ed
 --list-ocf-alternatives.
a216ed
a216ed
We need this so it can be added to the XML output of crm_resource.
a216ed
---
a216ed
 tools/crm_resource.c | 4 +---
a216ed
 1 file changed, 1 insertion(+), 3 deletions(-)
a216ed
a216ed
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
a216ed
index 6573ad5..acaddc0 100644
a216ed
--- a/tools/crm_resource.c
a216ed
+++ b/tools/crm_resource.c
a216ed
@@ -720,9 +720,7 @@ list_alternatives_cb(const gchar *option_name, const gchar *optarg,
a216ed
                      gpointer data, GError **error)
a216ed
 {
a216ed
     SET_COMMAND(cmd_list_alternatives);
a216ed
-    options.require_cib = FALSE;
a216ed
-    options.require_dataset = FALSE;
a216ed
-    options.require_resource = FALSE;
a216ed
+    get_agent_spec(optarg);
a216ed
     return TRUE;
a216ed
 }
a216ed
 
a216ed
-- 
a216ed
1.8.3.1
a216ed
a216ed
a216ed
From c063ce9b193f2022611e651c13afcb3ceb5969e3 Mon Sep 17 00:00:00 2001
a216ed
From: Chris Lumens <clumens@redhat.com>
a216ed
Date: Wed, 2 Sep 2020 16:20:10 -0400
a216ed
Subject: [PATCH 5/6] Fix: scheduler: Use the default format handler in a few
a216ed
 more places.
a216ed
a216ed
---
a216ed
 lib/pengine/pe_output.c | 8 ++------
a216ed
 1 file changed, 2 insertions(+), 6 deletions(-)
a216ed
a216ed
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
a216ed
index d0f96f4..9d43e5f 100644
a216ed
--- a/lib/pengine/pe_output.c
a216ed
+++ b/lib/pengine/pe_output.c
a216ed
@@ -1847,9 +1847,7 @@ static pcmk__message_entry_t fmt_functions[] = {
a216ed
     { "cluster-times", "log", pe__cluster_times_text },
a216ed
     { "cluster-times", "text", pe__cluster_times_text },
a216ed
     { "cluster-times", "xml", pe__cluster_times_xml },
a216ed
-    { "failed-action", "html", pe__failed_action_text },
a216ed
-    { "failed-action", "log", pe__failed_action_text },
a216ed
-    { "failed-action", "text", pe__failed_action_text },
a216ed
+    { "failed-action", "default", pe__failed_action_text },
a216ed
     { "failed-action", "xml", pe__failed_action_xml },
a216ed
     { "group", "xml",  pe__group_xml },
a216ed
     { "group", "html",  pe__group_html },
a216ed
@@ -1868,9 +1866,7 @@ static pcmk__message_entry_t fmt_functions[] = {
a216ed
     { "node-attribute", "log", pe__node_attribute_text },
a216ed
     { "node-attribute", "text", pe__node_attribute_text },
a216ed
     { "node-attribute", "xml", pe__node_attribute_xml },
a216ed
-    { "op-history", "html", pe__op_history_text },
a216ed
-    { "op-history", "log", pe__op_history_text },
a216ed
-    { "op-history", "text", pe__op_history_text },
a216ed
+    { "op-history", "default", pe__op_history_text },
a216ed
     { "op-history", "xml", pe__op_history_xml },
a216ed
     { "primitive", "xml",  pe__resource_xml },
a216ed
     { "primitive", "html",  pe__resource_html },
a216ed
-- 
a216ed
1.8.3.1
a216ed
a216ed
a216ed
From a32b99f5fd09ec15dbba6785c5d8dc2e220417a3 Mon Sep 17 00:00:00 2001
a216ed
From: Chris Lumens <clumens@redhat.com>
a216ed
Date: Thu, 3 Sep 2020 10:23:16 -0400
a216ed
Subject: [PATCH 6/6] Refactor: scheduler: Expose native_output_string as
a216ed
 pcmk__native_output_string.
a216ed
a216ed
The plan is that this function can be used to help build the string that
a216ed
is output for each line of "crm_resource -o" output.  It appears that
a216ed
output only happens for primitive resources.  However, I've added a
a216ed
check at the beginning just in case it's called for some other type of
a216ed
resource.
a216ed
---
a216ed
 include/crm/pengine/internal.h |  3 +++
a216ed
 lib/pengine/native.c           | 24 ++++++++++++++----------
a216ed
 2 files changed, 17 insertions(+), 10 deletions(-)
a216ed
a216ed
diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h
a216ed
index abe7a76..d658e86 100644
a216ed
--- a/include/crm/pengine/internal.h
a216ed
+++ b/include/crm/pengine/internal.h
a216ed
@@ -243,6 +243,9 @@ void clone_print(pe_resource_t * rsc, const char *pre_text, long options, void *
a216ed
 void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options,
a216ed
                       void *print_data);
a216ed
 
a216ed
+gchar * pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
a216ed
+                                   long options, const char *target_role, bool show_nodes);
a216ed
+
a216ed
 int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name
a216ed
                          , size_t pairs_count, ...);
a216ed
 char *pe__node_display_name(pe_node_t *node, bool print_detail);
a216ed
diff --git a/lib/pengine/native.c b/lib/pengine/native.c
a216ed
index 8f0c5c9..bf1f5c0 100644
a216ed
--- a/lib/pengine/native.c
a216ed
+++ b/lib/pengine/native.c
a216ed
@@ -570,17 +570,21 @@ add_output_node(GString *s, const char *node, bool have_nodes)
a216ed
  * \return Newly allocated string description of resource
a216ed
  * \note Caller must free the result with g_free().
a216ed
  */
a216ed
-static gchar *
a216ed
-native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
a216ed
-                     long options, const char *target_role, bool show_nodes)
a216ed
+gchar *
a216ed
+pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
a216ed
+                           long options, const char *target_role, bool show_nodes)
a216ed
 {
a216ed
     const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
a216ed
     const char *provider = NULL;
a216ed
     const char *kind = crm_element_value(rsc->xml, XML_ATTR_TYPE);
a216ed
-    char *retval = NULL;
a216ed
+    gchar *retval = NULL;
a216ed
     GString *outstr = NULL;
a216ed
     bool have_flags = false;
a216ed
 
a216ed
+    if (rsc->variant != pe_native) {
a216ed
+        return NULL;
a216ed
+    }
a216ed
+
a216ed
     CRM_CHECK(name != NULL, name = "unknown");
a216ed
     CRM_CHECK(kind != NULL, kind = "unknown");
a216ed
     CRM_CHECK(class != NULL, class = "unknown");
a216ed
@@ -758,8 +762,8 @@ pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc,
a216ed
     }
a216ed
 
a216ed
     {
a216ed
-        gchar *s = native_output_string(rsc, name, node, options, target_role,
a216ed
-                                        true);
a216ed
+        gchar *s = pcmk__native_output_string(rsc, name, node, options,
a216ed
+                                              target_role, true);
a216ed
 
a216ed
         list_node = pcmk__output_create_html_node(out, "li", NULL, NULL, NULL);
a216ed
         pcmk_create_html_node(list_node, "span", NULL, cl, s);
a216ed
@@ -826,8 +830,8 @@ pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc,
a216ed
     }
a216ed
 
a216ed
     {
a216ed
-        gchar *s = native_output_string(rsc, name, node, options, target_role,
a216ed
-                                        true);
a216ed
+        gchar *s = pcmk__native_output_string(rsc, name, node, options,
a216ed
+                                              target_role, true);
a216ed
 
a216ed
         out->list_item(out, NULL, "%s", s);
a216ed
         g_free(s);
a216ed
@@ -923,8 +927,8 @@ common_print(pe_resource_t * rsc, const char *pre_text, const char *name, pe_nod
a216ed
     }
a216ed
 
a216ed
     {
a216ed
-        gchar *resource_s = native_output_string(rsc, name, node, options,
a216ed
-                                                 target_role, false);
a216ed
+        gchar *resource_s = pcmk__native_output_string(rsc, name, node, options,
a216ed
+                                                       target_role, false);
a216ed
         status_print("%s%s", (pre_text? pre_text : ""), resource_s);
a216ed
         g_free(resource_s);
a216ed
     }
a216ed
-- 
a216ed
1.8.3.1
a216ed