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) {
    42     GList *containers = NULL;
    45         pe__bundle_variant_data_t *
data = NULL;
    47         get_bundle_variant_data(
data, rsc);
    48         for (GList *gIter = 
data->replicas; gIter != NULL;
    49              gIter = gIter->next) {
    50             pe__bundle_replica_t *replica = gIter->data;
    52             containers = g_list_append(containers, replica->container);
    62            get_container_list(rsc) : rsc->children;
    69     GList *containers = NULL;
    71     pe__bundle_variant_data_t *bundle_data = NULL;
    75     get_bundle_variant_data(bundle_data, rsc);
    78     containers = get_container_list(rsc);
    87                         bundle_data->nreplicas_per_host, data_set);
    89     g_list_free(containers);
    91     for (GList *gIter = bundle_data->replicas; gIter != NULL;
    92          gIter = gIter->next) {
    93         pe__bundle_replica_t *replica = gIter->data;
    99                          rsc->
id, replica->ip->id);
   100             replica->ip->cmds->allocate(replica->ip, prefer, data_set);
   103         container_host = replica->container->allocated_to;
   112                                  NULL, 
true, data_set);
   115         if (replica->remote) {
   117                          rsc->
id, replica->remote->id);
   118             replica->remote->cmds->allocate(replica->remote, prefer,
   123         if (replica->child) {
   127             g_hash_table_iter_init(&iter, replica->child->allowed_nodes);
   128             while (g_hash_table_iter_next(&iter, NULL, (gpointer *) & node)) {
   129                 if (node->details != replica->node->details) {
   138             pe_rsc_trace(rsc, 
"Allocating bundle %s replica child %s",
   139                          rsc->
id, replica->child->id);
   140             replica->child->cmds->allocate(replica->child, replica->node,
   147     if (bundle_data->child) {
   150         g_hash_table_iter_init(&iter, bundle_data->child->allowed_nodes);
   151         while (g_hash_table_iter_next(&iter, NULL, (gpointer *) & node)) {
   152             if (is_bundle_node(bundle_data, node)) {
   159                      rsc->
id, bundle_data->child->id);
   160         bundle_data->child->cmds->allocate(bundle_data->child, prefer, data_set);
   172     GList *containers = NULL;
   173     pe__bundle_variant_data_t *bundle_data = NULL;
   177     containers = get_container_list(rsc);
   178     get_bundle_variant_data(bundle_data, rsc);
   179     for (GList *gIter = bundle_data->replicas; gIter != NULL;
   180          gIter = gIter->next) {
   181         pe__bundle_replica_t *replica = gIter->data;
   185             replica->ip->cmds->create_actions(replica->ip, data_set);
   187         if (replica->container) {
   188             replica->container->cmds->create_actions(replica->container,
   191         if (replica->remote) {
   192             replica->remote->cmds->create_actions(replica->remote, data_set);
   198     if (bundle_data->child) {
   199         bundle_data->child->cmds->create_actions(bundle_data->child, data_set);
   214     g_list_free(containers);
   221     pe__bundle_variant_data_t *bundle_data = NULL;
   225     get_bundle_variant_data(bundle_data, rsc);
   227     if (bundle_data->child) {
   235         if (bundle_data->child->children) {
   256     for (GList *gIter = bundle_data->replicas; gIter != NULL;
   257          gIter = gIter->next) {
   258         pe__bundle_replica_t *replica = gIter->data;
   263         replica->container->cmds->internal_constraints(replica->container,
   270         if (replica->child) {
   284             replica->ip->cmds->internal_constraints(replica->ip, data_set);
   295                                  replica->container, NULL, NULL, 
true,
   299         if (replica->remote) {
   305             replica->remote->cmds->internal_constraints(replica->remote,
   309         if (replica->child) {
   317     if (bundle_data->child) {
   318         bundle_data->child->cmds->internal_constraints(bundle_data->child, data_set);
   354     pe__bundle_variant_data_t *bundle_data = NULL;
   356     CRM_CHECK(candidate != NULL, 
return NULL);
   357     get_bundle_variant_data(bundle_data, rsc);
   359     crm_trace(
"Looking for compatible child from %s for %s on %s",
   362     for (GList *gIter = bundle_data->replicas; gIter != NULL;
   363          gIter = gIter->next) {
   364         pe__bundle_replica_t *replica = gIter->data;
   368                       rsc_lh->
id, replica->container->id,
   370             return replica->container;
   383     GList *scratch = NULL;
   387     active_node_lh = rsc_lh->
fns->
location(rsc_lh, NULL, current);
   388     if (active_node_lh) {
   389         return compatible_replica_for_node(rsc_lh, active_node_lh, rsc, filter,
   396     for (GList *gIter = scratch; gIter != NULL; gIter = gIter->next) {
   399         pair = compatible_replica_for_node(rsc_lh, node, rsc, filter, current);
   405     pe_rsc_debug(rsc, 
"Can't pair %s with %s", rsc_lh->
id, (rsc? rsc->
id : 
"none"));
   407     g_list_free(scratch);
   444                 if (max_clones_node == NULL) {
   456                 pe__bundle_variant_data_t *
data = NULL;
   457                 get_bundle_variant_data(
data, rsc);
   458                 return data->nreplicas_per_host;
   469     GList *allocated_primaries = NULL;
   470     pe__bundle_variant_data_t *bundle_data = NULL;
   474               pe_err(
"dependent was NULL for %s", constraint->
id); 
return);
   476               pe_err(
"primary was NULL for %s", constraint->
id); 
return);
   484         pe_resource_t *primary_replica = compatible_replica(dependent, primary,
   488         if (primary_replica) {
   490                          dependent->
id, primary_replica->
id);
   492                                                constraint, data_set);
   495             crm_notice(
"Cannot pair %s with instance of %s",
   496                        dependent->
id, primary->
id);
   500             pe_rsc_debug(primary, 
"Cannot pair %s with instance of %s",
   501                          dependent->
id, primary->
id);
   507     get_bundle_variant_data(bundle_data, primary);
   508     pe_rsc_trace(primary, 
"Processing constraint %s: %s -> %s %d",
   509                  constraint->
id, dependent->
id, primary->
id, constraint->
score);
   511     for (GList *gIter = bundle_data->replicas; gIter != NULL;
   512          gIter = gIter->next) {
   513         pe__bundle_replica_t *replica = gIter->data;
   516             replica->container->cmds->rsc_colocation_rh(dependent,
   518                                                         constraint, data_set);
   521             pe_node_t *chosen = replica->container->fns->location(replica->container,
   529                 && (replica->child == NULL)) {
   540             allocated_primaries = g_list_prepend(allocated_primaries, chosen);
   547     g_list_free(allocated_primaries);
   553     GList *containers = NULL;
   555     pe__bundle_variant_data_t *
data = NULL;
   574     containers = get_container_list(
action->rsc);
   576     g_list_free(containers);
   585     GList *children = NULL;
   587     if (local_node == NULL) {
   588         crm_err(
"Can't colocate unrunnable child %s with %s", local_child->
id, rsc->
id);
   592     crm_trace(
"Looking for compatible child from %s for %s on %s",
   595     children = get_containers_or_children(rsc);
   596     for (gIter = children; gIter != NULL; gIter = gIter->next) {
   606     crm_trace(
"Can't pair %s with %s", local_child->
id, rsc->
id);
   608         g_list_free(children);
   613 static pe__bundle_replica_t *
   618         pe__bundle_variant_data_t *
data = NULL;
   620         get_bundle_variant_data(
data, rsc);
   621         for (GList *gIter = 
data->replicas; gIter != NULL;
   622              gIter = gIter->next) {
   623             pe__bundle_replica_t *replica = gIter->data;
   626                 && (container == replica->container)
   627                 && (node->
details == replica->node->details)) {
   643     GList *children = NULL;
   644     gboolean current = FALSE;
   653     children = get_containers_or_children(then->
rsc);
   654     for (gIter = children; gIter != NULL; gIter = gIter->next) {
   660         if (first_child == NULL && current) {
   663         } 
else if (first_child == NULL) {
   664             crm_debug(
"No match found for %s (%d / %s / %s)", then_child->
id, current, first->
uuid, then->
uuid);
   684             const char *first_task = 
task2text(task);
   686             pe__bundle_replica_t *first_replica = NULL;
   687             pe__bundle_replica_t *then_replica = NULL;
   689             first_replica = replica_for_container(first->
rsc, first_child,
   691             if (strstr(first->
task, 
"stop") && first_replica && first_replica->child) {
   703             then_replica = replica_for_container(then->
rsc, then_child, node);
   704             if (strstr(then->
task, 
"mote")
   705                 && then_replica && then_replica->child) {
   714                                                 NULL, then->
task, node);
   719             if (first_action == NULL) {
   722                     crm_err(
"Internal error: No action found for %s in %s (first)",
   723                             first_task, first_child->
id);
   726                     crm_trace(
"No action found for %s in %s%s (first)",
   727                               first_task, first_child->
id,
   734             if (then_action == NULL) {
   737                     crm_err(
"Internal error: No action found for %s in %s (then)",
   738                             then->
task, then_child->
id);
   741                     crm_trace(
"No action found for %s in %s%s (then)",
   742                               then->
task, then_child->
id,
   749                 crm_debug(
"Created constraint for %s (%d) -> %s (%d) %.6x",
   758             if(first_action && then_action) {
   762                     filter, 
type, data_set);
   764                 crm_err(
"Nothing found either for %s (%p) or %s (%p) %s",
   765                         first_child->
id, first_action,
   772         g_list_free(children);
   780     bool interleave = FALSE;
   782     const char *interleave_s = NULL;
   784     if(first->
rsc == NULL || then->
rsc == NULL) {
   785         crm_trace(
"Not interleaving %s with %s (both must be resources)", first->
uuid, then->
uuid);
   787     } 
else if(first->
rsc == then->
rsc) {
   788         crm_trace(
"Not interleaving %s with %s (must belong to different resources)", first->
uuid, then->
uuid);
   791         crm_trace(
"Not interleaving %s with %s (both sides must be clones or bundles)", first->
uuid, then->
uuid);
   804     crm_trace(
"Interleave %s -> %s: %s (based on %s)",
   805               first->
uuid, then->
uuid, interleave ? 
"yes" : 
"no", rsc->
id);
   820     if(can_interleave_actions(first, then)) {
   821         changed = multi_update_interleave_actions(first, then, node, 
flags,
   822                                                   filter, 
type, data_set);
   824     } 
else if(then->
rsc) {
   826         GList *children = NULL;
   833         children = get_containers_or_children(then->
rsc);
   834         for (gIter = children; gIter != NULL; gIter = gIter->next) {
   839             if (then_child_action) {
   844                         then_child_action, node, 
flags, filter, 
type, data_set);
   846                 changed |= then_child_changed;
   848                     for (GList *lpc = then_child_action->actions_after; lpc != NULL; lpc = lpc->next) {
   857             g_list_free(children);
   866     pe__bundle_variant_data_t *bundle_data = NULL;
   867     get_bundle_variant_data(bundle_data, rsc);
   871     for (GList *gIter = bundle_data->replicas; gIter != NULL;
   872          gIter = gIter->next) {
   873         pe__bundle_replica_t *replica = gIter->data;
   875         if (replica->container) {
   876             replica->container->cmds->rsc_location(replica->container,
   880             replica->ip->cmds->rsc_location(replica->ip, constraint);
   884     if (bundle_data->child
   887         bundle_data->child->cmds->rsc_location(bundle_data->child, constraint);
   888         bundle_data->child->rsc_location = g_list_prepend(bundle_data->child->rsc_location,
   896     pe__bundle_variant_data_t *bundle_data = NULL;
   900     get_bundle_variant_data(bundle_data, rsc);
   902     if (bundle_data->child) {
   903         bundle_data->child->cmds->expand(bundle_data->child, data_set);
   906     for (GList *gIter = bundle_data->replicas; gIter != NULL;
   907          gIter = gIter->next) {
   908         pe__bundle_replica_t *replica = gIter->data;
   911         if (replica->remote && replica->container
   921                                                replica->remote->xml, LOG_ERR);
   922             const char *calculated_addr = NULL;
   928             if (calculated_addr) {
   937                 crm_trace(
"Set address for bundle connection %s to bundle host %s",
   938                           replica->remote->id, calculated_addr);
   939                 g_hash_table_replace(params,
   941                                      strdup(calculated_addr));
   950                 crm_info(
"Unable to determine address for bundle %s remote connection",
   955             replica->ip->cmds->expand(replica->ip, data_set);
   957         if (replica->container) {
   958             replica->container->cmds->expand(replica->container, data_set);
   960         if (replica->remote) {
   961             replica->remote->cmds->expand(replica->remote, data_set);
   971     bool any_created = FALSE;
   972     pe__bundle_variant_data_t *bundle_data = NULL;
   976     get_bundle_variant_data(bundle_data, rsc);
   977     for (GList *gIter = bundle_data->replicas; gIter != NULL;
   978          gIter = gIter->next) {
   979         pe__bundle_replica_t *replica = gIter->data;
   983             any_created |= replica->ip->cmds->create_probe(replica->ip, node,
   987         if (replica->child && (node->
details == replica->node->details)) {
   988             any_created |= replica->child->cmds->create_probe(replica->child,
   992         if (replica->container) {
   993             bool created = replica->container->cmds->create_probe(replica->container,
  1012                 for (GList *tIter = bundle_data->replicas;
  1013                      tIter && (bundle_data->nreplicas_per_host == 1);
  1014                      tIter = tIter->next) {
  1015                     pe__bundle_replica_t *other = tIter->data;
  1017                     if ((other != replica) && (other != NULL)
  1018                         && (other->container != NULL)) {
  1022                                            NULL, other->container,
  1031         if (replica->container && replica->remote
  1032             && replica->remote->cmds->create_probe(replica->remote, node,
  1043                                                    probe_uuid, NULL, node);
  1052                                    NULL, replica->remote, NULL, probe,
  1068     pe__bundle_variant_data_t *bundle_data = NULL;
  1072     get_bundle_variant_data(bundle_data, rsc);
  1073     for (GList *gIter = bundle_data->replicas; gIter != NULL;
  1074          gIter = gIter->next) {
  1075         pe__bundle_replica_t *replica = gIter->data;
  1081         if (replica->container) {
  1084         if (replica->remote) {
  1087         if (replica->child) {
 #define CRM_CHECK(expr, failure_action)
 
pe_node_t * pcmk__bundle_allocate(pe_resource_t *rsc, pe_node_t *prefer, pe_working_set_t *data_set)
 
enum rsc_role_e role_filter
 
const char * task2text(enum action_tasks task)
 
bool is_set_recursive(pe_resource_t *rsc, long long flag, bool any)
 
#define crm_notice(fmt, args...)
 
bool pe__is_guest_or_remote_node(const pe_node_t *node)
 
#define pe_rsc_debug(rsc, fmt, args...)
 
#define pe__show_node_weights(level, rsc, text, nodes, data_set)
 
int pcmk__scan_min_int(const char *text, int *result, int minimum)
 
GList * sort_nodes_by_weight(GList *nodes, pe_node_t *active_node, pe_working_set_t *data_set)
 
#define pcmk__order_starts(rsc1, rsc2, type, data_set)
 
pe_resource_t * container
 
resource_alloc_functions_t * cmds
 
G_GNUC_INTERNAL void pcmk__new_ordering(pe_resource_t *lh_rsc, char *lh_task, pe_action_t *lh_action, pe_resource_t *rh_rsc, char *rh_task, pe_action_t *rh_action, enum pe_ordering type, pe_working_set_t *data_set)
 
enum pe_graph_flags(* update_actions)(pe_action_t *, pe_action_t *, pe_node_t *, enum pe_action_flags, enum pe_action_flags, enum pe_ordering, pe_working_set_t *data_set)
 
gint sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
 
void pcmk__bundle_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
 
pe_resource_t * remote_rsc
 
resource_object_functions_t * fns
 
enum pe_action_flags summary_action_flags(pe_action_t *action, GList *children, pe_node_t *node)
 
bool pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set)
 
pe_resource_t * dependent
 
enum pe_graph_flags pcmk__multi_update_actions(pe_action_t *first, pe_action_t *then, pe_node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type, pe_working_set_t *data_set)
 
void node_list_exclude(GHashTable *list, GList *list2, gboolean merge_scores)
 
#define pcmk__order_stops(rsc1, rsc2, type, data_set)
 
enum pe_graph_flags native_update_actions(pe_action_t *first, pe_action_t *then, pe_node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type, pe_working_set_t *data_set)
 
enum crm_ais_msg_types type
 
gboolean pcmk__bundle_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
 
enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action, pe_node_t *node)
 
bool pcmk__ends_with(const char *s, const char *match)
 
gboolean is_child_compatible(pe_resource_t *child_rsc, pe_node_t *local_node, enum rsc_role_e filter, gboolean current)
 
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
 
#define XML_RSC_ATTR_REMOTE_RA_ADDR
 
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)
 
void distribute_children(pe_resource_t *rsc, GList *children, GList *nodes, int max, int per_host_max, pe_working_set_t *data_set)
 
#define pe_rsc_provisional
 
pe_node_t *(* location)(const pe_resource_t *, GList **, int)
 
pe_action_t * create_pseudo_resource_op(pe_resource_t *rsc, const char *task, bool optional, bool runnable, pe_working_set_t *data_set)
 
#define crm_debug(fmt, args...)
 
void pcmk__bundle_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
 
pe_resource_t * find_compatible_child_by_node(pe_resource_t *local_child, pe_node_t *local_node, pe_resource_t *rsc, enum rsc_role_e filter, gboolean current)
 
void(* rsc_colocation_lh)(pe_resource_t *, pe_resource_t *, pcmk__colocation_t *, pe_working_set_t *)
 
gboolean update_action(pe_action_t *action, pe_working_set_t *data_set)
 
#define crm_trace(fmt, args...)
 
enum action_tasks get_complex_task(pe_resource_t *rsc, const char *name, gboolean allow_non_atomic)
 
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag. 
 
void promote_demote_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
 
struct pe_node_shared_s * details
 
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
 
#define pe_rsc_promotable
 
GHashTable * pe_rsc_params(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Get a table of resource parameters. 
 
#define pcmk__order_resource_actions(lh_rsc, lh_task, rh_rsc, rh_task, flags, data_set)
 
enum action_tasks clone_child_action(pe_action_t *action)
 
void LogActions(pe_resource_t *rsc, pe_working_set_t *data_set)
 
bool assign_node(pe_resource_t *rsc, pe_node_t *node, gboolean force)
 
#define pe__set_graph_flags(graph_flags, gr_action, flags_to_set)
 
void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
 
#define XML_RSC_ATTR_INCARNATION_NODEMAX
 
enum pe_action_flags(* action_flags)(pe_action_t *, pe_node_t *)
 
#define pe_rsc_allocating
 
enum pe_obj_types variant
 
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
 
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL) 
 
const char * pe__add_bundle_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set, xmlNode *xml, const char *field)
 
void clone_create_pseudo_actions(pe_resource_t *rsc, GList *children, notify_data_t **start_notify, notify_data_t **stop_notify, pe_working_set_t *data_set)
 
pe_resource_t * find_compatible_child(pe_resource_t *local_child, pe_resource_t *rsc, enum rsc_role_e filter, gboolean current, pe_working_set_t *data_set)
 
void pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
 
bool pcmk__threshold_reached(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set, pe_resource_t **failed)
 
int copies_per_node(pe_resource_t *rsc)
 
#define crm_err(fmt, args...)
 
void pcmk__bundle_append_meta(pe_resource_t *rsc, xmlNode *xml)
 
#define pe__clear_resource_flags(resource, flags_to_clear)
 
rsc_role_e
Possible roles that a resource can be in. 
 
enum pe_action_flags flags
 
void pcmk__bundle_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
 
void pcmk__bundle_log_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
 
gboolean crm_is_true(const char *s)
 
#define pe_rsc_trace(rsc, fmt, args...)
 
#define XML_RSC_ATTR_INTERLEAVE
 
void pcmk__bundle_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
 
#define pe_flag_show_scores
 
#define crm_info(fmt, args...)
 
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
 
G_GNUC_INTERNAL void pcmk__apply_location(pe__location_t *constraint, pe_resource_t *rsc)
 
#define pe_rsc_info(rsc, fmt, args...)
 
GHashTable * allowed_nodes