28 const char *
name = NULL;
42 data->data.pairs = g_list_prepend(
data->data.pairs, pair);
64 const char *value = NULL;
77 if (pcmk__str_empty(value)
79 crm_info(
"Unrecognizable message from attribute manager: " 97 set_pairs_data(&reply_data, reply);
100 crm_info(
"Unrecognizable message from attribute manager: " 101 "message subtype '%s' unknown", pcmk__s(value,
""));
111 g_list_free_full(reply_data.
data.
pairs, free);
141 create_attrd_op(
const char *user_name)
153 connect_and_send_attrd_request(
pcmk_ipc_api_t *api,
const xmlNode *request)
156 bool created_api =
false;
179 const char *resource,
const char *operation,
180 const char *interval_spec,
const char *user_name,
184 xmlNode *request = create_attrd_op(user_name);
185 const char *interval_desc = NULL;
186 const char *op_desc = NULL;
194 interval_desc = pcmk__s(interval_spec,
"nonrecurring");
197 interval_desc =
"all";
198 op_desc =
"operations";
200 crm_debug(
"Asking %s to clear failure of %s %s for %s on %s",
202 pcmk__s(resource,
"all resources"), pcmk__s(node,
"all nodes"));
212 rc = connect_and_send_attrd_request(api, request);
222 const char *
target = NULL;
245 xmlNode *request = NULL;
252 crm_debug(
"Asking %s to purge transient attributes%s for %s",
254 (reap?
" and node cache entries" :
""),
255 pcmk__s(node,
"local node"));
257 request = create_attrd_op(NULL);
263 rc = connect_and_send_attrd_request(api, request);
274 xmlNode *request = NULL;
275 const char *
target = NULL;
291 crm_debug(
"Querying %s for value of '%s'%s%s",
293 ((node == NULL)?
"" :
" on "), pcmk__s(node,
""));
295 request = create_attrd_op(NULL);
301 rc = connect_and_send_attrd_request(api, request);
310 xmlNode *request = NULL;
317 crm_debug(
"Asking %s to write all transient attributes for %s to CIB",
320 request = create_attrd_op(NULL);
325 rc = connect_and_send_attrd_request(api, request);
332 add_op_attr(xmlNode *op, uint32_t options)
344 populate_update_op(xmlNode *op,
const char *node,
const char *
name,
const char *value,
345 const char *dampen,
const char *
set, uint32_t options)
359 add_op_attr(op, options);
379 const char *value,
const char *dampen,
const char *
set,
380 const char *user_name, uint32_t options)
383 xmlNode *request = NULL;
384 const char *
target = NULL;
396 crm_debug(
"Asking %s to update '%s' to '%s' for %s",
398 pcmk__s(node,
"local node"));
400 request = create_attrd_op(user_name);
401 populate_update_op(request, node,
name, value, dampen,
set, options);
403 rc = connect_and_send_attrd_request(api, request);
411 const char *
set,
const char *user_name,
415 xmlNode *request = NULL;
443 for (GList *iter = attrs; iter != NULL; iter = iter->next) {
447 const char *
target = NULL;
448 xmlNode *child = NULL;
451 if (request == NULL) {
452 request = create_attrd_op(user_name);
453 add_op_attr(request, options);
468 populate_update_op(child, pair->
node, pair->
name, pair->
value, dampen,
472 dampen,
set, user_name, options);
480 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)
#define PCMK__ATTRD_CMD_UPDATE_BOTH
#define PCMK__XA_ATTR_CLEAR_INTERVAL
#define PCMK__ATTRD_CMD_PEER_REMOVE
#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.
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.
void pcmk__xe_set_bool_attr(xmlNodePtr node, const char *name, bool value)
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)
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)
#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)
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...)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define PCMK__ATTRD_CMD_REFRESH
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
#define PCMK_XE_UTILIZATION
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.
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
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
#define PCMK__XA_ATTR_SET
enum pcmk__attrd_api_reply reply_type
const xmlChar * pcmkXmlStr
#define PCMK__XA_ATTR_HOST
int(* new_data)(pcmk_ipc_api_t *api)
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.
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
#define pcmk__assert_alloc(nmemb, size)
#define PCMK_XE_INSTANCE_ATTRIBUTES
#define PCMK__VALUE_LOCAL
xmlNode * pcmk__xe_next_same(const xmlNode *node)
#define crm_info(fmt, args...)