Revision 21004460 lib/bootstrap.py
b/lib/bootstrap.py | ||
---|---|---|
602 | 602 |
|
603 | 603 |
logging.info("Setting master to %s, old master: %s", new_master, old_master) |
604 | 604 |
|
605 |
try: |
|
606 |
# instantiate a real config writer, as we now know we have the |
|
607 |
# configuration data |
|
608 |
cfg = config.ConfigWriter() |
|
609 |
|
|
610 |
cluster_info = cfg.GetClusterInfo() |
|
611 |
cluster_info.master_node = new_master |
|
612 |
# this will also regenerate the ssconf files, since we updated the |
|
613 |
# cluster info |
|
614 |
cfg.Update(cluster_info, logging.error) |
|
615 |
except errors.ConfigurationError, err: |
|
616 |
logging.error("Error while trying to set the new master: %s", |
|
617 |
str(err)) |
|
618 |
return 1 |
|
619 |
|
|
620 |
# if cfg.Update worked, then it means the old master daemon won't be |
|
621 |
# able now to write its own config file (we rely on locking in both |
|
622 |
# backend.UploadFile() and ConfigWriter._Write(); hence the next |
|
623 |
# step is to kill the old master |
|
624 |
|
|
625 |
logging.info("Stopping the master daemon on node %s", old_master) |
|
626 |
|
|
605 | 627 |
result = rpc.RpcRunner.call_node_stop_master(old_master, True) |
606 | 628 |
msg = result.fail_msg |
607 | 629 |
if msg: |
608 | 630 |
logging.error("Could not disable the master role on the old master" |
609 | 631 |
" %s, please disable manually: %s", old_master, msg) |
610 | 632 |
|
633 |
logging.info("Checking master IP non-reachability...") |
|
634 |
|
|
611 | 635 |
master_ip = sstore.GetMasterIP() |
612 | 636 |
total_timeout = 30 |
613 | 637 |
# Here we have a phase where no master should be running |
... | ... | |
622 | 646 |
" continuing but activating the master on the current" |
623 | 647 |
" node will probably fail", total_timeout) |
624 | 648 |
|
625 |
# instantiate a real config writer, as we now know we have the |
|
626 |
# configuration data |
|
627 |
cfg = config.ConfigWriter() |
|
628 |
|
|
629 |
cluster_info = cfg.GetClusterInfo() |
|
630 |
cluster_info.master_node = new_master |
|
631 |
# this will also regenerate the ssconf files, since we updated the |
|
632 |
# cluster info |
|
633 |
cfg.Update(cluster_info, logging.error) |
|
649 |
logging.info("Starting the master daemons on the new master") |
|
634 | 650 |
|
635 | 651 |
result = rpc.RpcRunner.call_node_start_master(new_master, True, no_voting) |
636 | 652 |
msg = result.fail_msg |
... | ... | |
639 | 655 |
" %s, please check: %s", new_master, msg) |
640 | 656 |
rcode = 1 |
641 | 657 |
|
658 |
logging.info("Master failed over from %s to %s", old_master, new_master) |
|
642 | 659 |
return rcode |
643 | 660 |
|
644 | 661 |
|
Also available in: Unified diff