Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions daemons/attrd/attrd_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static xmlNode *build_query_reply(const char *attr, const char *host)
return reply;
}

xmlNode *
void
attrd_client_clear_failure(pcmk__request_t *request)
{
xmlNode *xml = request->xml;
Expand All @@ -97,7 +97,7 @@ attrd_client_clear_failure(pcmk__request_t *request)
*/
attrd_send_message(NULL, xml, false);
pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return NULL;
return;
}

rsc = pcmk__xe_get(xml, PCMK__XA_ATTR_RESOURCE);
Expand Down Expand Up @@ -134,10 +134,10 @@ attrd_client_clear_failure(pcmk__request_t *request)
pcmk__xe_remove_attr(xml, PCMK__XA_ATTR_NAME);
pcmk__xe_remove_attr(xml, PCMK__XA_ATTR_VALUE);

return attrd_client_update(request);
attrd_client_update(request);
}

xmlNode *
void
attrd_client_peer_remove(pcmk__request_t *request)
{
xmlNode *xml = request->xml;
Expand Down Expand Up @@ -181,7 +181,6 @@ attrd_client_peer_remove(pcmk__request_t *request)
}

pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return NULL;
}

xmlNode *
Expand Down Expand Up @@ -217,7 +216,7 @@ attrd_client_query(pcmk__request_t *request)
return reply;
}

xmlNode *
void
attrd_client_refresh(pcmk__request_t *request)
{
crm_info("Updating all attributes");
Expand All @@ -226,7 +225,6 @@ attrd_client_refresh(pcmk__request_t *request)
attrd_write_attributes(attrd_write_all|attrd_write_no_delay);

pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return NULL;
}

static void
Expand Down Expand Up @@ -388,13 +386,13 @@ send_child_update(xmlNode *child, void *data)
return pcmk_rc_ok;
}

xmlNode *
void
attrd_client_update(pcmk__request_t *request)
{
xmlNode *xml = NULL;
const char *attr, *value, *regex;

CRM_CHECK((request != NULL) && (request->xml != NULL), return NULL);
CRM_CHECK((request != NULL) && (request->xml != NULL), return);

xml = request->xml;

Expand All @@ -421,7 +419,7 @@ attrd_client_update(pcmk__request_t *request)
if (handle_value_expansion(&value, child, request->op, attr) == EINVAL) {
pcmk__format_result(&request->result, CRM_EX_NOSUCH, PCMK_EXEC_ERROR,
"Attribute %s does not exist", attr);
return NULL;
return;
}
}

Expand All @@ -442,7 +440,7 @@ attrd_client_update(pcmk__request_t *request)
request->xml = orig_xml;
}

return NULL;
return;
}

attr = pcmk__xe_get(xml, PCMK__XA_ATTR_NAME);
Expand All @@ -451,21 +449,24 @@ attrd_client_update(pcmk__request_t *request)

if (handle_regexes(request) != pcmk_rc_ok) {
/* Error handling was already dealt with in handle_regexes, so just return. */
return NULL;
} else if (regex) {
return;
}

if (regex != NULL) {
/* Recursively call attrd_client_update on the new message with regexes
* expanded. If supported by the attribute daemon, this means that all
* matches can also be handled atomically.
*/
return attrd_client_update(request);
attrd_client_update(request);
return;
}

handle_missing_host(xml);

if (handle_value_expansion(&value, xml, request->op, attr) == EINVAL) {
pcmk__format_result(&request->result, CRM_EX_NOSUCH, PCMK_EXEC_ERROR,
"Attribute %s does not exist", attr);
return NULL;
return;
}

crm_debug("Broadcasting %s[%s]=%s%s",
Expand All @@ -474,7 +475,6 @@ attrd_client_update(pcmk__request_t *request)

send_update_msg_to_cluster(request, xml);
pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return NULL;
}

/*!
Expand Down
103 changes: 53 additions & 50 deletions daemons/attrd/attrd_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,31 @@ handle_clear_failure_request(pcmk__request_t *request)
attrd_peer_clear_failure(request);
pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return NULL;
} else {
remove_unsupported_sync_points(request);

if (attrd_request_has_sync_point(request->xml)) {
/* If this client supplied a sync point it wants to wait for, add it to
* the wait list. Clients on this list will not receive an ACK until
* their sync point is hit which will result in the client stalled there
* until it receives a response.
*
* All other clients will receive the expected response as normal.
*/
attrd_add_client_to_waitlist(request);
}

} else {
/* If the client doesn't want to wait for a sync point, go ahead and send
* the ACK immediately. Otherwise, we'll send the ACK when the appropriate
* sync point is reached.
*/
attrd_send_ack(request->ipc_client, request->ipc_id,
request->ipc_flags);
}
remove_unsupported_sync_points(request);

return attrd_client_clear_failure(request);
if (attrd_request_has_sync_point(request->xml)) {
/* If this client supplied a sync point it wants to wait for, add it to
* the wait list. Clients on this list will not receive an ACK until
* their sync point is hit which will result in the client stalled there
* until it receives a response.
*
* All other clients will receive the expected response as normal.
*/
attrd_add_client_to_waitlist(request);

} else {
/* If the client doesn't want to wait for a sync point, go ahead and
* send the ACK immediately. Otherwise, we'll send the ACK when the
* appropriate sync point is reached.
*/
attrd_send_ack(request->ipc_client, request->ipc_id,
request->ipc_flags);
}

attrd_client_clear_failure(request);
return NULL;
}

static xmlNode *
Expand Down Expand Up @@ -146,20 +147,22 @@ handle_remove_request(pcmk__request_t *request)
}
attrd_peer_remove(host, reap, request->peer);
pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return NULL;

} else {
return attrd_client_peer_remove(request);
attrd_client_peer_remove(request);
}

return NULL;
}

static xmlNode *
handle_refresh_request(pcmk__request_t *request)
{
if (request->peer != NULL) {
return handle_unknown_request(request);
} else {
return attrd_client_refresh(request);
}
attrd_client_refresh(request);
return NULL;
}

static xmlNode *
Expand Down Expand Up @@ -197,35 +200,35 @@ handle_update_request(pcmk__request_t *request)
attrd_peer_update(peer, request->xml, host, false);
pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return NULL;
}

} else {
remove_unsupported_sync_points(request);

if (attrd_request_has_sync_point(request->xml)) {
/* If this client supplied a sync point it wants to wait for, add it to
* the wait list. Clients on this list will not receive an ACK until
* their sync point is hit which will result in the client stalled there
* until it receives a response.
*
* All other clients will receive the expected response as normal.
*/
attrd_add_client_to_waitlist(request);
remove_unsupported_sync_points(request);

} else {
/* If the client doesn't want to wait for a sync point, go ahead and send
* the ACK immediately. Otherwise, we'll send the ACK when the appropriate
* sync point is reached.
*
* In the normal case, attrd_client_update can be called recursively which
* makes where to send the ACK tricky. Doing it here ensures the client
* only ever receives one.
*/
attrd_send_ack(request->ipc_client, request->ipc_id,
request->flags|crm_ipc_client_response);
}
if (attrd_request_has_sync_point(request->xml)) {
/* If this client supplied a sync point it wants to wait for, add it to
* the wait list. Clients on this list will not receive an ACK until
* their sync point is hit which will result in the client stalled there
* until it receives a response.
*
* All other clients will receive the expected response as normal.
*/
attrd_add_client_to_waitlist(request);

return attrd_client_update(request);
} else {
/* If the client doesn't want to wait for a sync point, go ahead and
* send the ACK immediately. Otherwise, we'll send the ACK when the
* appropriate sync point is reached.
*
* In the normal case, attrd_client_update() can be called recursively,
* which makes where to send the ACK tricky. Doing it here ensures that
* the client only ever receives one.
*/
attrd_send_ack(request->ipc_client, request->ipc_id,
request->flags|crm_ipc_client_response);
}

attrd_client_update(request);
return NULL;
}

static void
Expand Down
8 changes: 4 additions & 4 deletions daemons/attrd/pacemaker-attrd.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ void attrd_peer_sync_response(const pcmk__node_status_t *peer, bool peer_won,
xmlNode *xml);

void attrd_send_protocol(const pcmk__node_status_t *peer);
xmlNode *attrd_client_peer_remove(pcmk__request_t *request);
xmlNode *attrd_client_clear_failure(pcmk__request_t *request);
xmlNode *attrd_client_update(pcmk__request_t *request);
xmlNode *attrd_client_refresh(pcmk__request_t *request);
void attrd_client_peer_remove(pcmk__request_t *request);
void attrd_client_clear_failure(pcmk__request_t *request);
void attrd_client_update(pcmk__request_t *request);
void attrd_client_refresh(pcmk__request_t *request);
xmlNode *attrd_client_query(pcmk__request_t *request);
gboolean attrd_send_message(const pcmk__node_status_t *node, xmlNode *data,
bool confirm);
Expand Down