| 551 | } |
| 552 | |
| 553 | static 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 | |
| 593 | static const char * |
| 594 | target_list_type(stonith_device_t *dev) |
no test coverage detected