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

[UNTESTED] prevent clusters with an even number of nodes #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aspiers
Copy link
Member

@aspiers aspiers commented Sep 7, 2015

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.

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."
Copy link
Member

Choose a reason for hiding this comment

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

You're old-school. We don't use two spaces at the end of a sentence anymore ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Who's "we"? I use it all the time :-p And it has the significant advantage of allowing my editor to jump forward/backward by one sentence at a time.

Copy link
Member

Choose a reason for hiding this comment

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

We should use i18n here. ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

We should use i18n here. ;)

👍 that's how it should be done for all new code parts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now uses i18n. I think I originally submitted this before we used i18n :-)

@vuntz
Copy link
Member

vuntz commented Sep 10, 2015

Anyway, +1 for the code.

@aplanas
Copy link
Contributor

aplanas commented Dec 16, 2015

+1 for me, but maybe this needs to be checked also in the UI part (javascript)?

@@ -510,6 +510,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

Choose a reason for hiding this comment

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

Style/EvenOdd: Replace with Fixnum#even?. (https://github.com/bbatsov/ruby-style-guide#predicate-methods)

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.
@aspiers
Copy link
Member Author

aspiers commented Dec 17, 2015

Updated, but still haven't tested. Any volunteers? ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

8 participants