pacemaker/pacemaker-pengine-nvpair-id-ref.patch
Yan Gao 5b918bf0b1 - crmd: Correctly react to successful unfencing operations
- PE: Delay unfencing until after we know the state of all resources that require unfencing
- PE: Fencing devices default to only requiring quorum in order to start
- PE: Automatically re-unfence a node if the fencing device definition changes
- pengine: Only report 'migrate' in transition summary if migration is actually taking place
- crm_node: Set correct subsystem in node rm cache msg
- crm_node: Prevent use-after-free in tools_remove_node_cache()
- crmd: make resource ID case sensitive
- fencing: Correction of the registration from a difference.
- crm_report: Add support for ISO8601 time format in logs (bnc#870886)
- PE: Potential memory leak
- xml: Support resources that require unfencing
- crmd: make node_state erase correctly
- xml: Add the ability to have lightweight schema revisions
- xml: Split up the RelaxNG schema files so they're easier to version individually
- crm_get_msec: prevent integer overflow
- corosync: Reduce log severity for a redundant message (bnc#870624)
- attrd: Reduce log severity for normal messages (bnc#870624)
- cib: When data was old, it fixed so that the newest cib might not be acquired.
- crm_attribute: Default --lifetime to forever when using --node (bnc#870696)
- Upstream version cs: 76579e813b5aaa1972d400055233519f58bbc0c6

OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=123
2014-04-08 12:17:12 +00:00

170 lines
5.1 KiB
Diff

commit 3912538a8954158d44a57f23aa219c5529a170ab
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"
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/nodes-1.3.rng b/xml/nodes-1.3.rng
index c28b5df..1ded570 100644
--- a/xml/nodes-1.3.rng
+++ b/xml/nodes-1.3.rng
@@ -30,10 +30,10 @@
<zeroOrMore>
<choice>
<element name="instance_attributes">
- <externalRef href="nvset.rng"/>
+ <externalRef href="nvset-1.3.rng"/>
</element>
<element name="utilization">
- <externalRef href="nvset.rng"/>
+ <externalRef href="nvset-1.3.rng"/>
</element>
</choice>
</zeroOrMore>
diff --git a/xml/nvset-1.3.rng b/xml/nvset-1.3.rng
new file mode 100644
index 0000000..8f1696c
--- /dev/null
+++ b/xml/nvset-1.3.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.3.rng b/xml/resources-1.3.rng
index a3640d1..9faf9fc 100644
--- a/xml/resources-1.3.rng
+++ b/xml/resources-1.3.rng
@@ -53,7 +53,7 @@
<ref name="element-operations"/>
<zeroOrMore>
<element name="utilization">
- <externalRef href="nvset.rng"/>
+ <externalRef href="nvset-1.3.rng"/>
</element>
</zeroOrMore>
</interleave>
@@ -86,7 +86,7 @@
<ref name="element-operations"/>
<zeroOrMore>
<element name="utilization">
- <externalRef href="nvset.rng"/>
+ <externalRef href="nvset-1.3.rng"/>
</element>
</zeroOrMore>
</interleave>
@@ -144,10 +144,10 @@
<zeroOrMore>
<choice>
<element name="meta_attributes">
- <externalRef href="nvset.rng"/>
+ <externalRef href="nvset-1.3.rng"/>
</element>
<element name="instance_attributes">
- <externalRef href="nvset.rng"/>
+ <externalRef href="nvset-1.3.rng"/>
</element>
</choice>
</zeroOrMore>