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 Sep 7, 2015
1 parent ab982ad commit 2961378
Showing 1 changed file with 6 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 @@ -460,6 +460,12 @@ def validate_proposal_after_save proposal
elements = proposal["deployment"]["pacemaker"]["elements"]
members = elements["pacemaker-cluster-member"] || []

if members.length % 2 == 0 && members.length > 2
validation_error \
"Clusters must have an odd number of nodes to ensure quorum during " \
"partitioning. 2-node clusters are allowed as a special exception."
end

if elements.has_key?("hawk-server")
elements["hawk-server"].each do |n|
@logger.debug("checking #{n}")
Expand Down

0 comments on commit 2961378

Please sign in to comment.