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

Function unpack_status

lib/pengine/unpack.c:584–721  ·  view source on GitHub ↗

remove nodes that are down, stopping */ create +ve rsc_to_node constraints between resources and the nodes they are running on */ anything else? */

Source from the content-addressed store, hash-verified

582/* create +ve rsc_to_node constraints between resources and the nodes they are running on */
583/* anything else? */
584gboolean
585unpack_status(xmlNode * status, pe_working_set_t * data_set)
586{
587 const char *id = NULL;
588 const char *uname = NULL;
589
590 xmlNode *state = NULL;
591 xmlNode *lrm_rsc = NULL;
592 node_t *this_node = NULL;
593
594 crm_trace("Beginning unpack");
595
596 if (data_set->tickets == NULL) {
597 data_set->tickets =
598 g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, destroy_ticket);
599 }
600
601 for (state = __xml_first_child(status); state != NULL; state = __xml_next(state)) {
602 if (crm_str_eq((const char *)state->name, XML_CIB_TAG_TICKETS, TRUE)) {
603 xmlNode *xml_tickets = state;
604 GHashTable *state_hash = NULL;
605
606 /* Compatibility with the deprecated ticket state section:
607 * Unpack the attributes in the deprecated "/cib/status/tickets/instance_attributes" if it exists. */
608 state_hash = g_hash_table_new_full(
609 crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
610
611 unpack_instance_attributes(data_set->input, xml_tickets, XML_TAG_ATTR_SETS, NULL,
612 state_hash, NULL, TRUE, data_set->now);
613
614 g_hash_table_foreach(state_hash, get_ticket_state_legacy, data_set);
615
616 if (state_hash) {
617 g_hash_table_destroy(state_hash);
618 }
619
620 /* Unpack the new "/cib/status/tickets/ticket_state"s */
621 unpack_tickets_state(xml_tickets, data_set);
622 }
623
624 if (crm_str_eq((const char *)state->name, XML_CIB_TAG_STATE, TRUE)) {
625 xmlNode *attrs = find_xml_node(state, XML_TAG_TRANSIENT_NODEATTRS, FALSE);
626
627 id = crm_element_value(state, XML_ATTR_ID);
628 uname = crm_element_value(state, XML_ATTR_UNAME);
629 crm_trace("Processing node id=%s, uname=%s", id, uname);
630 this_node = pe_find_node_any(data_set->nodes, id, uname);
631
632 if (uname == NULL) {
633 /* error */
634 continue;
635
636 } else if (this_node == NULL) {
637 crm_config_warn("Node %s in status section no longer exists", uname);
638 continue;
639 }
640
641 /* Mark the node as provisionally clean

Callers 1

cluster_statusFunction · 0.85

Calls 14

__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_str_eqFunction · 0.85
unpack_tickets_stateFunction · 0.85
find_xml_nodeFunction · 0.85
crm_element_valueFunction · 0.85
pe_find_node_anyFunction · 0.85
add_node_attrsFunction · 0.85
crm_is_trueFunction · 0.85
determine_online_statusFunction · 0.85
pe_fence_nodeFunction · 0.85

Tested by

no test coverage detected