Skip to content

Commit 39aab7b

Browse files
committed
Fix: libpe_status: Add fake local node to all resources' allowed_nodes
This fixes a regression introduced by bf7ffcd. As of that commit, the fake local node is created after all resources have been unpacked. So it doesn't get added to resources' allowed_nodes tables. This prevents registration of fencing devices when the fencer receives a CIB diff that doesn't contain the local node. For example, the user may have replaced the CIB with a boilerplate configuration that has an empty nodes section. See the following pull requests from Hideo Yamauchi and their discussions: #3849 #3852 Thanks to Hideo for the report and finding the cause. Signed-off-by: Reid Wahl <[email protected]>
1 parent 6053d2f commit 39aab7b

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

lib/pengine/status.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,25 @@ cluster_status(pcmk_scheduler_t * scheduler)
167167
if ((scheduler->priv->local_node_name != NULL)
168168
&& (pcmk_find_node(scheduler,
169169
scheduler->priv->local_node_name) == NULL)) {
170-
crm_info("Creating a fake local node for %s",
171-
scheduler->priv->local_node_name);
172-
pe_create_node(scheduler->priv->local_node_name,
173-
scheduler->priv->local_node_name, NULL, 0, scheduler);
170+
const char *local_node_name = scheduler->priv->local_node_name;
171+
pcmk_node_t *node = NULL;
172+
173+
crm_info("Creating a fake local node for %s", local_node_name);
174+
node = pe_create_node(local_node_name, local_node_name, NULL, 0,
175+
scheduler);
176+
177+
for (GList *iter = scheduler->priv->resources; iter != NULL;
178+
iter = iter->next) {
179+
pcmk_resource_t *rsc = iter->data;
180+
pcmk_node_t *local = g_hash_table_lookup(rsc->priv->allowed_nodes,
181+
local_node_name);
182+
183+
if (local == NULL) {
184+
local = pe__copy_node(node);
185+
g_hash_table_insert(rsc->priv->allowed_nodes,
186+
(gpointer) local->priv->id, local);
187+
}
188+
}
174189
}
175190

176191
pcmk__set_scheduler_flags(scheduler, pcmk__sched_have_status);

0 commit comments

Comments
 (0)