24 const char *
name = NULL;
38 data->data.pairs = g_list_prepend(
data->data.pairs, pair);
60 const char *value = NULL;
73 if (pcmk__str_empty(value)
75 crm_info(
"Unrecognizable message from attribute manager: " 93 set_pairs_data(&reply_data, reply);
96 crm_info(
"Unrecognizable message from attribute manager: " 97 "message subtype '%s' unknown", pcmk__s(value,
""));
107 g_list_free_full(reply_data.
data.
pairs, free);
137 create_attrd_op(
const char *user_name)
149 connect_and_send_attrd_request(
pcmk_ipc_api_t *api,
const xmlNode *request)
152 bool created_api =
false;
178 const char *resource,
const char *operation,
179 const char *interval_spec,
const char *user_name,
183 xmlNode *request = create_attrd_op(user_name);
184 const char *interval_desc = NULL;
185 const char *op_desc = NULL;
193 interval_desc = pcmk__s(interval_spec,
"nonrecurring");
196 interval_desc =
"all";
197 op_desc =
"operations";
199 crm_debug(
"Asking %s to clear failure of %s %s for %s on %s",
201 pcmk__s(resource,
"all resources"), pcmk__s(node,
"all nodes"));
211 rc = connect_and_send_attrd_request(api, request);
221 const char *
target = NULL;
244 xmlNode *request = NULL;
251 crm_debug(
"Asking %s to purge transient attributes%s for %s",
253 (reap?
" and node cache entries" :
""),
254 pcmk__s(node,
"local node"));
256 request = create_attrd_op(NULL);
262 rc = connect_and_send_attrd_request(api, request);
273 xmlNode *request = NULL;
274 const char *
target = NULL;
287 }
else if (node == NULL) {
292 crm_debug(
"Querying %s for value of '%s'%s%s",
294 ((node == NULL)?
"" :
" on "), pcmk__s(node,
""));
296 request = create_attrd_op(NULL);
302 rc = connect_and_send_attrd_request(api, request);
311 xmlNode *request = NULL;
318 crm_debug(
"Asking %s to write all transient attributes for %s to CIB",
321 request = create_attrd_op(NULL);
326 rc = connect_and_send_attrd_request(api, request);
333 add_op_attr(xmlNode *op, uint32_t options)
345 populate_update_op(xmlNode *op,
const char *node,
const char *
name,
const char *value,
346 const char *dampen,
const char *
set, uint32_t options)
360 add_op_attr(op, options);
380 const char *value,
const char *dampen,
const char *
set,
381 const char *user_name, uint32_t options)
384 xmlNode *request = NULL;
385 const char *
target = NULL;
397 crm_debug(
"Asking %s to update '%s' to '%s' for %s",
399 pcmk__s(node,
"local node"));
401 request = create_attrd_op(user_name);
402 populate_update_op(request, node,
name, value, dampen,
set, options);
404 rc = connect_and_send_attrd_request(api, request);
412 const char *
set,
const char *user_name,
416 xmlNode *request = NULL;
444 for (GList *iter = attrs; iter != NULL; iter = iter->next) {
448 const char *
target = NULL;
449 xmlNode *child = NULL;
452 if (request == NULL) {
453 request = create_attrd_op(user_name);
454 add_op_attr(request, options);
469 populate_update_op(child, pair->
node, pair->
name, pair->
value, dampen,
473 dampen,
set, user_name, options);
481 rc = connect_and_send_attrd_request(api, request);
#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)
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
#define PCMK__ATTRD_CMD_UPDATE_BOTH
#define PCMK__XA_ATTR_CLEAR_INTERVAL
enum pcmk_ipc_dispatch dispatch_type
#define PCMK__ATTRD_CMD_PEER_REMOVE
void pcmk__xe_set_bool_attr(xmlNodePtr node, const char *name, bool value)
#define PCMK__VALUE_ATTRD
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)
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.
enum crm_exit_e crm_exit_t
#define PCMK__ATTRD_CMD_CLEAR_FAILURE
#define PCMK__XA_ATTR_REGEX
const char * pcmk__node_attr_target(const char *name)
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)
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
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)
void pcmk__xml_free(xmlNode *xml)
#define PCMK__XA_ATTR_NAME
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)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
int pcmk__attrd_api_purge(pcmk_ipc_api_t *api, const char *node, bool reap)
#define PCMK__XA_ATTR_CLEAR_OPERATION
#define PCMK__XA_ATTR_SYNC_POINT
union pcmk__attrd_api_reply_t::@0 data
#define crm_debug(fmt, args...)
#define PCMK__ATTRD_CMD_REFRESH
#define PCMK_XE_UTILIZATION
G_GNUC_INTERNAL int pcmk__send_ipc_request(pcmk_ipc_api_t *api, const xmlNode *request)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Wrappers for and extensions to libxml2.
#define PCMK__XA_ATTR_IS_PRIVATE
#define PCMK__ATTRD_CMD_QUERY
#define PCMK__XA_ATTR_DAMPENING
#define PCMK__XA_ATTR_RESOURCE
#define PCMK__ATTRD_CMD_UPDATE
#define PCMK__XA_ATTR_SET_TYPE
int(* post_connect)(pcmk_ipc_api_t *api)
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
#define PCMK__XA_ATTR_SET
enum pcmk__attrd_api_reply reply_type
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
const xmlChar * pcmkXmlStr
#define PCMK__XA_ATTR_HOST
int(* new_data)(pcmk_ipc_api_t *api)
pcmk_ipc_dispatch
How IPC replies should be dispatched.
int pcmk__attrd_api_delete(pcmk_ipc_api_t *api, const char *node, const char *name, uint32_t options)
bool(* dispatch)(pcmk_ipc_api_t *api, xmlNode *msg)
bool(* reply_expected)(pcmk_ipc_api_t *api, const xmlNode *request)
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__XA_ATTR_VALUE
#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.
IPC interface to Pacemaker daemons.
pcmk__ipc_methods_t * pcmk__attrd_api_methods(void)
#define PCMK__XA_ATTR_USER
#define PCMK__XA_ATTR_IS_REMOTE
void pcmk__xe_add_node(xmlNode *xml, const char *node, int nodeid)
Daemon's reply to client IPC request.
#define pcmk__assert_alloc(nmemb, size)
#define PCMK_XE_INSTANCE_ATTRIBUTES
#define PCMK__VALUE_LOCAL
#define crm_info(fmt, args...)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.