Skip to content

Commit 776441d

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 776441d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/pengine/status.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,22 @@ 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+
pcmk_node_t *node = NULL;
171+
170172
crm_info("Creating a fake local node for %s",
171173
scheduler->priv->local_node_name);
172-
pe_create_node(scheduler->priv->local_node_name,
173-
scheduler->priv->local_node_name, NULL, 0, scheduler);
174+
node = pe_create_node(scheduler->priv->local_node_name,
175+
scheduler->priv->local_node_name, NULL, 0,
176+
scheduler);
177+
178+
for (GList *iter = scheduler->priv->resources; iter != NULL;
179+
iter = iter->next) {
180+
pcmk_resource_t *rsc = iter->data;
181+
pcmk_node_t *copy = pe__copy_node(node);
182+
183+
g_hash_table_insert(rsc->priv->allowed_nodes,
184+
(gpointer) copy->priv->id, copy);
185+
}
174186
}
175187

176188
pcmk__set_scheduler_flags(scheduler, pcmk__sched_have_status);

0 commit comments

Comments
 (0)