31 create_attrd_op(
const char *user_name)
52 send_attrd_op(
crm_ipc_t *ipc, xmlNode *attrd_op)
57 static gboolean connected = TRUE;
61 if (ipc == NULL && local_ipc == NULL) {
72 if (connected == FALSE) {
73 crm_info(
"Connecting to cluster... %d retries remaining", max);
80 crm_perror(LOG_INFO,
"Connection to cluster attribute manager failed");
83 if (ipc != local_ipc) {
89 }
else if (rc == -EAGAIN || rc == -EALREADY) {
134 const char *
name,
const char *value,
135 const char *section,
const char *set,
136 const char *dampen,
const char *user_name,
int options)
139 const char *task = NULL;
140 const char *name_as = NULL;
141 const char *display_host = (host ? host :
"localhost");
142 const char *display_command = NULL;
143 xmlNode *update = create_attrd_op(user_name);
153 if (name == NULL && command ==
'U') {
170 display_command =
"refresh";
186 display_command =
"purge";
190 if (name_as != NULL) {
209 rc = send_attrd_op(ipc, update);
214 if (display_command) {
215 crm_debug(
"Asked pacemaker-attrd to %s %s: %s (%d)",
216 display_command, display_host,
pcmk_rc_str(rc), rc);
218 crm_debug(
"Asked pacemaker-attrd to update %s=%s for %s: %s (%d)",
240 const char *resource,
const char *operation,
241 const char *interval_spec,
const char *user_name,
245 xmlNode *clear_op = create_attrd_op(user_name);
246 const char *interval_desc = NULL;
247 const char *op_desc = NULL;
257 rc = send_attrd_op(ipc, clear_op);
261 interval_desc = interval_spec? interval_spec :
"nonrecurring";
264 interval_desc =
"all";
265 op_desc =
"operations";
267 crm_debug(
"Asked pacemaker-attrd to clear failure of %s %s for %s on %s: %s (%d)",
268 interval_desc, op_desc, (resource? resource :
"all resources"),
273 #define LRM_TARGET_ENV "OCF_RESKEY_" CRM_META "_" XML_LRM_ATTR_TARGET
284 const char *
target = getenv(target_var);
285 const char *host_physical = getenv(phys_var);
289 name = host_physical;
322 if (rsc_id == NULL) {
323 rsc_id = getenv(
"OCF_RESOURCE_INSTANCE");
324 if (rsc_id == NULL) {
#define PCMK__XA_ATTR_DAMPENING
#define PCMK__ATTRD_CMD_UPDATE_DELAY
#define PCMK__XA_ATTR_NAME
bool crm_ipc_connect(crm_ipc_t *client)
Establish an IPC connection to a Pacemaker component.
#define PCMK__ATTRD_CMD_UPDATE_BOTH
const char * pcmk__node_attr_target(const char *name)
#define PCMK__ATTRD_CMD_PEER_REMOVE
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
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
char * pcmk_promotion_score_name(const char *rsc_id)
Return the name of the node attribute used as a promotion score.
#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.
#define XML_CIB_TAG_NODES
#define XML_RSC_ATTR_TARGET
char * crm_meta_name(const char *field)
#define PCMK__XA_ATTR_SECTION
#define crm_debug(fmt, args...)
int pcmk__node_attr_request(crm_ipc_t *ipc, char command, const char *host, const char *name, const char *value, const char *section, const char *set, const char *dampen, const char *user_name, int options)
struct crm_ipc_s crm_ipc_t
#define PCMK__XA_ATTR_OPERATION
#define PCMK__ATTRD_CMD_REFRESH
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
int pcmk__node_attr_request_clear(crm_ipc_t *ipc, const char *host, const char *resource, const char *operation, const char *interval_spec, const char *user_name, int options)
#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
int pcmk_legacy2rc(int legacy_rc)
#define PCMK__ATTRD_CMD_UPDATE
void free_xml(xmlNode *child)
#define PCMK__ENV_PHYSICAL_HOST
#define PCMK__XA_ATTR_NODE_NAME
#define crm_perror(level, fmt, args...)
Send a system error message to both the log and stderr.
#define pcmk__set_ipc_flags(ipc_flags, ipc_name, flags_to_set)
int crm_ipc_send(crm_ipc_t *client, xmlNode *message, enum crm_ipc_flags flags, int32_t ms_timeout, xmlNode **reply)
Send an IPC XML message.
crm_ipc_t * crm_ipc_new(const char *name, size_t max_size)
Create a new (legacy) object for using Pacemaker daemon IPC.
#define PCMK__XA_ATTR_IS_REMOTE
#define XML_CIB_TAG_STATUS
#define PCMK__XA_ATTR_PATTERN
#define PCMK__XA_ATTR_SET
void crm_ipc_close(crm_ipc_t *client)
#define crm_info(fmt, args...)