Skip to content

Commit

Permalink
Fix: crmadmin: return error if DC is not elected #2902 #3606
Browse files Browse the repository at this point in the history
If the DC is not yet elected, the crmadmin will return an error.
(This change complements #3606).
  • Loading branch information
Aleksei Burlakov committed Nov 11, 2024
1 parent 26f9591 commit f0471b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/crm/common/results.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ typedef enum crm_exit_e {
CRM_EX_NOT_YET_IN_EFFECT = 111, //!< Requested item is not in effect
CRM_EX_INDETERMINATE = 112, //!< Could not determine status
CRM_EX_UNSATISFIED = 113, //!< Requested item does not satisfy constraints
CRM_EX_DC_NOT_ELECTED_YET = 114, //!< DC is not yet elected, e.g. right after cluster restart

// Other
CRM_EX_TIMEOUT = 124, //!< Convention from timeout(1)
Expand Down
2 changes: 2 additions & 0 deletions lib/common/results.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ crm_exit_name(crm_exit_t exit_code)
case CRM_EX_NOT_YET_IN_EFFECT: return "CRM_EX_NOT_YET_IN_EFFECT";
case CRM_EX_INDETERMINATE: return "CRM_EX_INDETERMINATE";
case CRM_EX_UNSATISFIED: return "CRM_EX_UNSATISFIED";
case CRM_EX_DC_NOT_ELECTED_YET: return "CRM_EX_DC_NOT_ELECTED_YET";
case CRM_EX_OLD: return "CRM_EX_OLD";
case CRM_EX_TIMEOUT: return "CRM_EX_TIMEOUT";
case CRM_EX_DEGRADED: return "CRM_EX_DEGRADED";
Expand Down Expand Up @@ -786,6 +787,7 @@ crm_exit_str(crm_exit_t exit_code)
case CRM_EX_NOT_YET_IN_EFFECT: return "Requested item is not yet in effect";
case CRM_EX_INDETERMINATE: return "Could not determine status";
case CRM_EX_UNSATISFIED: return "Not applicable under current conditions";
case CRM_EX_DC_NOT_ELECTED_YET: return "DC is not yet elected";
case CRM_EX_OLD: return "Update was older than existing configuration";
case CRM_EX_TIMEOUT: return "Timeout occurred";
case CRM_EX_DEGRADED: return "Service is active but might fail soon";
Expand Down
2 changes: 1 addition & 1 deletion lib/pacemaker/pcmk_cluster_queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ designated_controller_event_cb(pcmk_ipc_api_t *controld_api,

reply = (const pcmk_controld_api_reply_t *) event_data;
out->message(out, "dc", reply->host_from);
data->rc = pcmk_rc_ok;
data->rc = reply->host_from ? pcmk_rc_ok : CRM_EX_DC_NOT_ELECTED_YET;
}

/*!
Expand Down

0 comments on commit f0471b5

Please sign in to comment.