Skip to content

Commit

Permalink
prevent clusters with an even number of nodes
Browse files Browse the repository at this point in the history
Clusters must have an odd number of nodes to ensure quorum during
partitioning.  2-node clusters are allowed as a special exception
for the typical DRBD setup.
  • Loading branch information
Adam Spiers committed Dec 17, 2015
1 parent 1fd0cb1 commit ccfcaf0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crowbar_framework/app/models/pacemaker_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,12 @@ def validate_proposal_after_save proposal
elements = proposal["deployment"]["pacemaker"]["elements"]
members = elements["pacemaker-cluster-member"] || []

if members.length.even? && members.length > 2
validation_error I18n.t(
"barclamp.#{bc_name}.validation.cluster_size_even"
)
end

if elements.key?("hawk-server")
elements["hawk-server"].each do |n|
@logger.debug("checking #{n}")
Expand Down
3 changes: 3 additions & 0 deletions crowbar_framework/config/locales/pacemaker/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ en:
quorum_policy: 'Invalid no-quorum-policy value: %{no_quorum_policy}.'
platform: 'All nodes in proposal must have the same platform.'
pacemaker_proposal: 'Nodes cannot be part of multiple Pacemaker proposals, but %{other_member} is already part of proposal \"%{p_name}\".'
cluster_size_even:
'Clusters must have an odd number of nodes to ensure quorum during
partitioning. 2-node clusters are allowed as a special exception.'

0 comments on commit ccfcaf0

Please sign in to comment.