Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: crmadmin: return error if DC is not elected #2902 #3606 #3716

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For brevity, let's use CRM_EX_NO_DC


// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I'm a little slow this morning ... data->rc is a return code, not an exit code. It will get mapped to an exit code by crmadmin.

We need a new pcmk_rc_no_dc return code in enum pcmk_rc_e in include/crm/common/results.h, and then pcmk_rc2exitc() can map it to CRM_EX_NO_DC.

}

/*!
Expand Down