| 181 | } |
| 182 | |
| 183 | void |
| 184 | group_internal_constraints(resource_t * rsc, pe_working_set_t * data_set) |
| 185 | { |
| 186 | GListPtr gIter = rsc->children; |
| 187 | resource_t *last_rsc = NULL; |
| 188 | resource_t *last_active = NULL; |
| 189 | resource_t *top = uber_parent(rsc); |
| 190 | group_variant_data_t *group_data = NULL; |
| 191 | |
| 192 | get_group_variant_data(group_data, rsc); |
| 193 | |
| 194 | new_rsc_order(rsc, RSC_STOPPED, rsc, RSC_START, pe_order_optional, data_set); |
| 195 | new_rsc_order(rsc, RSC_START, rsc, RSC_STARTED, pe_order_runnable_left, data_set); |
| 196 | new_rsc_order(rsc, RSC_STOP, rsc, RSC_STOPPED, pe_order_runnable_left, data_set); |
| 197 | |
| 198 | for (; gIter != NULL; gIter = gIter->next) { |
| 199 | resource_t *child_rsc = (resource_t *) gIter->data; |
| 200 | int stop = pe_order_none; |
| 201 | int stopped = pe_order_implies_then_printed; |
| 202 | int start = pe_order_implies_then | pe_order_runnable_left; |
| 203 | int started = |
| 204 | pe_order_runnable_left | pe_order_implies_then | pe_order_implies_then_printed; |
| 205 | |
| 206 | child_rsc->cmds->internal_constraints(child_rsc, data_set); |
| 207 | |
| 208 | if (last_rsc == NULL) { |
| 209 | if (group_data->ordered) { |
| 210 | stop |= pe_order_optional; |
| 211 | stopped = pe_order_implies_then; |
| 212 | } |
| 213 | |
| 214 | } else if (group_data->colocated) { |
| 215 | rsc_colocation_new("group:internal_colocation", NULL, INFINITY, |
| 216 | child_rsc, last_rsc, NULL, NULL, data_set); |
| 217 | } |
| 218 | |
| 219 | if (top->variant == pe_master) { |
| 220 | new_rsc_order(rsc, RSC_DEMOTE, child_rsc, RSC_DEMOTE, |
| 221 | stop | pe_order_implies_first_printed, data_set); |
| 222 | |
| 223 | new_rsc_order(child_rsc, RSC_DEMOTE, rsc, RSC_DEMOTED, stopped, data_set); |
| 224 | |
| 225 | new_rsc_order(child_rsc, RSC_PROMOTE, rsc, RSC_PROMOTED, started, data_set); |
| 226 | |
| 227 | new_rsc_order(rsc, RSC_PROMOTE, child_rsc, RSC_PROMOTE, |
| 228 | pe_order_implies_first_printed, data_set); |
| 229 | |
| 230 | } |
| 231 | |
| 232 | order_start_start(rsc, child_rsc, pe_order_implies_first_printed); |
| 233 | order_stop_stop(rsc, child_rsc, stop | pe_order_implies_first_printed); |
| 234 | |
| 235 | new_rsc_order(child_rsc, RSC_STOP, rsc, RSC_STOPPED, stopped, data_set); |
| 236 | |
| 237 | new_rsc_order(child_rsc, RSC_START, rsc, RSC_STARTED, started, data_set); |
| 238 | |
| 239 | if (group_data->ordered == FALSE) { |
| 240 | order_start_start(rsc, child_rsc, start | pe_order_implies_first_printed); |
nothing calls this directly
no test coverage detected