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) {
53 if (pcmk__is_pacemaker_remote_node(container_host)) {
68 if (replica->
child != NULL) {
73 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
74 if (!pcmk__same_node(node, replica->
node)) {
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;
398 if (pcmk__is_bundle_node(node)) {
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;
473 struct coloc_data *coloc_data = user_data;
480 coloc_data->colocation,
483 coloc_data->priority_delta =
495 && ((replica->
child == NULL)
501 "Allowing mandatory colocation %s using %s @%d",
502 coloc_data->colocation->id, pcmk__node_name(chosen),
504 coloc_data->container_hosts = g_list_prepend(coloc_data->container_hosts,
530 struct coloc_data coloc_data = { colocation, dependent, NULL, 0 };
536 CRM_ASSERT(pcmk__is_bundle(primary) && pcmk__is_primitive(dependent)
537 && (colocation != NULL) && !for_dependent);
541 "Skipping applying colocation %s " 542 "because %s is still provisional",
543 colocation->
id, primary->
id);
547 colocation->
id, dependent->
id, primary->
id,
556 primary_container = compatible_container(dependent, primary);
557 if (primary_container != NULL) {
559 dependent->
id, primary_container->
id);
568 crm_notice(
"%s cannot run because there is no compatible " 569 "instance of %s to colocate with",
570 dependent->
id, primary->
id);
575 "%s cannot be colocated with any instance of %s",
576 dependent->
id, primary->
id);
586 coloc_data.container_hosts,
false);
588 g_list_free(coloc_data.container_hosts);
589 return coloc_data.priority_delta;
599 CRM_ASSERT(pcmk__is_bundle(rsc) && (orig_rsc != NULL) && (list != NULL));
602 if ((orig_rsc == rsc)
613 if ((bundled_rsc == NULL)
619 if (orig_rsc == bundled_rsc) {
643 CRM_ASSERT(pcmk__is_bundle(rsc) && (orig_rsc != NULL) && (list != NULL));
646 if ((orig_rsc == rsc)
657 if ((bundled_rsc == NULL)
663 if (orig_rsc == bundled_rsc) {
692 GList *containers = NULL;
699 if (bundled_resource != NULL) {
719 g_list_free(containers);
740 if (replica->
ip != NULL) {
758 CRM_ASSERT((location != NULL) && pcmk__is_bundle(rsc));
764 if ((bundled_resource != NULL)
773 #define XPATH_REMOTE "//nvpair[@name='" PCMK_REMOTE_RA_ADDR "']" 798 const char *calculated_addr = NULL;
803 if (calculated_addr != NULL) {
825 "Unable to determine address for bundle %s " 826 "remote connection", bundle->
id);
829 if (replica->
ip != NULL) {
835 if (replica->
remote != NULL) {
855 if (bundled_resource != NULL) {
881 if ((replica == probed_replica) || (replica->
container == NULL)) {
907 struct probe_data *probe_data = user_data;
909 if ((replica->
ip != NULL)
911 probe_data->any_created =
true;
913 if ((replica->
child != NULL)
914 && pcmk__same_node(probe_data->node, replica->
node)
917 probe_data->any_created =
true;
922 probe_data->any_created =
true;
936 if (probe_data->bundle->fns->max_per_node(probe_data->bundle) == 1) {
938 order_replica_start_after, replica);
956 probe_data->any_created =
true;
959 pcmk__node_name(probe_data->node));
963 NULL, replica->
remote, NULL, probe,
965 probe_data->bundle->cluster);
984 struct probe_data probe_data = { rsc, node,
false };
988 return probe_data.any_created;
1003 if (replica->
ip != NULL) {
1009 if (replica->
remote != NULL) {
1012 if (replica->
child != NULL) {
1035 GHashTable *utilization)
1050 if (container != NULL) {
int pcmk__bundle_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
pcmk_assignment_methods_t * cmds
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
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)
#define crm_notice(fmt, args...)
'then' is runnable (and migratable) only if 'first' is runnable
G_GNUC_INTERNAL void pcmk__apply_location(pcmk_resource_t *rsc, pcmk__location_t *constraint)
pcmk_scheduler_t * cluster
void(* output_actions)(pcmk_resource_t *rsc)
pcmk_node_t *(* location)(const pcmk_resource_t *rsc, GList **list, int current)
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)
pcmk_node_t * node
Node created for this instance.
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.
G_GNUC_INTERNAL bool pcmk__threshold_reached(pcmk_resource_t *rsc, const pcmk_node_t *node, pcmk_resource_t **failed)
#define pcmk__rsc_trace(rsc, fmt, args...)
#define pcmk__order_stops(rsc1, rsc2, flags)
void pe__foreach_bundle_replica(pcmk_resource_t *bundle, bool(*fn)(pcmk__bundle_replica_t *, void *), void *user_data)
#define pcmk__rsc_info(rsc, fmt, args...)
enum rsc_role_e next_role
const char * pe__add_bundle_remote_name(pcmk_resource_t *rsc, xmlNode *xml, const char *field)
pcmk_resource_t * ip
IP address resource for ipaddr.
#define PCMK_ACTION_MONITOR
#define PCMK_REMOTE_RA_ADDR
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 pcmk__bundle_replica_t *, void *), void *user_data)
pcmk_resource_t * container
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)
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 pcmk__rsc_debug(rsc, fmt, args...)
pcmk_action_t * pe__new_rsc_pseudo_action(pcmk_resource_t *rsc, const char *task, bool optional, bool runnable)
#define PCMK_ACTION_DEMOTE
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)
int pe__bundle_max(const pcmk_resource_t *rsc)
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)
void pcmk__bundle_apply_location(pcmk_resource_t *rsc, pcmk__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
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)
Wrappers for and extensions to libxml2.
void pcmk__output_bundle_actions(pcmk_resource_t *rsc)
void(* apply_location)(pcmk_resource_t *rsc, pcmk__location_t *location)
uint32_t pcmk__bundle_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
#define pcmk__set_rsc_flags(resource, flags_to_set)
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)
int pcmk__add_scores(int score1, int score2)
bool is_set_recursive(const pcmk_resource_t *rsc, long long flag, bool any)
enum pe_obj_types variant
pcmk_resource_t * child
Instance of bundled resource.
bool(* create_probe)(pcmk_resource_t *rsc, pcmk_node_t *node)
#define pcmk__order_resource_actions(first_rsc, first_task, then_rsc, then_task, flags)
A single instance of a bundle.
void pcmk__with_bundle_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
pcmk_resource_t * container
Container associated with this instance.
If 'then' is required, 'first' must be added to the transition graph.
void(* internal_constraints)(pcmk_resource_t *rsc)
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)
pcmk_node_t * allocated_to
enum rsc_role_e role_filter
G_GNUC_INTERNAL void pcmk__promotable_restart_ordering(pcmk_resource_t *rsc)
#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)
#define PCMK_ACTION_PROMOTED
void pcmk__bundle_create_actions(pcmk_resource_t *rsc)
pcmk_resource_t * pe__bundled_resource(const pcmk_resource_t *rsc)
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)
Location constraint object.
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
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)
pcmk_resource_t * remote
Pacemaker Remote connection into container.
GList * pe__bundle_containers(const pcmk_resource_t *bundle)
#define pcmk__clear_rsc_flags(resource, flags_to_clear)
void pcmk__insert_dup(GHashTable *table, const char *name, const char *value)
int(* apply_coloc_score)(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
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
#define PCMK_SCORE_INFINITY
Integer score to use to represent "infinity".
GHashTable * allowed_nodes
void pcmk__bundle_internal_constraints(pcmk_resource_t *rsc)