MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / order_rsc_sets

Function order_rsc_sets

pengine/constraints.c:1033–1199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1031}
1032
1033static gboolean
1034order_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, enum pe_order_kind kind,
1035 pe_working_set_t * data_set, gboolean invert, gboolean symmetrical)
1036{
1037
1038 xmlNode *xml_rsc = NULL;
1039
1040 resource_t *rsc_1 = NULL;
1041 resource_t *rsc_2 = NULL;
1042
1043 const char *action_1 = crm_element_value(set1, "action");
1044 const char *action_2 = crm_element_value(set2, "action");
1045
1046 const char *sequential_1 = crm_element_value(set1, "sequential");
1047 const char *sequential_2 = crm_element_value(set2, "sequential");
1048
1049 const char *require_all_s = crm_element_value(set1, "require-all");
1050 gboolean require_all = require_all_s ? crm_is_true(require_all_s) : TRUE;
1051
1052 enum pe_ordering flags = pe_order_none;
1053
1054 if (action_1 == NULL) {
1055 action_1 = RSC_START;
1056 };
1057
1058 if (action_2 == NULL) {
1059 action_2 = RSC_START;
1060 };
1061
1062 if (invert) {
1063 action_1 = invert_action(action_1);
1064 action_2 = invert_action(action_2);
1065 }
1066
1067 if (symmetrical == FALSE) {
1068 flags = get_asymmetrical_flags(kind);
1069 } else {
1070 flags = get_flags(id, kind, action_2, action_1, invert);
1071 }
1072
1073 /* If we have an un-ordered set1, whether it is sequential or not is irrelevant in regards to set2. */
1074 if (!require_all) {
1075 char *task = crm_concat(CRM_OP_RELAXED_SET, ID(set1), ':');
1076 action_t *unordered_action = get_pseudo_op(task, data_set);
1077
1078 free(task);
1079 update_action_flags(unordered_action, pe_action_requires_any);
1080
1081 for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next(xml_rsc)) {
1082 xmlNode *xml_rsc_2 = NULL;
1083 if (!crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
1084 continue;
1085 }
1086
1087 EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
1088
1089 /* Add an ordering constraint between every element in set1 and the pseudo action.
1090 * If any action in set1 is runnable the pseudo action will be runnable. */

Callers 1

unpack_rsc_orderFunction · 0.85

Calls 14

crm_element_valueFunction · 0.85
crm_is_trueFunction · 0.85
invert_actionFunction · 0.85
get_asymmetrical_flagsFunction · 0.85
get_flagsFunction · 0.85
crm_concatFunction · 0.85
get_pseudo_opFunction · 0.85
update_action_flagsFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_str_eqFunction · 0.85
custom_action_orderFunction · 0.85

Tested by

no test coverage detected