|
|
0240e4 |
From 942efa4e8edcfdbdce42505c30c18cacd1d8fff0 Mon Sep 17 00:00:00 2001
|
|
|
0240e4 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
0240e4 |
Date: Tue, 26 Jan 2016 15:55:46 -0600
|
|
|
0240e4 |
Subject: [PATCH] Fix: attrd: ensure remote nodes are in correct peer cache
|
|
|
0240e4 |
|
|
|
0240e4 |
If attrd receives an update for an unknown node name, it assumes the unknown
|
|
|
0240e4 |
node is a cluster node, and adds it to the cluster peer cache.
|
|
|
0240e4 |
|
|
|
0240e4 |
Previously, if the name was later used for a remote node, that would prevent
|
|
|
0240e4 |
its attributes from being written to the CIB. Now, when an attribute is
|
|
|
0240e4 |
received for a remote node, attrd will purge any inactive cluster peer cache
|
|
|
0240e4 |
entry before adding the node to the remote peer cache.
|
|
|
0240e4 |
---
|
|
|
0240e4 |
attrd/commands.c | 22 +++++++++++++++++-----
|
|
|
0240e4 |
1 file changed, 17 insertions(+), 5 deletions(-)
|
|
|
0240e4 |
|
|
|
0240e4 |
diff --git a/attrd/commands.c b/attrd/commands.c
|
|
|
0240e4 |
index 28e4a81..b2cc83a 100644
|
|
|
0240e4 |
--- a/attrd/commands.c
|
|
|
0240e4 |
+++ b/attrd/commands.c
|
|
|
0240e4 |
@@ -634,6 +634,22 @@ static attribute_value_t *
|
|
|
0240e4 |
attrd_lookup_or_create_value(GHashTable *values, const char *host, xmlNode *xml)
|
|
|
0240e4 |
{
|
|
|
0240e4 |
attribute_value_t *v = g_hash_table_lookup(values, host);
|
|
|
0240e4 |
+ int is_remote = 0;
|
|
|
0240e4 |
+
|
|
|
0240e4 |
+ crm_element_value_int(xml, F_ATTRD_IS_REMOTE, &is_remote);
|
|
|
0240e4 |
+ if (is_remote) {
|
|
|
0240e4 |
+ /* If we previously assumed this node was an unseen cluster node,
|
|
|
0240e4 |
+ * remove its entry from the cluster peer cache.
|
|
|
0240e4 |
+ */
|
|
|
0240e4 |
+ crm_node_t *dup = crm_find_peer(0, host);
|
|
|
0240e4 |
+
|
|
|
0240e4 |
+ if (dup && (dup->uuid == NULL)) {
|
|
|
0240e4 |
+ reap_crm_member(0, host);
|
|
|
0240e4 |
+ }
|
|
|
0240e4 |
+
|
|
|
0240e4 |
+ /* Ensure this host is in the remote peer cache */
|
|
|
0240e4 |
+ crm_remote_peer_cache_add(host);
|
|
|
0240e4 |
+ }
|
|
|
0240e4 |
|
|
|
0240e4 |
if (v == NULL) {
|
|
|
0240e4 |
v = calloc(1, sizeof(attribute_value_t));
|
|
|
0240e4 |
@@ -642,11 +658,7 @@ attrd_lookup_or_create_value(GHashTable *values, const char *host, xmlNode *xml)
|
|
|
0240e4 |
v->nodename = strdup(host);
|
|
|
0240e4 |
CRM_ASSERT(v->nodename != NULL);
|
|
|
0240e4 |
|
|
|
0240e4 |
- crm_element_value_int(xml, F_ATTRD_IS_REMOTE, &v->is_remote);
|
|
|
0240e4 |
- if (v->is_remote == TRUE) {
|
|
|
0240e4 |
- crm_remote_peer_cache_add(host);
|
|
|
0240e4 |
- }
|
|
|
0240e4 |
-
|
|
|
0240e4 |
+ v->is_remote = is_remote;
|
|
|
0240e4 |
g_hash_table_replace(values, v->nodename, v);
|
|
|
0240e4 |
}
|
|
|
0240e4 |
return(v);
|
|
|
0240e4 |
--
|
|
|
0240e4 |
1.8.3.1
|
|
|
0240e4 |
|