Permalink
Browse files

Merge pull request #1047 from jnpkrn/refactor-attrd_update_delegate-o…

…ptions

Refactor: attrd_update_delegate options + consistent use of DIMOF
  • Loading branch information...
kgaillot committed Jun 7, 2016
2 parents 1a05449 + ecf9163 commit 61a000d352ccd076e655bad3ded5935281c10fed
Showing with 12 additions and 11 deletions.
  1. +1 −1 crmd/utils.c
  2. +3 −3 include/crm/compatibility.h
  3. +1 −1 lib/cib/cib_file.c
  4. +3 −2 tools/crm_attribute.c
  5. +1 −1 tools/crm_resource.c
  6. +3 −3 tools/crm_resource_runtime.c
View
@@ -1080,7 +1080,7 @@ update_attrd_helper(const char *host, const char *name, const char *value, const
}
rc = attrd_update_delegate(attrd_ipc, command, host, name, value, XML_CIB_TAG_STATUS, NULL,
NULL, user_name, is_remote_node);
NULL, user_name, is_remote_node?attrd_opt_remote:attrd_opt_none);
if (rc == pcmk_ok) {
break;
@@ -265,22 +265,22 @@ attrd_update(crm_ipc_t * cluster, char command, const char *host, const char *na
const char *value, const char *section, const char *set, const char *dampen)
{
return attrd_update_delegate(cluster, command, host, name, value, section, set, dampen,
NULL, FALSE) > 0;
NULL, attrd_opt_none) > 0;
}
static inline gboolean
attrd_lazy_update(char command, const char *host, const char *name,
const char *value, const char *section, const char *set, const char *dampen)
{
return attrd_update_delegate(NULL, command, host, name, value, section, set, dampen, NULL, FALSE) > 0;
return attrd_update_delegate(NULL, command, host, name, value, section, set, dampen, NULL, attrd_opt_none) > 0;
}
static inline gboolean
attrd_update_no_mainloop(int *connection, char command, const char *host,
const char *name, const char *value, const char *section,
const char *set, const char *dampen)
{
return attrd_update_delegate(NULL, command, host, name, value, section, set, dampen, NULL, FALSE) > 0;
return attrd_update_delegate(NULL, command, host, name, value, section, set, dampen, NULL, attrd_opt_none) > 0;
}
# endif
View
@@ -204,7 +204,7 @@ cib_file_is_live(const char *filename)
int i;
/* Compare against each possible live CIB name */
for (i = 0; i < sizeof(livenames)/sizeof(const char*); ++i) {
for (i = 0; i < DIMOF(livenames); ++i) {
real_livename = crm_compat_realpath(livenames[i]);
if (real_livename && !strcmp(real_filename, real_livename)) {
free(real_livename);
View
@@ -265,8 +265,9 @@ main(int argc, char **argv)
&& is_remote_node == FALSE
#endif
&& safe_str_eq(type, XML_CIB_TAG_STATUS)
&& pcmk_ok == attrd_update_delegate(NULL, command, dest_uname, attr_name, attr_value, type, set_name,
NULL, NULL, is_remote_node)) {
&& pcmk_ok == attrd_update_delegate(NULL, command, dest_uname, attr_name,
attr_value, type, set_name, NULL, NULL,
is_remote_node?attrd_opt_remote:attrd_opt_none)) {
crm_info("Update %s=%s sent via attrd", attr_name, command == 'D' ? "<none>" : attr_value);
} else if (command == 'D') {
View
@@ -988,7 +988,7 @@ main(int argc, char **argv)
crm_debug("Re-checking the state of all resources on %s", host_uname?host_uname:"all nodes");
rc = attrd_update_delegate(
NULL, 'u', host_uname, "fail-count-*", NULL, XML_CIB_TAG_STATUS, NULL, NULL, NULL, FALSE);
NULL, 'u', host_uname, "fail-count-*", NULL, XML_CIB_TAG_STATUS, NULL, NULL, NULL, attrd_opt_none);
if (crm_ipc_send(crmd_channel, cmd, 0, 0, NULL) > 0) {
start_mainloop();
@@ -589,11 +589,11 @@ cli_delete_attr(cib_t * cib_conn, const char * host_uname, const char * attr_nam
pe_working_set_t * data_set)
{
node_t *node = pe_find_node(data_set->nodes, host_uname);
gboolean is_remote = FALSE;
int attr_options = attrd_opt_none;
if (node && is_remote_node(node)) {
#if HAVE_ATOMIC_ATTRD
is_remote = TRUE;
set_bit(attr_options, attrd_opt_remote);
#else
/* Talk directly to cib for remote nodes if it's legacy attrd */
return delete_attr_delegate(cib_conn, cib_sync_call, XML_CIB_TAG_STATUS, node->details->id, NULL, NULL,
@@ -602,7 +602,7 @@ cli_delete_attr(cib_t * cib_conn, const char * host_uname, const char * attr_nam
}
return attrd_update_delegate(NULL, 'D', host_uname, attr_name, NULL,
XML_CIB_TAG_STATUS, NULL, NULL, NULL,
is_remote);
attr_options);
}
int

0 comments on commit 61a000d

Please sign in to comment.