19 #define PE__VARIANT_BUNDLE 1 23 is_bundle_node(pe__bundle_variant_data_t *
data,
pe_node_t *node)
25 for (GList *gIter =
data->replicas; gIter != NULL; gIter = gIter->next) {
26 pe__bundle_replica_t *replica = gIter->data;
28 if (node->
details == replica->node->details) {
47 GList *containers = NULL;
48 pe__bundle_variant_data_t *bundle_data = NULL;
52 get_bundle_variant_data(bundle_data, rsc);
62 bundle_data->nreplicas_per_host);
63 g_list_free(containers);
65 for (GList *gIter = bundle_data->replicas; gIter != NULL;
66 gIter = gIter->next) {
67 pe__bundle_replica_t *replica = gIter->data;
73 rsc->
id, replica->ip->id);
74 replica->ip->cmds->assign(replica->ip, prefer);
77 container_host = replica->container->allocated_to;
89 if (replica->remote) {
91 rsc->
id, replica->remote->id);
92 replica->remote->cmds->assign(replica->remote, prefer);
100 g_hash_table_iter_init(&iter, replica->child->allowed_nodes);
101 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) & node)) {
102 if (node->details != replica->node->details) {
111 pe_rsc_trace(rsc,
"Allocating bundle %s replica child %s",
112 rsc->
id, replica->child->id);
113 replica->child->cmds->assign(replica->child, replica->node);
119 if (bundle_data->child) {
122 g_hash_table_iter_init(&iter, bundle_data->child->allowed_nodes);
123 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) & node)) {
124 if (is_bundle_node(bundle_data, node)) {
131 rsc->
id, bundle_data->child->id);
132 bundle_data->child->cmds->assign(bundle_data->child, prefer);
144 GList *containers = NULL;
145 pe__bundle_variant_data_t *bundle_data = NULL;
150 get_bundle_variant_data(bundle_data, rsc);
151 for (GList *gIter = bundle_data->replicas; gIter != NULL;
152 gIter = gIter->next) {
153 pe__bundle_replica_t *replica = gIter->data;
157 replica->ip->cmds->create_actions(replica->ip);
159 if (replica->container) {
160 replica->container->cmds->create_actions(replica->container);
162 if (replica->remote) {
163 replica->remote->cmds->create_actions(replica->remote);
169 if (bundle_data->child) {
170 bundle_data->child->cmds->create_actions(bundle_data->child);
185 g_list_free(containers);
191 pe__bundle_variant_data_t *bundle_data = NULL;
195 get_bundle_variant_data(bundle_data, rsc);
197 if (bundle_data->child) {
203 if (bundle_data->child->children) {
220 for (GList *gIter = bundle_data->replicas; gIter != NULL;
221 gIter = gIter->next) {
222 pe__bundle_replica_t *replica = gIter->data;
227 replica->container->cmds->internal_constraints(replica->container);
232 if (replica->child) {
246 replica->ip->cmds->internal_constraints(replica->ip);
255 replica->container, NULL, NULL,
true,
259 if (replica->remote) {
265 replica->remote->cmds->internal_constraints(replica->remote);
268 if (replica->child) {
276 if (bundle_data->child) {
277 bundle_data->child->cmds->internal_constraints(bundle_data->child);
310 pe__bundle_variant_data_t *bundle_data = NULL;
312 CRM_CHECK(candidate != NULL,
return NULL);
313 get_bundle_variant_data(bundle_data, rsc);
315 crm_trace(
"Looking for compatible child from %s for %s on %s",
316 rsc_lh->
id, rsc->
id, pe__node_name(candidate));
318 for (GList *gIter = bundle_data->replicas; gIter != NULL;
319 gIter = gIter->next) {
320 pe__bundle_replica_t *replica = gIter->data;
325 rsc_lh->
id, replica->container->id,
326 pe__node_name(candidate));
327 return replica->container;
340 GList *scratch = NULL;
344 active_node_lh = rsc_lh->
fns->
location(rsc_lh, NULL, current);
345 if (active_node_lh) {
346 return compatible_replica_for_node(rsc_lh, active_node_lh, rsc, filter,
353 for (GList *gIter = scratch; gIter != NULL; gIter = gIter->next) {
356 pair = compatible_replica_for_node(rsc_lh, node, rsc, filter, current);
362 pe_rsc_debug(rsc,
"Can't pair %s with %s", rsc_lh->
id, (rsc? rsc->
id :
"none"));
364 g_list_free(scratch);
389 if (max_clones_node == NULL) {
401 pe__bundle_variant_data_t *
data = NULL;
402 get_bundle_variant_data(
data, rsc);
403 return data->nreplicas_per_host;
428 GList *allocated_primaries = NULL;
429 pe__bundle_variant_data_t *bundle_data = NULL;
437 CRM_CHECK((colocation != NULL) && (dependent != NULL) && (primary != NULL),
446 pe_resource_t *primary_replica = compatible_replica(dependent, primary,
451 if (primary_replica) {
453 dependent->
id, primary_replica->
id);
458 crm_notice(
"Cannot pair %s with instance of %s",
459 dependent->
id, primary->
id);
463 pe_rsc_debug(primary,
"Cannot pair %s with instance of %s",
464 dependent->
id, primary->
id);
470 get_bundle_variant_data(bundle_data, primary);
471 pe_rsc_trace(primary,
"Processing constraint %s: %s -> %s %d",
472 colocation->
id, dependent->
id, primary->
id, colocation->
score);
474 for (GList *gIter = bundle_data->replicas; gIter != NULL;
475 gIter = gIter->next) {
476 pe__bundle_replica_t *replica = gIter->data;
479 replica->container->cmds->apply_coloc_score(dependent,
484 pe_node_t *chosen = replica->container->fns->location(replica->container,
492 && (replica->child == NULL)) {
501 colocation->
id, pe__node_name(chosen), chosen->
weight);
502 allocated_primaries = g_list_prepend(allocated_primaries, chosen);
509 g_list_free(allocated_primaries);
518 && (orig_rsc != NULL) && (list != NULL),
521 if (rsc == orig_rsc) {
536 && (orig_rsc != NULL) && (list != NULL),
539 if (rsc == orig_rsc) {
551 GList *containers = NULL;
553 pe__bundle_variant_data_t *
data = NULL;
567 data->child->children,
576 g_list_free(containers);
592 const pe__bundle_variant_data_t *
data = NULL;
598 get_bundle_variant_data(
data, top);
600 for (
const GList *iter =
data->replicas; iter != NULL; iter = iter->next) {
601 const pe__bundle_replica_t *replica = iter->data;
604 return replica->child;
613 pe__bundle_variant_data_t *bundle_data = NULL;
614 get_bundle_variant_data(bundle_data, rsc);
618 for (GList *gIter = bundle_data->replicas; gIter != NULL;
619 gIter = gIter->next) {
620 pe__bundle_replica_t *replica = gIter->data;
622 if (replica->container) {
623 replica->container->cmds->apply_location(replica->container,
627 replica->ip->cmds->apply_location(replica->ip, constraint);
631 if (bundle_data->child
634 bundle_data->child->cmds->apply_location(bundle_data->child,
636 bundle_data->child->rsc_location = g_list_prepend(bundle_data->child->rsc_location,
650 pe__bundle_variant_data_t *bundle_data = NULL;
654 get_bundle_variant_data(bundle_data, rsc);
656 if (bundle_data->child) {
657 bundle_data->child->cmds->add_actions_to_graph(bundle_data->child);
660 for (GList *gIter = bundle_data->replicas; gIter != NULL;
661 gIter = gIter->next) {
662 pe__bundle_replica_t *replica = gIter->data;
665 if (replica->remote && replica->container
675 replica->remote->xml, LOG_ERR);
676 const char *calculated_addr = NULL;
682 if (calculated_addr) {
692 g_hash_table_replace(params,
694 strdup(calculated_addr));
703 crm_info(
"Unable to determine address for bundle %s remote connection",
708 replica->ip->cmds->add_actions_to_graph(replica->ip);
710 if (replica->container) {
711 replica->container->cmds->add_actions_to_graph(replica->container);
713 if (replica->remote) {
714 replica->remote->cmds->add_actions_to_graph(replica->remote);
732 bool any_created =
false;
733 pe__bundle_variant_data_t *bundle_data = NULL;
737 get_bundle_variant_data(bundle_data, rsc);
738 for (GList *gIter = bundle_data->replicas; gIter != NULL;
739 gIter = gIter->next) {
740 pe__bundle_replica_t *replica = gIter->data;
743 if ((replica->ip != NULL)
744 && replica->ip->cmds->create_probe(replica->ip, node)) {
747 if ((replica->child != NULL) && (node->
details == replica->node->details)
748 && replica->child->cmds->create_probe(replica->child, node)) {
751 if ((replica->container != NULL)
752 && replica->container->cmds->create_probe(replica->container,
769 for (GList *tIter = bundle_data->replicas;
770 tIter && (bundle_data->nreplicas_per_host == 1);
771 tIter = tIter->next) {
772 pe__bundle_replica_t *other = tIter->data;
774 if ((other != replica) && (other != NULL)
775 && (other->container != NULL)) {
779 NULL, other->container,
787 if ((replica->container != NULL) && (replica->remote != NULL)
788 && replica->remote->cmds->create_probe(replica->remote, node)) {
797 probe_uuid, NULL, node);
803 replica->remote->id, pe__node_name(node));
806 NULL, replica->remote, NULL, probe,
817 pe__bundle_variant_data_t *bundle_data = NULL;
821 get_bundle_variant_data(bundle_data, rsc);
822 for (GList *gIter = bundle_data->replicas; gIter != NULL;
823 gIter = gIter->next) {
824 pe__bundle_replica_t *replica = gIter->data;
827 if (replica->ip != NULL) {
828 replica->ip->cmds->output_actions(replica->ip);
830 if (replica->container != NULL) {
831 replica->container->cmds->output_actions(replica->container);
833 if (replica->remote != NULL) {
834 replica->remote->cmds->output_actions(replica->remote);
836 if (replica->child != NULL) {
837 replica->child->cmds->output_actions(replica->child);
846 GHashTable *utilization)
848 pe__bundle_variant_data_t *bundle_data = NULL;
849 pe__bundle_replica_t *replica = NULL;
855 get_bundle_variant_data(bundle_data, rsc);
856 if (bundle_data->replicas == NULL) {
864 replica = (pe__bundle_replica_t *) bundle_data->replicas->data;
865 if (replica->container != NULL) {
866 replica->container->cmds->add_utilization(replica->container, orig_rsc,
867 all_rscs, utilization);
#define CRM_CHECK(expr, failure_action)
void pcmk__bundle_internal_constraints(pe_resource_t *rsc)
enum rsc_role_e role_filter
void pcmk__output_bundle_actions(pe_resource_t *rsc)
#define pcmk__order_starts(rsc1, rsc2, flags)
G_GNUC_INTERNAL void pcmk__add_this_with_list(GList **list, GList *addition)
#define crm_notice(fmt, args...)
bool pe__is_guest_or_remote_node(const pe_node_t *node)
#define pe_rsc_debug(rsc, fmt, args...)
enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action, const pe_node_t *node)
#define pe__show_node_weights(level, rsc, text, nodes, data_set)
int pcmk__scan_min_int(const char *text, int *result, int minimum)
pe_resource_t * container
resource_alloc_functions_t * cmds
#define pcmk__order_stops(rsc1, rsc2, flags)
void pcmk__bundle_add_utilization(const pe_resource_t *rsc, const pe_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
pe_action_t * find_first_action(const GList *input, const char *uuid, const char *task, const pe_node_t *on_node)
pe_resource_t * remote_rsc
void pcmk__bundle_apply_coloc_score(pe_resource_t *dependent, const pe_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
resource_object_functions_t * fns
pe_resource_t * dependent
void node_list_exclude(GHashTable *list, GList *list2, gboolean merge_scores)
G_GNUC_INTERNAL GList * pcmk__sort_nodes(GList *nodes, pe_node_t *active_node)
const pe_resource_t * pe__const_top_resource(const pe_resource_t *rsc, bool include_bundle)
pe_action_t * pe__new_rsc_pseudo_action(pe_resource_t *rsc, const char *task, bool optional, bool runnable)
void pcmk__bundle_expand(pe_resource_t *rsc)
bool pe__bundle_needs_remote_name(pe_resource_t *rsc)
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
#define XML_RSC_ATTR_REMOTE_RA_ADDR
G_GNUC_INTERNAL bool pcmk__instance_matches(const pe_resource_t *instance, const pe_node_t *node, enum rsc_role_e role, bool current)
G_GNUC_INTERNAL void pcmk__new_colocation(const char *id, const char *node_attr, int score, pe_resource_t *dependent, pe_resource_t *primary, const char *dependent_role, const char *primary_role, bool influence, pe_working_set_t *data_set)
#define pe__set_resource_flags(resource, flags_to_set)
#define pe_rsc_provisional
GList * pe__bundle_containers(const pe_resource_t *bundle)
pe_node_t *(* location)(const pe_resource_t *, GList **, int)
#define crm_trace(fmt, args...)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
G_GNUC_INTERNAL gint pcmk__cmp_instance(gconstpointer a, gconstpointer b)
#define pe_rsc_promotable
pe_working_set_t * data_set
void pcmk__bundle_with_colocations(const pe_resource_t *rsc, const pe_resource_t *orig_rsc, GList **list)
void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
G_GNUC_INTERNAL void pcmk__new_ordering(pe_resource_t *first_rsc, char *first_task, pe_action_t *first_action, pe_resource_t *then_rsc, char *then_task, pe_action_t *then_action, uint32_t flags, pe_working_set_t *data_set)
#define XML_RSC_ATTR_INCARNATION_NODEMAX
pe_node_t * pcmk__bundle_allocate(pe_resource_t *rsc, const pe_node_t *prefer)
bool is_set_recursive(const pe_resource_t *rsc, long long flag, bool any)
G_GNUC_INTERNAL void pcmk__add_with_this_list(GList **list, GList *addition)
#define pe_rsc_allocating
enum pe_obj_types variant
void pcmk__bundle_shutdown_lock(pe_resource_t *rsc)
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
#define pcmk__order_resource_actions(first_rsc, first_task, then_rsc, then_task, flags)
void(* apply_coloc_score)(pe_resource_t *dependent, const pe_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
const char * pe__add_bundle_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set, xmlNode *xml, const char *field)
G_GNUC_INTERNAL void pcmk__apply_location(pe_resource_t *rsc, pe__location_t *constraint)
#define pe_rsc_replica_container
int copies_per_node(pe_resource_t *rsc)
void pcmk__with_bundle_colocations(const pe_resource_t *rsc, const pe_resource_t *orig_rsc, GList **list)
G_GNUC_INTERNAL bool pcmk__assign_resource(pe_resource_t *rsc, pe_node_t *node, bool force)
G_GNUC_INTERNAL void pcmk__create_instance_actions(pe_resource_t *rsc, GList *instances)
GHashTable * pe_rsc_params(pe_resource_t *rsc, const pe_node_t *node, pe_working_set_t *data_set)
Get a table of resource parameters.
G_GNUC_INTERNAL void pcmk__promotable_restart_ordering(pe_resource_t *rsc)
const pe_resource_t * pcmk__get_rsc_in_container(const pe_resource_t *instance)
#define pe__clear_resource_flags(resource, flags_to_clear)
rsc_role_e
Possible roles that a resource can be in.
G_GNUC_INTERNAL bool pcmk__threshold_reached(pe_resource_t *rsc, const pe_node_t *node, pe_resource_t **failed)
G_GNUC_INTERNAL void pcmk__assign_instances(pe_resource_t *collective, GList *instances, int max_total, int max_per_node)
pe_working_set_t * cluster
enum action_tasks get_complex_task(const pe_resource_t *rsc, const char *name)
#define pe_rsc_trace(rsc, fmt, args...)
G_GNUC_INTERNAL void pcmk__add_collective_constraints(GList **list, const pe_resource_t *instance, const pe_resource_t *collective, bool with_this)
#define pe_flag_show_scores
#define crm_info(fmt, args...)
bool pcmk__bundle_create_probe(pe_resource_t *rsc, pe_node_t *node)
void pcmk__bundle_create_actions(pe_resource_t *rsc)
GHashTable * allowed_nodes
G_GNUC_INTERNAL enum pe_action_flags pcmk__collective_action_flags(pe_action_t *action, const GList *instances, const pe_node_t *node)