28 const char *
name = NULL;
42 data->data.pairs = g_list_prepend(
data->data.pairs, pair);
64 const char *value = NULL;
71 if (pcmk__str_eq((
const char *) reply->name,
"ack",
pcmk__str_none)) {
77 if (pcmk__str_empty(value)
79 crm_info(
"Unrecognizable message from attribute manager: " 80 "message type '%s' not '" T_ATTRD "'", pcmk__s(value,
""));
96 set_pairs_data(&reply_data, reply);
99 crm_info(
"Unrecognizable message from attribute manager: " 100 "message subtype '%s' unknown", pcmk__s(value,
""));
110 g_list_free_full(reply_data.
data.
pairs, free);
140 create_attrd_op(
const char *user_name)
172 connect_and_send_attrd_request(
pcmk_ipc_api_t *api,
const xmlNode *request)
178 crm_err(
"Could not connect to %s: %s",
185 crm_err(
"Could not send request to %s: %s",
201 const char *resource,
const char *operation,
202 const char *interval_spec,
const char *user_name,
206 xmlNode *request = create_attrd_op(user_name);
207 const char *interval_desc = NULL;
208 const char *op_desc = NULL;
224 rc = create_api(&api);
229 rc = connect_and_send_attrd_request(api, request);
233 rc = connect_and_send_attrd_request(api, request);
236 rc = send_attrd_request(api, request);
242 interval_desc = interval_spec? interval_spec :
"nonrecurring";
245 interval_desc =
"all";
246 op_desc =
"operations";
249 crm_debug(
"Asked pacemaker-attrd to clear failure of %s %s for %s on %s: %s (%d)",
250 interval_desc, op_desc, (resource? resource :
"all resources"),
260 const char *
target = NULL;
283 xmlNode *request = NULL;
284 const char *display_host = (node ? node :
"localhost");
291 request = create_attrd_op(NULL);
297 rc = create_api(&api);
302 rc = connect_and_send_attrd_request(api, request);
306 rc = connect_and_send_attrd_request(api, request);
309 rc = send_attrd_request(api, request);
314 crm_debug(
"Asked pacemaker-attrd to purge %s: %s (%d)",
325 xmlNode *request = NULL;
326 const char *
target = NULL;
342 request = create_attrd_op(NULL);
348 rc = send_attrd_request(api, request);
352 crm_debug(
"Queried pacemaker-attrd for %s on %s: %s (%d)",
355 crm_debug(
"Queried pacemaker-attrd for %s: %s (%d)",
366 xmlNode *request = NULL;
367 const char *display_host = (node ? node :
"localhost");
374 request = create_attrd_op(NULL);
380 rc = create_api(&api);
385 rc = connect_and_send_attrd_request(api, request);
389 rc = connect_and_send_attrd_request(api, request);
392 rc = send_attrd_request(api, request);
397 crm_debug(
"Asked pacemaker-attrd to refresh %s: %s (%d)",
404 add_op_attr(xmlNode *op, uint32_t options)
416 populate_update_op(xmlNode *op,
const char *node,
const char *
name,
const char *value,
417 const char *dampen,
const char *
set, uint32_t options)
431 add_op_attr(op, options);
451 const char *value,
const char *dampen,
const char *
set,
452 const char *user_name, uint32_t options)
455 xmlNode *request = NULL;
456 const char *display_host = (node ? node :
"localhost");
457 const char *
target = NULL;
469 request = create_attrd_op(user_name);
470 populate_update_op(request, node,
name, value, dampen,
set, options);
473 rc = create_api(&api);
478 rc = connect_and_send_attrd_request(api, request);
482 rc = connect_and_send_attrd_request(api, request);
485 rc = send_attrd_request(api, request);
490 crm_debug(
"Asked pacemaker-attrd to update %s on %s: %s (%d)",
498 const char *
set,
const char *user_name,
502 xmlNode *request = NULL;
530 for (GList *iter = attrs; iter != NULL; iter = iter->next) {
534 const char *
target = NULL;
535 xmlNode *child = NULL;
538 if (request == NULL) {
539 request = create_attrd_op(user_name);
540 add_op_attr(request, options);
555 populate_update_op(child, pair->
node, pair->
name, pair->
value, dampen,
559 dampen,
set, user_name, options);
567 bool created_api =
false;
570 rc = create_api(&api);
578 rc = connect_and_send_attrd_request(api, request);
#define PCMK__XA_ATTR_DAMPENING
#define PCMK__ATTRD_CMD_UPDATE_DELAY
int pcmk__attrd_api_query(pcmk_ipc_api_t *api, const char *node, const char *name, uint32_t options)
#define PCMK__XA_ATTR_NAME
#define PCMK__ATTRD_CMD_UPDATE_BOTH
const char * pcmk__node_attr_target(const char *name)
#define PCMK__ATTRD_CMD_PEER_REMOVE
int pcmk__attrd_api_update_list(pcmk_ipc_api_t *api, GList *attrs, const char *dampen, const char *set, const char *user_name, uint32_t options)
#define XML_TAG_UTILIZATION
int pcmk__attrd_api_refresh(pcmk_ipc_api_t *api, const char *node)
int pcmk_new_ipc_api(pcmk_ipc_api_t **api, enum pcmk_ipc_server server)
Create a new object for using Pacemaker daemon IPC.
#define PCMK__XA_ATTR_SET_TYPE
xmlNode * first_named_child(const xmlNode *parent, const char *name)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#define PCMK__XA_ATTR_VALUE
enum crm_exit_e crm_exit_t
#define PCMK__XA_ATTR_RESOURCE
#define PCMK__ATTRD_CMD_CLEAR_FAILURE
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
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)
int pcmk__connect_ipc(pcmk_ipc_api_t *api, enum pcmk_ipc_dispatch dispatch_type, int attempts)
int pcmk__attrd_api_clear_failures(pcmk_ipc_api_t *api, const char *node, const char *resource, const char *operation, const char *interval_spec, const char *user_name, uint32_t options)
int pcmk__attrd_api_update(pcmk_ipc_api_t *api, const char *node, const char *name, const char *value, const char *dampen, const char *set, const char *user_name, uint32_t options)
#define XML_TAG_ATTR_SETS
union pcmk__attrd_api_reply_t::@0 data
#define crm_debug(fmt, args...)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define PCMK__XA_ATTR_OPERATION
#define PCMK__ATTRD_CMD_REFRESH
G_GNUC_INTERNAL int pcmk__send_ipc_request(pcmk_ipc_api_t *api, const xmlNode *request)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
#define PCMK__XA_ATTR_INTERVAL
#define PCMK__XA_ATTR_IS_PRIVATE
xmlNode * create_xml_node(xmlNode *parent, const char *name)
#define PCMK__XA_ATTR_USER
#define PCMK__ATTRD_CMD_QUERY
#define PCMK__ATTRD_CMD_UPDATE
void free_xml(xmlNode *child)
int(* post_connect)(pcmk_ipc_api_t *api)
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
enum pcmk__attrd_api_reply reply_type
int pcmk__attrd_api_purge(pcmk_ipc_api_t *api, const char *node)
const xmlChar * pcmkXmlStr
int(* new_data)(pcmk_ipc_api_t *api)
#define PCMK__XA_ATTR_SYNC_POINT
int pcmk__attrd_api_delete(pcmk_ipc_api_t *api, const char *node, const char *name, uint32_t options)
#define PCMK__XA_ATTR_NODE_NAME
bool(* dispatch)(pcmk_ipc_api_t *api, xmlNode *msg)
bool(* reply_expected)(pcmk_ipc_api_t *api, const xmlNode *request)
#define crm_err(fmt, args...)
Sending a command will wait for any reply.
void pcmk_free_ipc_api(pcmk_ipc_api_t *api)
Free the contents of an IPC API object.
#define PCMK__VALUE_CLUSTER
void(* free_data)(void *api_data)
const char * pcmk_ipc_name(const pcmk_ipc_api_t *api, bool for_log)
Get the IPC name used with an IPC API connection.
#define PCMK__XA_ATTR_IS_REMOTE
IPC interface to Pacemaker daemons.
pcmk__ipc_methods_t * pcmk__attrd_api_methods(void)
#define PCMK__XA_ATTR_PATTERN
void pcmk__xe_add_node(xmlNode *xml, const char *node, int nodeid)
Daemon's reply to client IPC request.
#define PCMK__XA_ATTR_SET
#define PCMK__VALUE_LOCAL
#define crm_info(fmt, args...)
void pcmk_disconnect_ipc(pcmk_ipc_api_t *api)
Disconnect an IPC API instance.
bool pcmk_ipc_is_connected(pcmk_ipc_api_t *api)
Check whether an IPC API connection is active.
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.