40 GList *colocations = NULL;
50 pe_rsc_debug(rsc,
"Breaking assignment loop involving %s", rsc->
id);
62 for (GList *iter = colocations; iter != NULL; iter = iter->next) {
65 pe_rsc_trace(rsc,
"%s: Assigning colocation %s primary %s first",
70 g_list_free(colocations);
75 g_list_free(colocations);
121 bool ordered =
false;
125 pe_rsc_trace(rsc,
"Creating internal constraints for clone %s", rsc->
id);
156 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
179 for (GList *later = iter->next;
180 later != NULL; later = later->next) {
223 "support the same number of instances per node",
250 const GList *iter = NULL;
258 CRM_ASSERT((colocation != NULL) && pe_rsc_is_clone(primary)
259 && (dependent != NULL)
264 "Delaying processing colocation %s " 265 "because cloned primary %s is still provisional",
266 colocation->
id, primary->
id);
270 pe_rsc_trace(primary,
"Processing colocation %s (%s with clone %s @%s)",
271 colocation->
id, dependent->
id, primary->
id,
294 if (can_interleave(colocation)) {
300 if (primary_instance != NULL) {
302 dependent->
id, primary_instance->
id);
307 crm_notice(
"%s cannot run because it cannot interleave with " 308 "any instance of %s", dependent->
id, primary->
id);
313 "%s will not colocate with %s " 314 "because no instance can interleave with it",
315 dependent->
id, primary->
id);
323 GList *primary_nodes = NULL;
326 for (iter = primary->
children; iter != NULL; iter = iter->next) {
333 colocation->
id, pe__node_name(chosen),
335 primary_nodes = g_list_prepend(primary_nodes, chosen);
339 primary_nodes,
false);
340 g_list_free(primary_nodes);
345 for (iter = primary->
children; iter != NULL; iter = iter->next) {
358 CRM_CHECK((rsc != NULL) && (orig_rsc != NULL) && (list != NULL),
return);
362 if (rsc->
parent != NULL) {
372 CRM_CHECK((rsc != NULL) && (orig_rsc != NULL) && (list != NULL),
return);
376 if (rsc->
parent != NULL) {
408 CRM_CHECK((location != NULL) && pe_rsc_is_clone(rsc),
return);
412 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
421 call_action_flags(gpointer
data, gpointer user_data)
439 g_list_foreach(rsc->
actions, call_action_flags, rsc);
442 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
466 for (GList *child_iter = rsc->
children; child_iter != NULL;
467 child_iter = child_iter->next) {
471 if (rsc_probed_on(child, node)) {
482 g_hash_table_iter_init(&iter, rsc->
known_on);
483 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &known_node)) {
484 if (pe__same_node(node, known_node)) {
505 for (GList *iter = clone->
children; iter != NULL; iter = iter->next) {
508 if (rsc_probed_on(instance, node)) {
529 for (GList *iter = clone->
children; (iter != NULL) && (child == NULL);
534 instance_node = instance->
fns->
location(instance, NULL, 0);
535 if (pe__same_node(instance_node, node)) {
561 CRM_ASSERT((node != NULL) && pe_rsc_is_clone(rsc));
576 if ((allowed == NULL)
583 "Skipping probe for %s on %s because resource has " 584 "exclusive discovery but is not allowed on node",
585 rsc->
id, pe__node_name(node));
595 return probe_anonymous_clone(rsc, node);
613 CRM_ASSERT(pe_rsc_is_clone(rsc) && (xml != NULL));
660 GHashTable *utilization)
662 bool existing =
false;
665 CRM_ASSERT(pe_rsc_is_clone(rsc) && (orig_rsc != NULL)
666 && (utilization != NULL));
673 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
675 if (g_list_find(all_rscs, child)) {
679 for (GList *member_iter = child->
children; member_iter != NULL;
680 member_iter = member_iter->next) {
684 if (g_list_find(all_rscs, member) != NULL) {
695 if (!existing && (rsc->
children != NULL)) {
pcmk_assignment_methods_t * cmds
Resource assignment methods.
#define CRM_CHECK(expr, failure_action)
Whether resource has clone notifications enabled.
#define PCMK_XA_PROMOTED_MAX_LEGACY
#define pcmk__order_starts(rsc1, rsc2, flags)
void pcmk__clone_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
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...)
GHashTable * known_on
Nodes where resource has been probed (key is node ID, not name)
'then' is runnable (and migratable) only if 'first' is runnable
pcmk_scheduler_t * cluster
Cluster that resource is part of.
#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.
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
uint32_t(* action_flags)(pcmk_action_t *action, const pcmk_node_t *node)
G_GNUC_INTERNAL bool pcmk__probe_resource_list(GList *rscs, pcmk_node_t *node)
GList * children
Resource's child resources, if any.
#define pcmk__order_stops(rsc1, rsc2, flags)
uint32_t pcmk__clone_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
gboolean exclusive_discover
Whether exclusive probing is enabled.
Implementation of pcmk_action_t.
#define pcmk__config_err(fmt...)
Whether node scores should be output instead of logged.
GHashTable * meta
Resource's meta-attributes.
G_GNUC_INTERNAL pcmk_resource_t * pcmk__find_compatible_instance(const pcmk_resource_t *match_rsc, const pcmk_resource_t *rsc, enum rsc_role_e role, bool current)
G_GNUC_INTERNAL void pcmk__order_promotable_instances(pcmk_resource_t *clone)
G_GNUC_INTERNAL void pcmk__create_instance_actions(pcmk_resource_t *rsc, GList *instances)
int pe__clone_max(const pcmk_resource_t *clone)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
pcmk_node_t *(* assign)(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
G_GNUC_INTERNAL void pcmk__create_promotable_actions(pcmk_resource_t *clone)
char * crm_meta_name(const char *field)
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)
#define PCMK_XA_PROMOTED_NODE_MAX_LEGACY
void(* with_this_colocations)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
void pcmk__clone_shutdown_lock(pcmk_resource_t *rsc)
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.
Actions are ordered (optionally, if no other flags are set)
void(* apply_location)(pcmk_resource_t *rsc, pe__location_t *location)
#define PCMK_META_CLONE_MAX
void(* this_with_colocations)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
G_GNUC_INTERNAL void pcmk__set_instance_roles(pcmk_resource_t *rsc)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
G_GNUC_INTERNAL void pcmk__add_promotion_scores(pcmk_resource_t *rsc)
struct pe_node_shared_s * details
Basic node information.
#define PCMK_ACTION_START
G_GNUC_INTERNAL gint pcmk__cmp_instance(gconstpointer a, gconstpointer b)
unsigned long long flags
Group of enum pcmk_rsc_flags.
void pcmk__clone_apply_location(pcmk_resource_t *rsc, pe__location_t *location)
Never probe resource on node.
void pcmk__clone_create_actions(pcmk_resource_t *rsc)
#define PCMK_META_PROMOTED_MAX
G_GNUC_INTERNAL void pcmk__assign_instances(pcmk_resource_t *collective, GList *instances, int max_total, int max_per_node)
G_GNUC_INTERNAL gint pcmk__cmp_instance_number(gconstpointer a, gconstpointer b)
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.
#define PCMK_META_PROMOTED_NODE_MAX
bool(* create_probe)(pcmk_resource_t *rsc, pcmk_node_t *node)
int pe__clone_promoted_node_max(const pcmk_resource_t *clone)
int pe__clone_promoted_max(const pcmk_resource_t *clone)
int rsc_discover_mode
Probe mode (enum pe_discover_e)
void pcmk__clone_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
#define XML_RSC_ATTR_NOTIFY
G_GNUC_INTERNAL void pcmk__apply_location(pcmk_resource_t *rsc, pe__location_t *constraint)
const char * id
Node ID at the cluster layer.
#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)
#define XML_RSC_ATTR_UNIQUE
pcmk_resource_t * primary
G_GNUC_INTERNAL void pcmk__add_rsc_actions_to_graph(pcmk_resource_t *rsc)
Whether resource has not yet been assigned to a node.
pcmk_node_t * pcmk__clone_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
G_GNUC_INTERNAL void pcmk__update_dependent_with_promotable(const pcmk_resource_t *primary, pcmk_resource_t *dependent, const pcmk__colocation_t *colocation)
Update dependent for a colocation with a promotable clone.
If 'then' is required, 'first' must be added to the transition graph.
void pe__create_clone_notifications(pcmk_resource_t *clone)
G_GNUC_INTERNAL GList * pcmk__with_this_colocations(const pcmk_resource_t *rsc)
G_GNUC_INTERNAL void pcmk__add_dependent_scores(gpointer data, gpointer user_data)
void(* internal_constraints)(pcmk_resource_t *rsc)
pcmk_rsc_methods_t * fns
Resource object methods.
void pcmk__clone_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
void pe__free_clone_notification_data(pcmk_resource_t *clone)
G_GNUC_INTERNAL void pcmk__add_this_with_list(GList **list, GList *addition, const pcmk_resource_t *rsc)
void pcmk__clone_add_graph_meta(const pcmk_resource_t *rsc, xmlNode *xml)
If 'first' is required and runnable, 'then' must be in graph.
#define PCMK_ACTION_STOPPED
G_GNUC_INTERNAL GList * pcmk__this_with_colocations(const pcmk_resource_t *rsc)
void pcmk__clone_add_actions_to_graph(pcmk_resource_t *rsc)
#define pe__clear_resource_flags(resource, flags_to_clear)
void pcmk__with_clone_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
#define PCMK_ACTION_PROMOTE
pcmk_resource_t * dependent
#define pe__show_node_scores(level, rsc, text, nodes, scheduler)
int pe__clone_node_max(const pcmk_resource_t *clone)
#define PCMK_META_CLONE_NODE_MAX
gboolean crm_is_true(const char *s)
Whether resource can be promoted and demoted.
Resource role is unknown.
#define pe_rsc_trace(rsc, fmt, args...)
bool pe__clone_is_ordered(const pcmk_resource_t *clone)
#define PCMK_ACTION_RUNNING
unsigned long long flags
Group of enum pcmk_scheduler_flags.
#define XML_RSC_ATTR_INTERLEAVE
#define PCMK_ACTION_DEMOTED
G_GNUC_INTERNAL void pcmk__update_promotable_dependent_priority(const pcmk_resource_t *primary, pcmk_resource_t *dependent, const pcmk__colocation_t *colocation)
void(* add_utilization)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
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)
Whether resource is not an anonymous clone instance.
bool pcmk__clone_create_probe(pcmk_resource_t *rsc, pcmk_node_t *node)
char * id
Resource ID in configuration.
GHashTable * allowed_nodes
Nodes where resource may run (key is node ID, not name)
void pcmk__clone_internal_constraints(pcmk_resource_t *rsc)