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

Function find_operations

lib/pengine/unpack.c:2279–2337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2277}
2278
2279GListPtr
2280find_operations(const char *rsc, const char *node, gboolean active_filter,
2281 pe_working_set_t * data_set)
2282{
2283 GListPtr output = NULL;
2284 GListPtr intermediate = NULL;
2285
2286 xmlNode *tmp = NULL;
2287 xmlNode *status = find_xml_node(data_set->input, XML_CIB_TAG_STATUS, TRUE);
2288
2289 node_t *this_node = NULL;
2290
2291 xmlNode *node_state = NULL;
2292
2293 for (node_state = __xml_first_child(status); node_state != NULL;
2294 node_state = __xml_next(node_state)) {
2295
2296 if (crm_str_eq((const char *)node_state->name, XML_CIB_TAG_STATE, TRUE)) {
2297 const char *uname = crm_element_value(node_state, XML_ATTR_UNAME);
2298
2299 if (node != NULL && safe_str_neq(uname, node)) {
2300 continue;
2301 }
2302
2303 this_node = pe_find_node(data_set->nodes, uname);
2304 CRM_CHECK(this_node != NULL, continue);
2305
2306 determine_online_status(node_state, this_node, data_set);
2307
2308 if (this_node->details->online || is_set(data_set->flags, pe_flag_stonith_enabled)) {
2309 /* offline nodes run no resources...
2310 * unless stonith is enabled in which case we need to
2311 * make sure rsc start events happen after the stonith
2312 */
2313 xmlNode *lrm_rsc = NULL;
2314
2315 tmp = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE);
2316 tmp = find_xml_node(tmp, XML_LRM_TAG_RESOURCES, FALSE);
2317
2318 for (lrm_rsc = __xml_first_child(tmp); lrm_rsc != NULL;
2319 lrm_rsc = __xml_next(lrm_rsc)) {
2320 if (crm_str_eq((const char *)lrm_rsc->name, XML_LRM_TAG_RESOURCE, TRUE)) {
2321
2322 const char *rsc_id = crm_element_value(lrm_rsc, XML_ATTR_ID);
2323
2324 if (rsc != NULL && safe_str_neq(rsc_id, rsc)) {
2325 continue;
2326 }
2327
2328 intermediate = extract_operations(uname, rsc_id, lrm_rsc, active_filter);
2329 output = g_list_concat(output, intermediate);
2330 }
2331 }
2332 }
2333 }
2334 }
2335
2336 return output;

Callers 1

list_resource_operationsFunction · 0.85

Calls 10

find_xml_nodeFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_str_eqFunction · 0.85
crm_element_valueFunction · 0.85
safe_str_neqFunction · 0.85
pe_find_nodeFunction · 0.85
determine_online_statusFunction · 0.85
is_setFunction · 0.85
extract_operationsFunction · 0.85

Tested by

no test coverage detected