ecf1558079
- systemd: Prevent use-of-NULL when determining if an agent exists - xml: Fix segfault in TRACKING_CHANGES() - PE: Memory leak when updating cancel operations - xml: Prevent memory leak in xml _private field - pengine: Performance increase, stack allocated score2char - crm_report: Only gather dlm data if dlm_controld is running - Fix: memory leak found by valgrind was corrected. - Fencing: Add the ability to call stonith_api_time() from stonith_admin - Fencing: Pass the correct options when looking up the history by node name - cib: Ensure 'cibadmin -R/--replace' commands get replies - xml: Correctly initialize and find v1-style patch version numbers - crm_mon: Add -R switch to show clone details - Build: Install compatibility.h - fencing: Teach stonith-ng about finding device and topology changes in the v2 patch format - crm_report: Additional dlm detail - crm_report: Allow ssh alternatives to be used - crmd: Correctly recognise operation cancellations we initiated - crmd: Improved logging of transition cancellations - crmd: Correctly detect lrm refreshes - crmd: Ignore 'move' operations to the cib, we only care about content changes - PE: Ensure instance numbers are preserved for cloned templates - Bug cl#5196 - PE: Check values after expanding templates - crm_mon: Ensure resource attributes have been unpacked before displaying connectivity data - Upstream version cs: ca8234daf2bbb2d0fd2fb47cdbb6667f892081bb - pengine: Support id-ref in nvpair with optional "name" (FATE#316118) * pacemaker-pengine-nvpair-id-ref.patch * pacemaker-pengine-nvpair-id-ref-test.patch OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=111
144 lines
4.7 KiB
Diff
144 lines
4.7 KiB
Diff
commit 89b75046e67bfe58985a64db4cc29fc6c0784f44
|
|
Author: Gao,Yan <ygao@suse.com>
|
|
Date: Wed Jan 29 14:07:44 2014 +0800
|
|
|
|
Feature: pengine: Support id-ref in nvpair with optional "name" for resource instance attributes
|
|
|
|
If "name" isn't specified, it inherits the name from the referenced
|
|
nvpair.
|
|
|
|
diff --git a/lib/pengine/rules.c b/lib/pengine/rules.c
|
|
index f80aa47..626d7b2 100644
|
|
--- a/lib/pengine/rules.c
|
|
+++ b/lib/pengine/rules.c
|
|
@@ -607,7 +607,7 @@ sort_pairs(gconstpointer a, gconstpointer b)
|
|
}
|
|
|
|
static void
|
|
-populate_hash(xmlNode * nvpair_list, GHashTable * hash, gboolean overwrite)
|
|
+populate_hash(xmlNode * nvpair_list, GHashTable * hash, gboolean overwrite, xmlNode * top)
|
|
{
|
|
const char *name = NULL;
|
|
const char *value = NULL;
|
|
@@ -622,10 +622,18 @@ populate_hash(xmlNode * nvpair_list, GHashTable * hash, gboolean overwrite)
|
|
|
|
for (an_attr = __xml_first_child(list); an_attr != NULL; an_attr = __xml_next(an_attr)) {
|
|
if (crm_str_eq((const char *)an_attr->name, XML_CIB_TAG_NVPAIR, TRUE)) {
|
|
+ xmlNode *ref_nvpair = expand_idref(an_attr, top);
|
|
+
|
|
name = crm_element_value(an_attr, XML_NVPAIR_ATTR_NAME);
|
|
+ if (name == NULL) {
|
|
+ name = crm_element_value(ref_nvpair, XML_NVPAIR_ATTR_NAME);
|
|
+ }
|
|
|
|
crm_trace("Setting attribute: %s", name);
|
|
value = crm_element_value(an_attr, XML_NVPAIR_ATTR_VALUE);
|
|
+ if (value == NULL) {
|
|
+ value = crm_element_value(ref_nvpair, XML_NVPAIR_ATTR_VALUE);
|
|
+ }
|
|
|
|
if (name == NULL || value == NULL) {
|
|
continue;
|
|
@@ -657,6 +665,7 @@ struct unpack_data_s {
|
|
GHashTable *node_hash;
|
|
GHashTable *hash;
|
|
crm_time_t *now;
|
|
+ xmlNode *top;
|
|
};
|
|
|
|
static void
|
|
@@ -670,7 +679,7 @@ unpack_attr_set(gpointer data, gpointer user_data)
|
|
}
|
|
|
|
crm_trace("Adding attributes from %s", pair->name);
|
|
- populate_hash(pair->attr_set, unpack_data->hash, unpack_data->overwrite);
|
|
+ populate_hash(pair->attr_set, unpack_data->hash, unpack_data->overwrite, unpack_data->top);
|
|
}
|
|
|
|
void
|
|
@@ -717,6 +726,7 @@ unpack_instance_attributes(xmlNode * top, xmlNode * xml_obj, const char *set_nam
|
|
data.node_hash = node_hash;
|
|
data.now = now;
|
|
data.overwrite = overwrite;
|
|
+ data.top = top;
|
|
}
|
|
|
|
sorted = g_list_sort(unsorted, sort_pairs);
|
|
diff --git a/xml/Makefile.am b/xml/Makefile.am
|
|
index 4a7381b..eb99270 100644
|
|
--- a/xml/Makefile.am
|
|
+++ b/xml/Makefile.am
|
|
@@ -26,7 +26,7 @@ RNG_FILES = $(VERSIONED_RNG_FILES:%.rng=%-1.0.rng) \
|
|
$(VERSIONED_RNG_FILES:%.rng=%-1.1.rng) \
|
|
$(VERSIONED_RNG_FILES:%.rng=%-1.2.rng) \
|
|
pacemaker.rng versions.rng score.rng rule.rng nvset.rng \
|
|
- acls-1.1.rng acls-1.2.rng fencing.rng
|
|
+ acls-1.1.rng acls-1.2.rng fencing.rng nvset-nvpair-ref.rng
|
|
|
|
EXTRA_DIST = crm-1.0.dtd $(dtd_SCRIPTS)
|
|
dtd_SCRIPTS = crm.dtd $(RNG_FILES) upgrade06.xsl crm-transitional.dtd
|
|
diff --git a/xml/nvset-nvpair-ref.rng b/xml/nvset-nvpair-ref.rng
|
|
new file mode 100644
|
|
index 0000000..8f1696c
|
|
--- /dev/null
|
|
+++ b/xml/nvset-nvpair-ref.rng
|
|
@@ -0,0 +1,45 @@
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
+<!-- types: http://www.w3.org/TR/xmlschema-2/#dateTime -->
|
|
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
|
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
|
+ <start>
|
|
+ <ref name="element-nvset"/>
|
|
+ </start>
|
|
+
|
|
+ <define name="element-nvset">
|
|
+ <choice>
|
|
+ <attribute name="id-ref"><data type="IDREF"/></attribute>
|
|
+ <group>
|
|
+ <attribute name="id"><data type="ID"/></attribute>
|
|
+ <interleave>
|
|
+ <optional>
|
|
+ <externalRef href="rule.rng"/>
|
|
+ </optional>
|
|
+ <zeroOrMore>
|
|
+ <element name="nvpair">
|
|
+ <choice>
|
|
+ <group>
|
|
+ <attribute name="id-ref"><data type="IDREF"/></attribute>
|
|
+ <optional>
|
|
+ <attribute name="name"><text/></attribute>
|
|
+ </optional>
|
|
+ </group>
|
|
+ <group>
|
|
+ <attribute name="id"><data type="ID"/></attribute>
|
|
+ <attribute name="name"><text/></attribute>
|
|
+ <optional>
|
|
+ <attribute name="value"><text/></attribute>
|
|
+ </optional>
|
|
+ </group>
|
|
+ </choice>
|
|
+ </element>
|
|
+ </zeroOrMore>
|
|
+ <optional>
|
|
+ <externalRef href="score.rng"/>
|
|
+ </optional>
|
|
+ </interleave>
|
|
+ </group>
|
|
+ </choice>
|
|
+ </define>
|
|
+
|
|
+</grammar>
|
|
diff --git a/xml/resources-1.1.rng b/xml/resources-1.1.rng
|
|
index 81a8f82..3eb6824 100644
|
|
--- a/xml/resources-1.1.rng
|
|
+++ b/xml/resources-1.1.rng
|
|
@@ -145,7 +145,7 @@
|
|
<externalRef href="nvset.rng"/>
|
|
</element>
|
|
<element name="instance_attributes">
|
|
- <externalRef href="nvset.rng"/>
|
|
+ <externalRef href="nvset-nvpair-ref.rng"/>
|
|
</element>
|
|
</choice>
|
|
</zeroOrMore>
|