Commit bbe19c17 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix master failover

The ssconf files were not updated by the master failover. We need to
push them, and since we already have RPC initialized, we can use the
standard ConfigWriter to do so - this will take care of both the config
file and the ssconf files.

Reviewed-by: imsnah
parent 112f18a5
......@@ -413,7 +413,8 @@ def CheckAgreement():
result = False
if top_node != myself:
logging.critical("It seems we are not the master (top-voted node"
" is %s)", top_node)
" is %s with %d out of %d votes)", top_node, top_votes,
all_votes)
elif top_votes < all_votes - top_votes:
logging.critical("It seems we are not the master (%d votes for,"
" %d votes against)", top_votes, all_votes - top_votes)
......
......@@ -357,10 +357,6 @@ def MasterFailover():
" this node." % (old_master, voted_master))
# end checks
# instantiate a real config writer, as we now know we have the
# configuration data
cfg = ssconf.SimpleConfigWriter()
rcode = 0
logging.info("Setting master to %s, old master: %s", new_master, old_master)
......@@ -369,16 +365,17 @@ def MasterFailover():
logging.error("Could not disable the master role on the old master"
" %s, please disable manually", old_master)
cfg.SetMasterNode(new_master)
cfg.Save()
# Here we have a phase where no master should be running
if not rpc.RpcRunner.call_upload_file(cfg.GetNodeList(),
constants.CLUSTER_CONF_FILE):
logging.error("Could not distribute the new configuration"
" to the other nodes, please check.")
# instantiate a real config writer, as we now know we have the
# configuration data
cfg = config.ConfigWriter()
cluster_info = cfg.GetClusterInfo()
cluster_info.master_node = new_master
# this will also regenerate the ssconf files, since we updated the
# cluster info
cfg.Update(cluster_info)
if not rpc.RpcRunner.call_node_start_master(new_master, True):
logging.error("Could not start the master role on the new master"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment