Skip to content

Commit

Permalink
Add client-side part of the arbitrator and quorum config merge on join
Browse files Browse the repository at this point in the history
  • Loading branch information
cvaroqui committed Dec 18, 2017
1 parent bf1fd4e commit f711745
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -3698,10 +3698,13 @@ def daemon_join(self):
raise ex.excError("join failed: no cluster.nodes in response")
if not isinstance(cluster_nodes, list):
raise ex.excError("join failed: cluster.nodes value is not a list")
quorum = data.get("quorum", False)

self.config.set("cluster", "name", cluster_name)
self.config.set("cluster", "nodes", " ".join(cluster_nodes))
self.config.set("cluster", "secret", self.options.secret)
if quorum:
self.config.set("cluster", "quorum", "true")

for section, _data in data.items():
if section.startswith("hb#"):
Expand All @@ -3722,6 +3725,15 @@ def daemon_join(self):
self.config.add_section(section)
for option, value in _data.items():
self.config.set(section, option, value)
elif section.startswith("arbitrator#"):
if self.config.has_section(section):
self.log.info("update arbitrator %s", section)
self.config.remove_section(section)
else:
self.log.info("add arbitrator %s", section)
self.config.add_section(section)
for option, value in _data.items():
self.config.set(section, option, value)

# remove obsolete hb configurations
for section in self.config.sections():
Expand All @@ -3735,6 +3747,12 @@ def daemon_join(self):
self.log.info("remove stonith %s", section)
self.config.remove_section(section)

# remove obsolete arbitrator configurations
for section in self.config.sections():
if section.startswith("arbitrator#") and section not in data:
self.log.info("remove arbitrator %s", section)
self.config.remove_section(section)

self.write_config()
self.log.info("join node %s", self.options.node)

Expand Down

0 comments on commit f711745

Please sign in to comment.