42
42
#define EXPAND_CONSTRAINT_IDREF(__set, __rsc, __name) do { \
43
__rsc = pe_find_resource(data_set->resources, __name); \
43
__rsc = pe_find_constraint_resource(data_set->resources, __name); \
44
44
if(__rsc == NULL) { \
45
45
crm_config_err("%s: No resource found for %s", __set, __name); \
171
enum contains_stonith_res {
172
contains_stonith_unknown = -1,
173
contains_stonith_false,
174
contains_stonith_true,
175
contains_stonith_mixed,
178
static enum contains_stonith_res
179
contains_stonith(resource_t * rsc)
172
pe_find_constraint_resource(GListPtr rsc_list, const char *id)
181
enum contains_stonith_res res = contains_stonith_unknown;
182
GListPtr gIter = rsc->children;
184
if (gIter == FALSE) {
185
const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
187
if (safe_str_eq(class, "stonith")) {
188
return contains_stonith_true;
190
return contains_stonith_false;
193
for (; gIter != NULL; gIter = gIter->next) {
194
resource_t *child = (resource_t *) gIter->data;
195
enum contains_stonith_res tmp = contains_stonith(child);
197
if (tmp != contains_stonith_unknown) {
199
case contains_stonith_unknown:
202
case contains_stonith_false:
203
case contains_stonith_true:
205
return contains_stonith_mixed;
208
case contains_stonith_mixed:
209
return contains_stonith_mixed;
174
GListPtr rIter = NULL;
176
for (rIter = rsc_list; id && rIter; rIter = rIter->next) {
177
resource_t *parent = rIter->data;
180
parent->fns->find_rsc(parent, id, NULL, pe_find_renamed | pe_find_current);
183
if(safe_str_neq(match->id, id)) {
184
/* We found an instance of a clone instead */
185
match = uber_parent(match);
186
crm_debug("Found %s for %s", match->id, id);
191
crm_trace("No match for %s", id);
270
rsc_then = pe_find_resource(data_set->resources, id_then);
271
rsc_first = pe_find_resource(data_set->resources, id_first);
248
rsc_then = pe_find_constraint_resource(data_set->resources, id_then);
249
rsc_first = pe_find_constraint_resource(data_set->resources, id_first);
273
251
if (rsc_then == NULL) {
274
252
crm_config_err("Constraint %s: no resource found for name '%s'", id, id_then);
367
345
gboolean empty = TRUE;
368
346
rsc_to_node_t *location = NULL;
369
const char *id_lh = crm_element_value(xml_obj, "rsc");
347
const char *id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
370
348
const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
371
resource_t *rsc_lh = pe_find_resource(data_set->resources, id_lh);
372
const char *node = crm_element_value(xml_obj, "node");
349
resource_t *rsc_lh = pe_find_constraint_resource(data_set->resources, id_lh);
350
const char *node = crm_element_value(xml_obj, XML_CIB_TAG_NODE);
373
351
const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE);
374
352
const char *domain = crm_element_value(xml_obj, XML_CIB_TAG_DOMAIN);
375
353
const char *role = crm_element_value(xml_obj, XML_RULE_ATTR_ROLE);
714
validate_order_resources(resource_t * lh_rsc, resource_t * rh_rsc)
716
enum contains_stonith_res lh_flag = contains_stonith(lh_rsc);
717
enum contains_stonith_res rh_flag = contains_stonith(rh_rsc);
719
if (lh_flag == contains_stonith_mixed) {
721
("Order constraint, LH (%s) then RH (%s), can not be applied. LH contains stonith resources mixed with other resource classes.",
722
lh_rsc->id, rh_rsc->id);
724
} else if (rh_flag == contains_stonith_mixed) {
726
("Order constraint, LH (%s) then RH (%s), can not be applied. RH contains stonith resources mixed with other resource classes.",
727
lh_rsc->id, rh_rsc->id);
729
} else if (lh_flag == contains_stonith_true && (lh_flag != rh_flag)) {
731
("Order constraint, LH (%s) then RH (%s), can not be applied. LH is of class stonith and RH is not.",
732
lh_rsc->id, rh_rsc->id);
734
} else if (rh_flag == contains_stonith_true && (rh_flag != lh_flag)) {
736
("Order constraint, LH (%s) then RH (%s), can not be applied. RH is of class stonith and LH is not.",
737
lh_rsc->id, rh_rsc->id);
744
691
/* LHS before RHS */
746
693
new_rsc_order(resource_t * lh_rsc, const char *lh_task,
755
702
CRM_CHECK(rh_rsc != NULL, return -1);
756
703
CRM_CHECK(rh_task != NULL, return -1);
758
if (validate_order_resources(lh_rsc, rh_rsc)) {
705
/* We no longer need to test if these reference stonith resources
706
* now that stonithd has access to them even when they're not "running"
708
if (validate_order_resources(lh_rsc, lh_task, rh_rsc, rh_task)) {
762
713
lh_key = generate_op_key(lh_rsc->id, lh_task, 0);
763
714
rh_key = generate_op_key(rh_rsc->id, rh_task, 0);
1350
rsc = pe_find_resource(data_set->resources, id);
1301
rsc = pe_find_constraint_resource(data_set->resources, id);
1351
1302
if (rsc == NULL) {
1352
1303
xmlNode *template_rsc_set = g_hash_table_lookup(data_set->template_rsc_sets, id);
1435
rsc_first = pe_find_resource(data_set->resources, id_first);
1436
rsc_then = pe_find_resource(data_set->resources, id_then);
1386
rsc_first = pe_find_constraint_resource(data_set->resources, id_first);
1387
rsc_then = pe_find_constraint_resource(data_set->resources, id_then);
1437
1388
if (rsc_first && rsc_then) {
1438
1389
/* Neither side references any template. */
1817
1768
const char *symmetrical = crm_element_value(xml_obj, XML_CONS_ATTR_SYMMETRICAL);
1819
resource_t *rsc_lh = pe_find_resource(data_set->resources, id_lh);
1820
resource_t *rsc_rh = pe_find_resource(data_set->resources, id_rh);
1770
resource_t *rsc_lh = pe_find_constraint_resource(data_set->resources, id_lh);
1771
resource_t *rsc_rh = pe_find_constraint_resource(data_set->resources, id_rh);
1822
1773
if (rsc_lh == NULL) {
1823
1774
crm_config_err("Invalid constraint '%s': No resource named '%s'", id, id_lh);
1922
rsc_lh = pe_find_resource(data_set->resources, id_lh);
1923
rsc_rh = pe_find_resource(data_set->resources, id_rh);
1873
rsc_lh = pe_find_constraint_resource(data_set->resources, id_lh);
1874
rsc_rh = pe_find_constraint_resource(data_set->resources, id_rh);
1924
1875
if (rsc_lh && rsc_rh) {
1925
1876
/* Neither side references any template. */
2222
2173
crm_config_err("Invalid constraint '%s': No resource specified", id);
2225
rsc_lh = pe_find_resource(data_set->resources, id_lh);
2176
rsc_lh = pe_find_constraint_resource(data_set->resources, id_lh);
2228
2179
if (rsc_lh == NULL) {
2318
if (data_set->tickets == NULL) {
2320
g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, destroy_ticket);
2367
2323
if (ticket_str == NULL) {
2368
2324
crm_config_err("Invalid constraint '%s': No ticket specified", id);