30 create_attrd_op(
const char *user_name)
53 send_attrd_op(
crm_ipc_t *ipc, xmlNode *attrd_op)
58 static gboolean connected = TRUE;
62 if (ipc == NULL && local_ipc == NULL) {
73 if (connected == FALSE) {
74 crm_info(
"Connecting to cluster... %d retries remaining", max);
81 crm_perror(LOG_INFO,
"Connection to cluster attribute manager failed");
84 if (ipc != local_ipc) {
90 }
else if (rc == -EAGAIN || rc == -EALREADY) {
136 const char *name,
const char *value,
const char *section,
137 const char *set,
const char *dampen,
138 const char *user_name,
int options)
141 const char *task = NULL;
142 const char *name_as = NULL;
143 const char *display_host = (host ? host :
"localhost");
144 const char *display_command = NULL;
145 xmlNode *update = create_attrd_op(user_name);
155 if (name == NULL && command ==
'U') {
172 display_command =
"refresh";
188 display_command =
"purge";
192 if (name_as != NULL) {
209 rc = send_attrd_op(ipc, update);
214 if (display_command) {
215 crm_debug(
"Asked attrd to %s %s: %s (%d)",
218 crm_debug(
"Asked attrd to update %s=%s for %s: %s (%d)",
237 const char *operation,
const char *interval,
238 const char *user_name,
int options)
241 xmlNode *clear_op = create_attrd_op(user_name);
250 rc = send_attrd_op(ipc, clear_op);
253 crm_debug(
"Asked attrd to clear failure of %s (interval %s) for %s on %s: %s (%d)",
254 (operation? operation :
"all operations"),
255 (interval? interval :
"0"),
256 (resource? resource :
"all resources"),
261 #define LRM_TARGET_ENV "OCF_RESKEY_" CRM_META "_" XML_LRM_ATTR_TARGET
276 const char *target = getenv(target_var);
277 const char *host_physical = getenv(phys_var);
280 if (host_physical &&
safe_str_eq(target,
"host")) {
281 name = host_physical;
bool crm_ipc_connect(crm_ipc_t *client)
Establish an IPC connection to a Pacemaker component.
const char * pcmk_strerror(int rc)
#define XML_CIB_TAG_NODES
#define XML_RSC_ATTR_TARGET
#define attrd_opt_private
char * crm_meta_name(const char *field)
#define ATTRD_OP_PEER_REMOVE
int attrd_clear_delegate(crm_ipc_t *ipc, const char *host, const char *resource, const char *operation, const char *interval, const char *user_name, int options)
Send a request to attrd to clear resource failure.
#define F_ATTRD_OPERATION
#define PCMK_ENV_PHYSICAL_HOST
const char * attrd_get_target(const char *name)
#define F_ATTRD_ATTRIBUTE
#define ATTRD_OP_UPDATE_BOTH
#define crm_debug(fmt, args...)
struct crm_ipc_s crm_ipc_t
#define F_ATTRD_IS_PRIVATE
xmlNode * create_xml_node(xmlNode *parent, const char *name)
#define F_ATTRD_IS_REMOTE
void free_xml(xmlNode *child)
#define ATTRD_OP_CLEAR_FAILURE
int attrd_update_delegate(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)
Send a request to attrd.
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
#define crm_perror(level, fmt, args...)
Log a system error message.
int crm_ipc_send(crm_ipc_t *client, xmlNode *message, enum crm_ipc_flags flags, int32_t ms_timeout, xmlNode **reply)
crm_ipc_t * crm_ipc_new(const char *name, size_t max_size)
#define XML_CIB_TAG_STATUS
#define safe_str_eq(a, b)
void crm_ipc_close(crm_ipc_t *client)
#define ATTRD_OP_UPDATE_DELAY
#define crm_info(fmt, args...)