15 #include <libxml/tree.h>    25 struct controld_api_private_s {
    27     unsigned int replies_expected;
    34     struct controld_api_private_s *
private = NULL;
    36     api->
api_data = calloc(1, 
sizeof(
struct controld_api_private_s));
    50     private->client_uuid = pcmk__getpid_s();
    62     free(((
struct controld_api_private_s *) 
data)->client_uuid);
    73     struct controld_api_private_s *
private = api->
api_data;
    92 #define xml_true(xml, field) crm_is_true(crm_element_value(xml, field))    98     if (msg_data == NULL) {
   113     if (msg_data == NULL) {
   137             node_info->
id = id_ll;
   141         data->data.nodes = g_list_prepend(
data->data.nodes, node_info);
   150     if (command == NULL) {
   165     struct controld_api_private_s *
private = api->
api_data;
   167     xmlNode *msg_data = NULL;
   168     const char *value = NULL;
   173     if (private->replies_expected > 0) {
   174         private->replies_expected--;
   187         crm_debug(
"Unrecognizable controller message: invalid message type '%s'",
   194         crm_debug(
"Unrecognizable controller message: no reference");
   201         crm_debug(
"Unrecognizable controller message: no command name");
   216         set_node_info_data(&reply_data, msg_data);
   223         set_ping_data(&reply_data, msg_data);
   226         set_nodes_data(&reply_data, msg_data);
   229         crm_debug(
"Unrecognizable controller message: unknown command '%s'",
   239         g_list_free_full(reply_data.
data.
nodes, free);
   271                           const char *node, xmlNode *msg_data)
   273     struct controld_api_private_s *
private = NULL;
   274     const char *sys_to = NULL;
   287                           private->client_uuid);
   293                         bool reply_is_expected)
   302         struct controld_api_private_s *
private = api->
api_data;
   304         private->replies_expected++;
   310 create_reprobe_message_data(
const char *target_node, 
const char *router_node)
   316     if ((router_node != NULL) && !pcmk__str_eq(router_node, target_node, 
pcmk__str_casei)) {
   334                           const char *router_node)
   343     if (router_node == NULL) {
   344         router_node = target_node;
   346     crm_debug(
"Sending %s IPC request to reprobe %s via %s",
   349     msg_data = create_reprobe_message_data(target_node, router_node);
   350     request = create_controller_request(api, 
CRM_OP_REPROBE, router_node,
   352     rc = send_controller_request(api, request, 
true);
   374     if (request == NULL) {
   381     rc = send_controller_request(api, request, 
true);
   401     request = create_controller_request(api, 
CRM_OP_PING, node_name, NULL);
   402     if (request == NULL) {
   405     rc = send_controller_request(api, request, 
true);
   426     if (request != NULL) {
   427         rc = send_controller_request(api, request, 
true);
   436                        const char *target_node, 
const char *router_node,
   437                        bool cib_only, 
const char *rsc_id,
   438                        const char *rsc_long_id, 
const char *standard,
   439                        const char *provider, 
const char *
type)
   443     xmlNode *request, *msg_data, *xml_rsc, *params;
   448     if (router_node == NULL) {
   449         router_node = target_node;
   459                                "xxxxxxxx-xrsc-opxx-xcrm-resourcexxxx");
   488     request = create_controller_request(api, op, router_node, msg_data);
   489     rc = send_controller_request(api, request, 
true);
   512                        const char *target_node, 
const char *router_node,
   513                        const char *rsc_id, 
const char *rsc_long_id,
   514                        const char *standard, 
const char *provider,
   517     crm_debug(
"Sending %s IPC request to fail %s (a.k.a. %s) on %s via %s",
   521                                   router_node, 
false, rsc_id, rsc_long_id,
   522                                   standard, provider, 
type);
   543                           const char *router_node,
   544                           const char *rsc_id, 
const char *rsc_long_id,
   545                           const char *standard, 
const char *provider,
   546                           const char *
type, 
bool cib_only)
   548     crm_debug(
"Sending %s IPC request to refresh %s (a.k.a. %s) on %s via %s",
   552                                   router_node, cib_only, rsc_id, rsc_long_id,
   553                                   standard, provider, 
type);
   566     struct controld_api_private_s *
private = api->
api_data;
   568     return private->replies_expected;
   579                      const char *major_version, 
const char *minor_version)
   581     xmlNode *hello_node = NULL;
   582     xmlNode *hello = NULL;
   584     if (pcmk__str_empty(uuid) || pcmk__str_empty(client_name)
   585         || pcmk__str_empty(major_version) || pcmk__str_empty(minor_version)) {
   586         crm_err(
"Could not create IPC hello message from %s (UUID %s): "   587                 "missing information",
   588                 client_name? client_name : 
"unknown client",
   589                 uuid? uuid : 
"unknown");
   594     if (hello_node == NULL) {
   595         crm_err(
"Could not create IPC hello message from %s (UUID %s): "   596                 "Message data creation failed", client_name, uuid);
   600     crm_xml_add(hello_node, 
"major_version", major_version);
   601     crm_xml_add(hello_node, 
"minor_version", minor_version);
   602     crm_xml_add(hello_node, 
"client_name", client_name);
   607         crm_err(
"Could not create IPC hello message from %s (UUID %s): "   608                 "Request creation failed", client_name, uuid);
   613     crm_trace(
"Created hello message from %s (UUID %s)", client_name, uuid);
 
xmlNode * get_message_xml(xmlNode *msg, const char *field)
 
void(* dispatch)(pcmk_ipc_api_t *api, xmlNode *msg)
 
enum pcmk_controld_api_reply reply_type
 
int pcmk_controld_api_reprobe(pcmk_ipc_api_t *api, const char *target_node, const char *router_node)
Send a reprobe controller operation. 
 
const char * host_from
Name of node that sent reply. 
 
xmlNode * first_named_child(const xmlNode *parent, const char *name)
 
#define PCMK__CONTROLD_API_MAJOR
 
#define XML_PING_ATTR_CRMDSTATE
 
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value. 
 
#define XML_GRAPH_TAG_RSC_OP
 
enum crm_exit_e crm_exit_t
 
enum crm_ais_msg_types type
 
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code. 
 
int crm_element_value_ll(const xmlNode *data, const char *name, long long *dest)
Retrieve the long long integer value of an XML attribute. 
 
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute. 
 
G_GNUC_INTERNAL void pcmk__call_ipc_callback(pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, crm_exit_t status, void *event_data)
 
char * crm_meta_name(const char *field)
 
union pcmk_controld_api_reply_t::@0 data
 
#define PCMK__CONTROLD_API_MINOR
 
#define crm_debug(fmt, args...)
 
#define XML_PING_ATTR_STATUS
 
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute. 
 
#define XML_CIB_TAG_RESOURCE
 
xmlNode * create_hello_message(const char *uuid, const char *client_name, const char *major_version, const char *minor_version)
Create XML for a controller IPC "hello" message. 
 
unsigned int pcmk_controld_api_replies_expected(pcmk_ipc_api_t *api)
Get the number of IPC replies currently expected from the controller. 
 
#define crm_trace(fmt, args...)
 
const char * feature_set
CRM feature set advertised by controller. 
 
void crm_xml_set_id(xmlNode *xml, const char *format,...) G_GNUC_PRINTF(2
 
pcmk__ipc_methods_t * pcmk__controld_api_methods()
 
#define XML_AGENT_ATTR_PROVIDER
 
#define XML_ATTR_HAVE_QUORUM
 
const char * pcmk_ipc_name(pcmk_ipc_api_t *api, bool for_log)
Get the IPC name used with an IPC API connection. 
 
Wrappers for and extensions to libxml2. 
 
int pcmk_controld_api_refresh(pcmk_ipc_api_t *api, const char *target_node, const char *router_node, const char *rsc_id, const char *rsc_long_id, const char *standard, const char *provider, const char *type, bool cib_only)
Ask the controller to refresh a resource. 
 
xmlNode * create_xml_node(xmlNode *parent, const char *name)
 
G_GNUC_INTERNAL int pcmk__send_ipc_request(pcmk_ipc_api_t *api, xmlNode *request)
 
#define XML_NODE_IS_REMOTE
 
#define XML_LRM_ATTR_ROUTER_NODE
 
void free_xml(xmlNode *child)
 
int(* post_connect)(pcmk_ipc_api_t *api)
 
IPC commands for Pacemaker controller. 
 
#define xml_true(xml, field)
 
int pcmk_controld_api_list_nodes(pcmk_ipc_api_t *api)
Ask the controller for cluster information. 
 
#define XML_PING_ATTR_SYSFROM
 
#define XML_ATTR_TRANSITION_KEY
 
int(* new_data)(pcmk_ipc_api_t *api)
 
int pcmk_controld_api_node_info(pcmk_ipc_api_t *api, uint32_t nodeid)
Send a "node info" controller operation. 
 
int pcmk_controld_api_ping(pcmk_ipc_api_t *api, const char *node_name)
Ask the controller for status. 
 
#define crm_err(fmt, args...)
 
#define XML_ATTR_REFERENCE
 
void(* free_data)(void *api_data)
 
#define XML_ATTR_RESPONSE
 
#define XML_ATTR_CRM_VERSION
 
char * pcmk__transition_key(int transition_id, int action_id, int target_rc, const char *node)
 
bool(* reply_expected)(pcmk_ipc_api_t *api, xmlNode *request)
 
#define CRM_OP_INVOKE_LRM
 
IPC interface to Pacemaker daemons. 
 
struct pcmk_controld_api_reply_t::@0::@2 resource
 
#define XML_NODE_IN_CLUSTER
 
#define PCMK__CONTROLD_CMD_NODES
 
#define XML_LRM_ATTR_TARGET
 
Daemon's reply to client IPC request. 
 
#define CRM_OP_LRM_DELETE
 
#define create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from)
 
#define crm_info(fmt, args...)
 
int pcmk_controld_api_fail(pcmk_ipc_api_t *api, const char *target_node, const char *router_node, const char *rsc_id, const char *rsc_long_id, const char *standard, const char *provider, const char *type)
Ask the controller to fail a resource. 
 
#define XML_AGENT_ATTR_CLASS
 
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.