12 #include <sys/param.h> 13 #include <sys/types.h> 50 const char *tag = (
const char *) xml_obj->name;
58 crm_trace(
"Unpacking %s constraint '%s'", tag,
id);
84 for (GList *iter = rsc_list; iter != NULL; iter = iter->next) {
122 NULL, (gpointer *) tag)) {
124 crm_notice(
"No resource is derived from template '%s'",
id);
132 NULL, (gpointer *) tag)) {
134 crm_notice(
"No resource is tagged with '%s'",
id);
165 if (role_spec != NULL) {
206 if ((tag != NULL) && find_constraint_tag(
scheduler,
id, tag)) {
233 xmlNode *new_xml = NULL;
234 bool any_refs =
false;
248 GList *tag_refs = NULL;
262 "because '%s' is not a valid resource or tag",
263 pcmk__xe_id(xml_obj), pcmk__xe_id(xml_rsc));
274 xmlNode *last_ref = xml_rsc;
295 for (iter = tag->
refs; iter != NULL; iter = iter->next) {
296 const char *ref_id = iter->data;
301 xmlAddNextSibling(last_ref, new_ref);
311 tag_refs = g_list_append(tag_refs, xml_rsc);
325 for (iter = tag_refs; iter != NULL; iter = iter->next) {
326 xmlNode *tag_ref = iter->data;
330 g_list_free(tag_refs);
355 const char *cons_id = NULL;
356 const char *
id = NULL;
363 CRM_CHECK((xml_obj != NULL) && (attr != NULL),
return false);
365 cons_id = pcmk__xe_id(xml_obj);
366 if (cons_id == NULL) {
379 "valid resource or tag", cons_id,
id);
390 for (GList *iter = tag->
refs; iter != NULL; iter = iter->next) {
391 const char *obj_ref = iter->data;
392 xmlNode *rsc_ref = NULL;
401 }
else if ((rsc != NULL) && convert_rsc) {
406 xmlNode *rsc_ref = NULL;
419 if (*rsc_set != NULL) {
435 crm_trace(
"Create internal constraints");
437 iter != NULL; iter = iter->next) {
#define CRM_CHECK(expr, failure_action)
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)
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
#define crm_notice(fmt, args...)
#define PCMK_XE_RSC_ORDER
void pcmk__xe_set_bool_attr(xmlNodePtr node, const char *name, bool value)
pcmk_resource_t * uber_parent(pcmk_resource_t *rsc)
int pcmk__parse_constraint_role(const char *id, const char *role_spec, enum rsc_role_e *role)
#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)
pcmk__scheduler_private_t * priv
G_GNUC_INTERNAL void pcmk__unpack_rsc_ticket(xmlNode *xml_obj, pcmk_scheduler_t *scheduler)
void pcmk__xe_remove_attr(xmlNode *element, const char *name)
void(* internal_constraints)(pcmk_resource_t *rsc)
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
enum rsc_role_e pcmk_parse_role(const char *role)
Parse a resource role from a string role specification.
void pcmk__xml_free(xmlNode *xml)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
Also match clone instance ID from resource history.
#define crm_debug(fmt, args...)
#define PCMK_XE_RSC_LOCATION
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)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define crm_trace(fmt, args...)
pcmk__resource_private_t * priv
Wrappers for and extensions to libxml2.
bool pcmk__valid_resource_or_tag(const pcmk_scheduler_t *scheduler, const char *id, pcmk_resource_t **rsc, pcmk__idref_t **tag)
G_GNUC_INTERNAL void pcmk__unpack_colocation(xmlNode *xml_obj, pcmk_scheduler_t *scheduler)
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
Cluster status and scheduling.
#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)
Resource role is unknown.
#define PCMK_XA_SEQUENTIAL
const pcmk__assignment_methods_t * cmds