diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h index 1e5aee1..9f4e28a 100644 --- a/include/crm/pengine/internal.h +++ b/include/crm/pengine/internal.h @@ -545,9 +545,11 @@ int pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc, const char int pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, long options); pe_resource_t *pe__find_bundle_replica(const pe_resource_t *bundle, const pe_node_t *node); -bool pe__bundle_needs_remote_name(pe_resource_t *rsc); -const char *pe__add_bundle_remote_name(pe_resource_t *rsc, xmlNode *xml, - const char *field); +bool pe__bundle_needs_remote_name(pe_resource_t *rsc, + pe_working_set_t *data_set); +const char *pe__add_bundle_remote_name(pe_resource_t *rsc, + pe_working_set_t *data_set, + xmlNode *xml, const char *field); const char *pe_node_attribute_calculated(const pe_node_t *node, const char *name, const pe_resource_t *rsc); diff --git a/lib/pacemaker/pcmk_sched_allocate.c b/lib/pacemaker/pcmk_sched_allocate.c index a0fb5ab..22f284a 100644 --- a/lib/pacemaker/pcmk_sched_allocate.c +++ b/lib/pacemaker/pcmk_sched_allocate.c @@ -470,7 +470,7 @@ check_actions_for(xmlNode * rsc_entry, pe_resource_t * rsc, pe_node_t * node, pe * has changed, clear any fail count so they can be retried fresh. */ - if (pe__bundle_needs_remote_name(rsc)) { + if (pe__bundle_needs_remote_name(rsc, data_set)) { /* We haven't allocated resources to nodes yet, so if the * REMOTE_CONTAINER_HACK is used, we may calculate the digest * based on the literal "#uname" value rather than the properly diff --git a/lib/pacemaker/pcmk_sched_bundle.c b/lib/pacemaker/pcmk_sched_bundle.c index ac9219c..4f41b70 100644 --- a/lib/pacemaker/pcmk_sched_bundle.c +++ b/lib/pacemaker/pcmk_sched_bundle.c @@ -911,7 +911,7 @@ pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t * data_set) CRM_ASSERT(replica); if (replica->remote && replica->container - && pe__bundle_needs_remote_name(replica->remote)) { + && pe__bundle_needs_remote_name(replica->remote, data_set)) { /* REMOTE_CONTAINER_HACK: Allow remote nodes to run containers that * run pacemaker-remoted inside, without needing a separate IP for @@ -923,12 +923,22 @@ pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t * data_set) replica->remote->xml, LOG_ERR); const char *calculated_addr = NULL; + // Replace the value in replica->remote->xml (if appropriate) calculated_addr = pe__add_bundle_remote_name(replica->remote, + data_set, nvpair, "value"); if (calculated_addr) { + /* Since this is for the bundle as a resource, and not any + * particular action, replace the value in the default + * parameters (not evaluated for node). action2xml() will grab + * it from there to replace it in node-evaluated parameters. + */ + GHashTable *params = pe_rsc_params(replica->remote, + NULL, data_set); + crm_trace("Set address for bundle connection %s to bundle host %s", replica->remote->id, calculated_addr); - g_hash_table_replace(replica->remote->parameters, + g_hash_table_replace(params, strdup(XML_RSC_ATTR_REMOTE_RA_ADDR), strdup(calculated_addr)); } else { diff --git a/lib/pengine/bundle.c b/lib/pengine/bundle.c index 7a175a5..05e7335 100644 --- a/lib/pengine/bundle.c +++ b/lib/pengine/bundle.c @@ -954,29 +954,33 @@ replica_for_remote(pe_resource_t *remote) } bool -pe__bundle_needs_remote_name(pe_resource_t *rsc) +pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set) { const char *value; + GHashTable *params = NULL; if (rsc == NULL) { return false; } - value = g_hash_table_lookup(rsc->parameters, XML_RSC_ATTR_REMOTE_RA_ADDR); + // Use NULL node since pcmk__bundle_expand() uses that to set value + params = pe_rsc_params(rsc, NULL, data_set); + value = g_hash_table_lookup(params, XML_RSC_ATTR_REMOTE_RA_ADDR); return pcmk__str_eq(value, "#uname", pcmk__str_casei) && xml_contains_remote_node(rsc->xml); } const char * -pe__add_bundle_remote_name(pe_resource_t *rsc, xmlNode *xml, const char *field) +pe__add_bundle_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set, + xmlNode *xml, const char *field) { // REMOTE_CONTAINER_HACK: Allow remote nodes that start containers with pacemaker remote inside pe_node_t *node = NULL; pe__bundle_replica_t *replica = NULL; - if (!pe__bundle_needs_remote_name(rsc)) { + if (!pe__bundle_needs_remote_name(rsc, data_set)) { return NULL; } diff --git a/lib/pengine/pe_digest.c b/lib/pengine/pe_digest.c index f55c896..f6e41e9 100644 --- a/lib/pengine/pe_digest.c +++ b/lib/pengine/pe_digest.c @@ -147,7 +147,7 @@ calculate_main_digest(op_digest_cache_t *data, pe_resource_t *rsc, /* REMOTE_CONTAINER_HACK: Allow Pacemaker Remote nodes to run containers * that themselves are Pacemaker Remote nodes */ - if (pe__add_bundle_remote_name(rsc, data->params_all, + if (pe__add_bundle_remote_name(rsc, data_set, data->params_all, XML_RSC_ATTR_REMOTE_RA_ADDR)) { crm_trace("Set address for bundle connection %s (on %s)", rsc->id, node->details->uname); diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c index a15bb92..281bc88 100644 --- a/lib/pengine/unpack.c +++ b/lib/pengine/unpack.c @@ -3182,7 +3182,7 @@ should_clear_for_param_change(xmlNode *xml_op, const char *task, { if (!strcmp(task, "start") || !strcmp(task, "monitor")) { - if (pe__bundle_needs_remote_name(rsc)) { + if (pe__bundle_needs_remote_name(rsc, data_set)) { /* We haven't allocated resources yet, so we can't reliably * substitute addr parameters for the REMOTE_CONTAINER_HACK. * When that's needed, defer the check until later.