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

Function build_device_from_xml

fencing/commands.c:553–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553static stonith_device_t *build_device_from_xml(xmlNode *msg)
554{
555 const char *value = NULL;
556 xmlNode *dev = get_xpath_object("//"F_STONITH_DEVICE, msg, LOG_ERR);
557 stonith_device_t *device = NULL;
558
559 device = calloc(1, sizeof(stonith_device_t));
560 device->id = crm_element_value_copy(dev, XML_ATTR_ID);
561 device->agent = crm_element_value_copy(dev, "agent");
562 device->namespace = crm_element_value_copy(dev, "namespace");
563 device->params = xml2list(dev);
564
565 value = g_hash_table_lookup(device->params, STONITH_ATTR_HOSTLIST);
566 if(value) {
567 device->targets = parse_host_list(value);
568 }
569
570 value = g_hash_table_lookup(device->params, STONITH_ATTR_HOSTMAP);
571 device->aliases = build_port_aliases(value, &(device->targets));
572
573 device->agent_metadata = get_agent_metadata(device->agent);
574 device->on_target_actions = get_on_target_actions(device->agent_metadata);
575
576 value = g_hash_table_lookup(device->params, "nodeid");
577 if (!value) {
578 device->include_nodeid = is_nodeid_required(device->agent_metadata);
579 }
580
581 if (device->on_target_actions) {
582 crm_info("The fencing device '%s' requires actions (%s) to be executed on the target node",
583 device->id,
584 device->on_target_actions);
585 }
586
587 device->work = mainloop_add_trigger(G_PRIORITY_HIGH, stonith_device_dispatch, device);
588 /* TODO: Hook up priority */
589
590 return device;
591}
592
593static const char *
594target_list_type(stonith_device_t *dev)

Callers 1

stonith_device_registerFunction · 0.85

Calls 9

get_xpath_objectFunction · 0.85
crm_element_value_copyFunction · 0.85
xml2listFunction · 0.85
parse_host_listFunction · 0.85
build_port_aliasesFunction · 0.85
get_agent_metadataFunction · 0.85
get_on_target_actionsFunction · 0.85
is_nodeid_requiredFunction · 0.85
mainloop_add_triggerFunction · 0.85

Tested by

no test coverage detected