Skip to content

Commit f0471b5

Browse files
author
Aleksei Burlakov
committed
Fix: crmadmin: return error if DC is not elected #2902 #3606
If the DC is not yet elected, the crmadmin will return an error. (This change complements #3606).
1 parent 26f9591 commit f0471b5

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

include/crm/common/results.h

+1
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ typedef enum crm_exit_e {
273273
CRM_EX_NOT_YET_IN_EFFECT = 111, //!< Requested item is not in effect
274274
CRM_EX_INDETERMINATE = 112, //!< Could not determine status
275275
CRM_EX_UNSATISFIED = 113, //!< Requested item does not satisfy constraints
276+
CRM_EX_DC_NOT_ELECTED_YET = 114, //!< DC is not yet elected, e.g. right after cluster restart
276277

277278
// Other
278279
CRM_EX_TIMEOUT = 124, //!< Convention from timeout(1)

lib/common/results.c

+2
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ crm_exit_name(crm_exit_t exit_code)
734734
case CRM_EX_NOT_YET_IN_EFFECT: return "CRM_EX_NOT_YET_IN_EFFECT";
735735
case CRM_EX_INDETERMINATE: return "CRM_EX_INDETERMINATE";
736736
case CRM_EX_UNSATISFIED: return "CRM_EX_UNSATISFIED";
737+
case CRM_EX_DC_NOT_ELECTED_YET: return "CRM_EX_DC_NOT_ELECTED_YET";
737738
case CRM_EX_OLD: return "CRM_EX_OLD";
738739
case CRM_EX_TIMEOUT: return "CRM_EX_TIMEOUT";
739740
case CRM_EX_DEGRADED: return "CRM_EX_DEGRADED";
@@ -786,6 +787,7 @@ crm_exit_str(crm_exit_t exit_code)
786787
case CRM_EX_NOT_YET_IN_EFFECT: return "Requested item is not yet in effect";
787788
case CRM_EX_INDETERMINATE: return "Could not determine status";
788789
case CRM_EX_UNSATISFIED: return "Not applicable under current conditions";
790+
case CRM_EX_DC_NOT_ELECTED_YET: return "DC is not yet elected";
789791
case CRM_EX_OLD: return "Update was older than existing configuration";
790792
case CRM_EX_TIMEOUT: return "Timeout occurred";
791793
case CRM_EX_DEGRADED: return "Service is active but might fail soon";

lib/pacemaker/pcmk_cluster_queries.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ designated_controller_event_cb(pcmk_ipc_api_t *controld_api,
235235

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

241241
/*!

0 commit comments

Comments
 (0)