38 struct assign_data *assign_data = user_data;
40 bool stop_if_fail = assign_data->stop_if_fail;
45 if (replica->
ip != NULL) {
47 bundle->
id, replica->
ip->
id);
52 if (replica->
remote != NULL) {
63 pe_rsc_trace(bundle,
"Assigning bundle %s connection %s",
68 if (replica->
child != NULL) {
73 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
74 if (!pe__same_node(node, replica->
node)) {
82 pe_rsc_trace(bundle,
"Assigning bundle %s replica child %s",
114 GList *containers = NULL;
116 struct assign_data assign_data = { prefer, stop_if_fail };
131 g_list_free(containers);
138 if (bundled_resource != NULL) {
142 g_hash_table_iter_init(&iter, bundled_resource->
allowed_nodes);
143 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) & node)) {
150 bundled_resource->
cmds->
assign(bundled_resource, prefer, stop_if_fail);
169 if (replica->
ip != NULL) {
175 if (replica->
remote != NULL) {
191 GList *containers = NULL;
200 g_list_free(containers);
203 if (bundled_resource != NULL) {
242 if (replica->
child != NULL) {
259 if (replica->
ip != NULL) {
274 if (replica->
remote != NULL) {
283 if (replica->
child != NULL) {
306 if (bundled_resource == NULL) {
376 struct match_data *match_data = user_data;
380 match_data->container = replica->
container;
401 return container->
fns->
location(container, NULL, 0);
421 GList *scratch = NULL;
422 struct match_data match_data = { NULL, NULL };
425 match_data.node = dependent->
fns->
location(dependent, NULL, 0);
426 match_data.node = get_bundle_node_host(match_data.node);
427 if (match_data.node != NULL) {
430 return match_data.container;
436 for (
const GList *iter = scratch; iter != NULL; iter = iter->next) {
437 match_data.node = iter->data;
438 match_data.node = get_bundle_node_host(match_data.node);
439 if (match_data.node == NULL) {
445 if (match_data.container != NULL) {
449 g_list_free(scratch);
450 return match_data.container;
456 GList *container_hosts;
471 struct coloc_data *coloc_data = user_data;
474 if (coloc_data->colocation->score <
INFINITY) {
477 coloc_data->colocation,
489 && ((replica->
child == NULL)
495 "Allowing mandatory colocation %s using %s @%d",
496 coloc_data->colocation->id, pe__node_name(chosen),
498 coloc_data->container_hosts = g_list_prepend(coloc_data->container_hosts,
522 struct coloc_data coloc_data = { colocation, dependent, NULL };
530 && (dependent != NULL)
532 && (colocation != NULL) && !for_dependent);
536 "Skipping applying colocation %s " 537 "because %s is still provisional",
538 colocation->
id, primary->
id);
541 pe_rsc_trace(primary,
"Applying colocation %s (%s with %s at %s)",
542 colocation->
id, dependent->
id, primary->
id,
551 primary_container = compatible_container(dependent, primary);
552 if (primary_container != NULL) {
554 dependent->
id, primary_container->
id);
559 crm_notice(
"%s cannot run because there is no compatible " 560 "instance of %s to colocate with",
561 dependent->
id, primary->
id);
566 "%s cannot be colocated with any instance of %s",
567 dependent->
id, primary->
id);
577 coloc_data.container_hosts,
false);
579 g_list_free(coloc_data.container_hosts);
590 && (orig_rsc != NULL) && (list != NULL));
593 if ((orig_rsc == rsc)
604 if ((bundled_rsc == NULL)
610 if (orig_rsc == bundled_rsc) {
635 && (orig_rsc != NULL) && (list != NULL));
638 if ((orig_rsc == rsc)
649 if ((bundled_rsc == NULL)
655 if (orig_rsc == bundled_rsc) {
684 GList *containers = NULL;
692 if (bundled_resource != NULL) {
712 g_list_free(containers);
733 if (replica->
ip != NULL) {
752 && (location != NULL));
758 if ((bundled_resource != NULL)
767 #define XPATH_REMOTE "//nvpair[@name='" XML_RSC_ATTR_REMOTE_RA_ADDR "']" 792 const char *calculated_addr = NULL;
798 if (calculated_addr != NULL) {
808 g_hash_table_replace(params,
810 strdup(calculated_addr));
822 "Unable to determine address for bundle %s " 823 "remote connection", bundle->
id);
826 if (replica->
ip != NULL) {
832 if (replica->
remote != NULL) {
852 if (bundled_resource != NULL) {
878 if ((replica == probed_replica) || (replica->
container == NULL)) {
904 struct probe_data *probe_data = user_data;
906 if ((replica->
ip != NULL)
908 probe_data->any_created =
true;
910 if ((replica->
child != NULL)
911 && pe__same_node(probe_data->node, replica->
node)
914 probe_data->any_created =
true;
919 probe_data->any_created =
true;
933 if (probe_data->bundle->fns->max_per_node(probe_data->bundle) == 1) {
935 order_replica_start_after, replica);
953 probe_data->any_created =
true;
954 pe_rsc_trace(probe_data->bundle,
"Ordering %s probe on %s",
955 replica->
remote->
id, pe__node_name(probe_data->node));
959 NULL, replica->
remote, NULL, probe,
961 probe_data->bundle->cluster);
980 struct probe_data probe_data = { rsc, node,
false };
984 return probe_data.any_created;
999 if (replica->
ip != NULL) {
1005 if (replica->
remote != NULL) {
1008 if (replica->
child != NULL) {
1031 GHashTable *utilization)
1046 if (container != NULL) {
pcmk_assignment_methods_t * cmds
Resource assignment methods.
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
enum rsc_role_e role_filter
Relation applies only if actions are on same node.
#define pcmk__order_starts(rsc1, rsc2, flags)
G_GNUC_INTERNAL uint32_t pcmk__collective_action_flags(pcmk_action_t *action, const GList *instances, const pcmk_node_t *node)
void pcmk__bundle_apply_location(pcmk_resource_t *rsc, pe__location_t *location)
#define crm_notice(fmt, args...)
'then' is runnable (and migratable) only if 'first' is runnable
bool pe__is_guest_or_remote_node(const pcmk_node_t *node)
pcmk_scheduler_t * cluster
Cluster that resource is part of.
void(* output_actions)(pcmk_resource_t *rsc)
pcmk_resource_t * ip
IP address resource for ipaddr.
#define pe_rsc_debug(rsc, fmt, args...)
pcmk_node_t *(* location)(const pcmk_resource_t *rsc, GList **list, int current)
List nodes where a resource (or any of its children) is.
void(* create_actions)(pcmk_resource_t *rsc)
void pcmk__bundle_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
G_GNUC_INTERNAL void pcmk__new_ordering(pcmk_resource_t *first_rsc, char *first_task, pcmk_action_t *first_action, pcmk_resource_t *then_rsc, char *then_task, pcmk_action_t *then_action, uint32_t flags, pcmk_scheduler_t *sched)
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
Whether resource is an implicit container resource for a bundle replica.
G_GNUC_INTERNAL bool pcmk__threshold_reached(pcmk_resource_t *rsc, const pcmk_node_t *node, pcmk_resource_t **failed)
GList * children
Resource's child resources, if any.
#define pcmk__order_stops(rsc1, rsc2, flags)
xmlNode * xml
Resource configuration (possibly expanded from template)
enum rsc_role_e next_role
Resource's scheduled next role.
Implementation of pcmk_action_t.
Whether node scores should be output instead of logged.
#define PCMK_ACTION_MONITOR
G_GNUC_INTERNAL void pcmk__create_instance_actions(pcmk_resource_t *rsc, GList *instances)
void pcmk__bundle_add_actions_to_graph(pcmk_resource_t *rsc)
pcmk_node_t *(* assign)(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
void pe__foreach_const_bundle_replica(const pcmk_resource_t *bundle, bool(*fn)(const pe__bundle_replica_t *, void *), void *user_data)
pcmk_resource_t * container
Resource containing this one, if any.
Ordering applies even if 'first' runs on guest node created by 'then'.
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
pcmk_resource_t * remote
Pacemaker Remote connection into container.
#define XML_RSC_ATTR_REMOTE_RA_ADDR
G_GNUC_INTERNAL bool pcmk__assign_resource(pcmk_resource_t *rsc, pcmk_node_t *node, bool force, bool stop_if_fail)
void(* add_actions_to_graph)(pcmk_resource_t *rsc)
#define pe__set_resource_flags(resource, flags_to_set)
void pcmk__bundle_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
pcmk_action_t * pe__new_rsc_pseudo_action(pcmk_resource_t *rsc, const char *task, bool optional, bool runnable)
#define PCMK_ACTION_DEMOTE
int weight
Node score for a given resource.
pcmk_resource_t * parent
Resource's parent resource, if any.
Whether resource is in the process of being assigned to a node.
G_GNUC_INTERNAL void pcmk__add_with_this_list(GList **list, GList *addition, const pcmk_resource_t *rsc)
unsigned int(* max_per_node)(const pcmk_resource_t *rsc)
Get maximum resource instances per node.
Implementation of pcmk_resource_t.
int pe__bundle_max(const pcmk_resource_t *rsc)
const char * pe__add_bundle_remote_name(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler, xmlNode *xml, const char *field)
void pcmk__bundle_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
Actions are ordered (optionally, if no other flags are set)
pcmk_node_t * node
Node created for this instance.
void(* apply_location)(pcmk_resource_t *rsc, pe__location_t *location)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
Basic node information.
bool pe__bundle_needs_remote_name(pcmk_resource_t *rsc)
#define PCMK_ACTION_START
bool pcmk__bundle_create_probe(pcmk_resource_t *rsc, pcmk_node_t *node)
G_GNUC_INTERNAL gint pcmk__cmp_instance(gconstpointer a, gconstpointer b)
unsigned long long flags
Group of enum pcmk_rsc_flags.
pcmk_resource_t * container
Container associated with this instance.
void pcmk__output_bundle_actions(pcmk_resource_t *rsc)
uint32_t pcmk__bundle_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
bool pe__clone_flag_is_set(const pcmk_resource_t *clone, uint32_t flags)
G_GNUC_INTERNAL void pcmk__assign_instances(pcmk_resource_t *collective, GList *instances, int max_total, int max_per_node)
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
Whether resource is blocked from further action.
Implementation of pcmk_node_t.
bool is_set_recursive(const pcmk_resource_t *rsc, long long flag, bool any)
enum pe_obj_types variant
Resource variant.
bool(* create_probe)(pcmk_resource_t *rsc, pcmk_node_t *node)
G_GNUC_INTERNAL void pcmk__apply_location(pcmk_resource_t *rsc, pe__location_t *constraint)
#define pcmk__order_resource_actions(first_rsc, first_task, then_rsc, then_task, flags)
void(* apply_coloc_score)(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
bool pe__is_bundle_node(const pcmk_node_t *node)
void pcmk__with_bundle_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
Unspecified or unknown action.
Whether resource has not yet been assigned to a node.
If 'then' is required, 'first' must be added to the transition graph.
void(* internal_constraints)(pcmk_resource_t *rsc)
pcmk_rsc_methods_t * fns
Resource object methods.
G_GNUC_INTERNAL bool pcmk__instance_matches(const pcmk_resource_t *instance, const pcmk_node_t *node, enum rsc_role_e role, bool current)
pcmk_action_t * find_first_action(const GList *input, const char *uuid, const char *task, const pcmk_node_t *on_node)
G_GNUC_INTERNAL void pcmk__add_this_with_list(GList **list, GList *addition, const pcmk_resource_t *rsc)
If 'first' is required and runnable, 'then' must be in graph.
#define PCMK_ACTION_STOPPED
pcmk_resource_t * pe__first_container(const pcmk_resource_t *bundle)
void pe__foreach_bundle_replica(pcmk_resource_t *bundle, bool(*fn)(pe__bundle_replica_t *, void *), void *user_data)
pcmk_node_t * allocated_to
Node resource is assigned to.
G_GNUC_INTERNAL void pcmk__promotable_restart_ordering(pcmk_resource_t *rsc)
pcmk_resource_t * child
Instance of bundled resource.
#define pe__clear_resource_flags(resource, flags_to_clear)
#define PCMK_ACTION_PROMOTE
pcmk_resource_t * dependent
#define pe__show_node_scores(level, rsc, text, nodes, scheduler)
G_GNUC_INTERNAL GList * pcmk__sort_nodes(GList *nodes, pcmk_node_t *active_node)
A single instance of a bundle.
#define PCMK_ACTION_PROMOTED
void pcmk__bundle_create_actions(pcmk_resource_t *rsc)
pcmk_resource_t * pe__bundled_resource(const pcmk_resource_t *rsc)
Whether resource can be promoted and demoted.
G_GNUC_INTERNAL void pcmk__new_colocation(const char *id, const char *node_attr, int score, pcmk_resource_t *dependent, pcmk_resource_t *primary, const char *dependent_role, const char *primary_role, uint32_t flags)
Resource role is unknown.
void pcmk__bundle_shutdown_lock(pcmk_resource_t *rsc)
#define pe_rsc_trace(rsc, fmt, args...)
GHashTable * pe_rsc_params(pcmk_resource_t *rsc, const pcmk_node_t *node, pcmk_scheduler_t *scheduler)
Get a table of resource parameters.
#define PCMK_ACTION_RUNNING
unsigned long long flags
Group of enum pcmk_scheduler_flags.
bool pe__node_is_bundle_instance(const pcmk_resource_t *bundle, const pcmk_node_t *node)
#define PCMK_ACTION_DEMOTED
enum action_tasks get_complex_task(const pcmk_resource_t *rsc, const char *name)
pcmk_node_t * pcmk__bundle_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
void(* add_utilization)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
GList * pe__bundle_containers(const pcmk_resource_t *bundle)
G_GNUC_INTERNAL void pcmk__colocation_intersect_nodes(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, const GList *primary_nodes, bool merge_scores)
pcmk_resource_t * remote_rsc
Remote connection resource for node, if it is a Pacemaker Remote node.
#define pe_rsc_info(rsc, fmt, args...)
char * id
Resource ID in configuration.
GHashTable * allowed_nodes
Nodes where resource may run (key is node ID, not name)
void pcmk__bundle_internal_constraints(pcmk_resource_t *rsc)