37 pe_rsc_trace(rsc_lh,
"LH: Skipping constraint: \"%s\" state filter",
55 CRM_CHECK((rsc_lh != NULL) && (rsc_ticket != NULL),
return);
62 pe_rsc_trace(rsc_lh,
"Processing ticket dependencies from %s", rsc_lh->
id);
63 for (gIter = rsc_lh->
children; gIter != NULL; gIter = gIter->next) {
64 constraints_for_ticket((
pe_resource_t *) gIter->data, rsc_ticket,
70 pe_rsc_trace(rsc_lh,
"%s: Processing ticket dependency on %s (%s, %s)",
91 if (!ticket_role_matches(rsc_lh, rsc_ticket)) {
98 for (gIter = rsc_lh->
running_on; gIter != NULL;
99 gIter = gIter->next) {
101 "deadman ticket was lost", FALSE);
106 if (!ticket_role_matches(rsc_lh, rsc_ticket)) {
136 const char *state_lh,
const char *loss_policy,
141 if (rsc_lh == NULL) {
143 "does not exist",
id);
148 if (new_rsc_ticket == NULL) {
157 new_rsc_ticket->
id =
id;
158 new_rsc_ticket->
ticket = ticket;
159 new_rsc_ticket->
rsc_lh = rsc_lh;
167 "' for ticket '%s' to 'stop' " 168 "because fencing is not configured", ticket->
id);
169 loss_policy =
"stop";
174 crm_debug(
"On loss of ticket '%s': Fence the nodes running %s (%s)",
179 crm_debug(
"On loss of ticket '%s': Freeze %s (%s)",
185 crm_debug(
"On loss of ticket '%s': Demote %s (%s)",
191 crm_debug(
"On loss of ticket '%s': Stop %s (%s)",
198 crm_debug(
"On loss of ticket '%s': Default to demote %s (%s)",
204 crm_debug(
"On loss of ticket '%s': Default to stop %s (%s)",
220 constraints_for_ticket(rsc_lh, new_rsc_ticket,
data_set);
226 unpack_rsc_ticket_set(xmlNode *
set,
pe_ticket_t *ticket,
229 const char *set_id = NULL;
230 const char *role = NULL;
233 CRM_CHECK(ticket != NULL,
return EINVAL);
236 if (set_id == NULL) {
251 if (resource == NULL) {
253 set_id,
ID(xml_rsc));
256 pe_rsc_trace(resource,
"Resource '%s' depends on ticket '%s'",
257 resource->
id, ticket->
id);
258 rsc_ticket_new(set_id, resource, ticket, role, loss_policy,
data_set);
267 const char *
id = NULL;
288 crm_element_name(xml_obj));
292 if (ticket_str == NULL) {
300 if (ticket == NULL) {
302 "does not exist",
id, ticket_str);
313 if (rsc_lh == NULL) {
315 "does not exist",
id, id_lh);
318 }
else if ((instance_lh != NULL) && !pe_rsc_is_clone(rsc_lh)) {
320 "is not a clone but instance '%s' was requested",
321 id, id_lh, instance_lh);
325 if (instance_lh != NULL) {
327 if (rsc_lh == NULL) {
329 "does not have an instance '%s'",
330 "'%s'",
id, id_lh, instance_lh);
335 rsc_ticket_new(
id, rsc_lh, ticket, state_lh, loss_policy,
data_set);
340 unpack_rsc_ticket_tags(xmlNode *xml_obj, xmlNode **expanded_xml,
343 const char *
id = NULL;
344 const char *id_lh = NULL;
345 const char *state_lh = NULL;
350 xmlNode *rsc_set_lh = NULL;
352 *expanded_xml = NULL;
354 CRM_CHECK(xml_obj != NULL,
return EINVAL);
359 crm_element_name(xml_obj));
365 if (*expanded_xml != NULL) {
377 "valid resource or tag",
id, id_lh);
393 *expanded_xml = NULL;
397 if (rsc_set_lh != NULL) {
398 if (state_lh != NULL) {
406 *expanded_xml = NULL;
416 bool any_sets =
false;
418 const char *
id = NULL;
424 xmlNode *orig_xml = NULL;
425 xmlNode *expanded_xml = NULL;
432 crm_element_name(xml_obj));
440 if (ticket_str == NULL) {
447 if (ticket == NULL) {
449 if (ticket == NULL) {
454 if (unpack_rsc_ticket_tags(xml_obj, &expanded_xml,
458 if (expanded_xml != NULL) {
460 xml_obj = expanded_xml;
469 || (unpack_rsc_ticket_set(
set, ticket, loss_policy,
471 if (expanded_xml != NULL) {
484 unpack_simple_rsc_ticket(xml_obj,
data_set);
#define CRM_CHECK(expr, failure_action)
#define pcmk__config_warn(fmt...)
#define RSC_ROLE_STARTED_S
xmlNode * first_named_child(const xmlNode *parent, const char *name)
#define pcmk__config_err(fmt...)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
#define XML_CONS_TAG_RSC_SET
#define pe__set_resource_flags(resource, flags_to_set)
G_GNUC_INTERNAL xmlNode * pcmk__expand_tags_in_sets(xmlNode *xml_obj, pe_working_set_t *data_set)
xmlNode * copy_xml(xmlNode *src_node)
const char * role2text(enum rsc_role_e role)
GList * ticket_constraints
#define crm_debug(fmt, args...)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
void pcmk__unpack_rsc_ticket(xmlNode *xml_obj, pe_working_set_t *data_set)
pe_ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
void pe_fence_node(pe_working_set_t *data_set, pe_node_t *node, const char *reason, bool priority_delay)
Schedule a fence action for a node.
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
xmlNode * expand_idref(xmlNode *input, xmlNode *top)
pe_resource_t * find_clone_instance(pe_resource_t *rsc, const char *sub_id, pe_working_set_t *data_set)
enum loss_ticket_policy_e loss_policy
pe_working_set_t * data_set
#define pe_flag_stonith_enabled
#define XML_COLOC_ATTR_SOURCE_INSTANCE
#define XML_TAG_RESOURCE_REF
void free_xml(xmlNode *child)
enum rsc_role_e text2role(const char *role)
G_GNUC_INTERNAL pe_resource_t * pcmk__find_constraint_resource(GList *rsc_list, const char *id)
#define XML_COLOC_ATTR_SOURCE_ROLE
Cluster status and scheduling.
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
void xml_remove_prop(xmlNode *obj, const char *name)
#define pe__clear_resource_flags(resource, flags_to_clear)
void destroy_ticket(gpointer data)
#define RSC_ROLE_UNKNOWN_S
#define crm_log_xml_trace(xml, text)
#define XML_TICKET_ATTR_TICKET
#define pe_rsc_trace(rsc, fmt, args...)
#define XML_COLOC_ATTR_SOURCE
G_GNUC_INTERNAL bool pcmk__valid_resource_or_tag(pe_working_set_t *data_set, const char *id, pe_resource_t **rsc, pe_tag_t **tag)
G_GNUC_INTERNAL bool pcmk__tag_to_set(xmlNode *xml_obj, xmlNode **rsc_set, const char *attr, bool convert_rsc, pe_working_set_t *data_set)
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.
#define XML_TICKET_ATTR_LOSS_POLICY