Revision d5927e48

b/lib/bootstrap.py
352 352

  
353 353
  new_master = utils.HostInfo().name
354 354
  old_master = cfg.GetMasterNode()
355
  node_list = cfg.GetNodeList()
355 356

  
356 357
  if old_master == new_master:
357 358
    raise errors.OpPrereqError("This commands must be run on the node"
358 359
                               " where you want the new master to be."
359 360
                               " %s is already the master" %
360 361
                               old_master)
362

  
363
  vote_list = GatherMasterVotes(node_list)
364

  
365
  if vote_list:
366
    voted_master = vote_list[0][0]
367
    if voted_master is None:
368
      raise errors.OpPrereqError("Cluster is inconsistent, most nodes did not"
369
                                 " respond.")
370
    elif voted_master != old_master:
371
      raise errors.OpPrereqError("I have wrong configuration, I believe the"
372
                                 " master is %s but the other nodes voted for"
373
                                 " %s. Please resync the configuration of"
374
                                 " this node." % (old_master, voted_master))
361 375
  # end checks
362 376

  
363 377
  rcode = 0
364 378

  
365
  logging.info("setting master to %s, old master: %s", new_master, old_master)
379
  logging.info("Setting master to %s, old master: %s", new_master, old_master)
366 380

  
367 381
  if not RpcRunner.call_node_stop_master(old_master, True):
368
    logging.error("could disable the master role on the old master"
382
    logging.error("Could not disable the master role on the old master"
369 383
                 " %s, please disable manually", old_master)
370 384

  
371 385
  cfg.SetMasterNode(new_master)
......
375 389

  
376 390
  if not RpcRunner.call_upload_file(cfg.GetNodeList(),
377 391
                                    constants.CLUSTER_CONF_FILE):
378
    logging.error("could not distribute the new simple store master file"
392
    logging.error("Could not distribute the new configuration"
379 393
                  " to the other nodes, please check.")
380 394

  
395

  
381 396
  if not RpcRunner.call_node_start_master(new_master, True):
382
    logging.error("could not start the master role on the new master"
397
    logging.error("Could not start the master role on the new master"
383 398
                  " %s, please check", new_master)
384 399
    rcode = 1
385 400

  

Also available in: Unified diff