12 #include <sys/param.h> 13 #include <sys/types.h> 67 xml_obj != NULL; xml_obj = pcmk__xe_next(xml_obj)) {
69 xmlNode *lifetime = NULL;
71 const char *tag = (
const char *) xml_obj->name;
79 crm_trace(
"Unpacking %s constraint '%s'", tag,
id);
82 if (lifetime != NULL) {
84 "(in %s) is deprecated and will be dropped " 85 "in a later release",
id);
88 if ((lifetime != NULL) && !evaluate_lifetime(lifetime,
scheduler)) {
89 crm_info(
"Constraint %s %s is not active", tag,
id);
115 for (GList *iter = rsc_list; iter != NULL; iter = iter->next) {
152 NULL, (gpointer *) tag)) {
154 crm_notice(
"No resource is derived from template '%s'",
id);
162 NULL, (gpointer *) tag)) {
164 crm_notice(
"No resource is tagged with '%s'",
id);
198 if ((tag != NULL) && find_constraint_tag(
scheduler,
id, tag)) {
224 xmlNode *new_xml = NULL;
225 bool any_refs =
false;
239 GList *tag_refs = NULL;
252 "because '%s' is not a valid resource or tag",
253 pcmk__xe_id(xml_obj), pcmk__xe_id(xml_rsc));
264 xmlNode *last_ref = xml_rsc;
285 for (iter = tag->
refs; iter != NULL; iter = iter->next) {
286 const char *ref_id = iter->data;
291 xmlAddNextSibling(last_ref, new_ref);
301 tag_refs = g_list_append(tag_refs, xml_rsc);
315 for (iter = tag_refs; iter != NULL; iter = iter->next) {
316 xmlNode *tag_ref = iter->data;
320 g_list_free(tag_refs);
345 const char *cons_id = NULL;
346 const char *
id = NULL;
353 CRM_CHECK((xml_obj != NULL) && (attr != NULL),
return false);
355 cons_id = pcmk__xe_id(xml_obj);
356 if (cons_id == NULL) {
369 "valid resource or tag", cons_id,
id);
380 for (GList *iter = tag->
refs; iter != NULL; iter = iter->next) {
381 const char *obj_ref = iter->data;
382 xmlNode *rsc_ref = NULL;
391 }
else if ((rsc != NULL) && convert_rsc) {
396 xmlNode *rsc_ref = NULL;
409 if (*rsc_set != NULL) {
425 crm_trace(
"Create internal constraints");
pcmk_assignment_methods_t * cmds
crm_time_t * crm_time_new_undefined(void)
Allocate memory for an uninitialized time object.
#define CRM_CHECK(expr, failure_action)
int pcmk__evaluate_rules(xmlNode *xml, const pcmk_rule_input_t *rule_input, crm_time_t *next_change)
bool pcmk__tag_to_set(xmlNode *xml_obj, xmlNode **rsc_set, const char *attr, bool convert_rsc, const pcmk_scheduler_t *scheduler)
xmlNode * pcmk__xml_copy(xmlNode *parent, xmlNode *src)
G_GNUC_INTERNAL void pcmk__unpack_location(xmlNode *xml_obj, pcmk_scheduler_t *scheduler)
#define crm_notice(fmt, args...)
#define PCMK_XE_RSC_ORDER
#define PCMK__XE_LIFETIME
bool crm_time_is_defined(const crm_time_t *t)
Check whether a time object has been initialized yet.
pcmk_resource_t * uber_parent(pcmk_resource_t *rsc)
struct crm_time_s crm_time_t
#define pcmk__config_warn(fmt...)
#define PCMK_XE_CONSTRAINTS
#define PCMK_XE_RSC_COLOCATION
#define PCMK_XE_RESOURCE_REF
#define pcmk__config_err(fmt...)
void pcmk__unpack_constraints(pcmk_scheduler_t *scheduler)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
void pcmk__xe_set_bool_attr(xmlNodePtr node, const char *name, bool value)
G_GNUC_INTERNAL void pcmk__unpack_rsc_ticket(xmlNode *xml_obj, pcmk_scheduler_t *scheduler)
Also match clone instance ID from resource history.
bool pcmk__valid_resource_or_tag(const pcmk_scheduler_t *scheduler, const char *id, pcmk_resource_t **rsc, pcmk_tag_t **tag)
#define crm_debug(fmt, args...)
#define PCMK_XE_RSC_LOCATION
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
xmlNode * pcmk_find_cib_element(xmlNode *cib, const char *element_name)
Find an element in the CIB.
G_GNUC_INTERNAL void pcmk__unpack_ordering(xmlNode *xml_obj, pcmk_scheduler_t *scheduler)
#define crm_trace(fmt, args...)
Wrappers for and extensions to libxml2.
void pcmk__xe_remove_attr(xmlNode *element, const char *name)
void free_xml(xmlNode *child)
long long crm_time_get_seconds_since_epoch(const crm_time_t *dt)
void pe__update_recheck_time(time_t recheck, pcmk_scheduler_t *scheduler, const char *reason)
G_GNUC_INTERNAL void pcmk__unpack_colocation(xmlNode *xml_obj, pcmk_scheduler_t *scheduler)
Cluster status and scheduling.
pcmk__action_result_t result
void(* internal_constraints)(pcmk_resource_t *rsc)
#define PCMK_XE_RSC_TICKET
pcmk_scheduler_t * scheduler
xmlNode * pcmk__expand_tags_in_sets(xmlNode *xml_obj, const pcmk_scheduler_t *scheduler)
#define PCMK_XE_RESOURCE_SET
pcmk_resource_t * pcmk__find_constraint_resource(GList *rsc_list, const char *id)
void pcmk__create_internal_constraints(pcmk_scheduler_t *scheduler)
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
xmlNode * pcmk__xe_next_same(const xmlNode *node)
#define PCMK_XA_SEQUENTIAL
#define crm_info(fmt, args...)
GHashTable * template_rsc_sets
void crm_time_free(crm_time_t *dt)