Revision 8135a2db lib/bootstrap.py
b/lib/bootstrap.py | ||
---|---|---|
323 | 323 |
new master. |
324 | 324 |
|
325 | 325 |
""" |
326 |
cfg = ssconf.SimpleConfigWriter()
|
|
326 |
sstore = ssconf.SimpleStore()
|
|
327 | 327 |
|
328 |
new_master = utils.HostInfo().name
|
|
329 |
old_master = cfg.GetMasterNode()
|
|
330 |
node_list = cfg.GetNodeList()
|
|
328 |
old_master, new_master = ssconf.GetMasterAndMyself(sstore)
|
|
329 |
node_list = sstore.GetNodeList()
|
|
330 |
mc_list = sstore.GetMasterCandidates()
|
|
331 | 331 |
|
332 | 332 |
if old_master == new_master: |
333 | 333 |
raise errors.OpPrereqError("This commands must be run on the node" |
... | ... | |
335 | 335 |
" %s is already the master" % |
336 | 336 |
old_master) |
337 | 337 |
|
338 |
if new_master not in mc_list: |
|
339 |
mc_no_master = [name for name in mc_list if name != old_master] |
|
340 |
raise errors.OpPrereqError("This node is not among the nodes marked" |
|
341 |
" as master candidates. Only these nodes" |
|
342 |
" can become masters. Current list of" |
|
343 |
" master candidates is:\n" |
|
344 |
"%s" % ('\n'.join(mc_no_master))) |
|
345 |
|
|
338 | 346 |
vote_list = GatherMasterVotes(node_list) |
339 | 347 |
|
340 | 348 |
if vote_list: |
... | ... | |
349 | 357 |
" this node." % (old_master, voted_master)) |
350 | 358 |
# end checks |
351 | 359 |
|
360 |
# instantiate a real config writer, as we now know we have the |
|
361 |
# configuration data |
|
362 |
cfg = ssconf.SimpleConfigWriter() |
|
363 |
|
|
352 | 364 |
rcode = 0 |
353 | 365 |
|
354 | 366 |
logging.info("Setting master to %s, old master: %s", new_master, old_master) |
Also available in: Unified diff